@instruments/materialgraph 0.29.0 → 0.31.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.
Files changed (89) hide show
  1. package/brands-client.d.ts +1 -1
  2. package/by-colour-types.d.ts +4 -4
  3. package/catalogue-client.d.ts +3 -3
  4. package/catalogue-client.js +3 -3
  5. package/catalogue-types.d.ts +1 -1
  6. package/client-vocabulary.d.ts +3 -5
  7. package/client-vocabulary.js +9 -6
  8. package/client.d.ts +85 -174
  9. package/client.js +98 -211
  10. package/colour-region-types.d.ts +18 -0
  11. package/colours-client.d.ts +10 -83
  12. package/colours-client.js +1 -85
  13. package/errors.d.ts +1 -1
  14. package/errors.js +1 -0
  15. package/find-companions-types.d.ts +70 -0
  16. package/find-companions-types.js +12 -0
  17. package/find-variants-by-colour-types.d.ts +197 -0
  18. package/find-variants-by-vector-types.d.ts +67 -0
  19. package/find-variants-by-vector-types.js +5 -0
  20. package/get-variant-types.d.ts +50 -0
  21. package/get-variant-types.js +10 -0
  22. package/http-transport.d.ts +1 -1
  23. package/identifiers.d.ts +1 -1
  24. package/identifiers.js +1 -1
  25. package/image-reference-types.d.ts +18 -0
  26. package/index.d.ts +9 -7
  27. package/index.js +1 -1
  28. package/list-enum-values-types.d.ts +58 -0
  29. package/list-variants-types.d.ts +6 -2
  30. package/material-asset-types.d.ts +2 -2
  31. package/material-types.d.ts +13 -151
  32. package/operations.d.ts +1 -1
  33. package/operations.js +27 -88
  34. package/package.json +1 -1
  35. package/palette-search-types.d.ts +3 -49
  36. package/resolve-colour-types.d.ts +5 -5
  37. package/resolve-variant-types.d.ts +75 -0
  38. package/{identify-types.js → resolve-variant-types.js} +2 -2
  39. package/response-schemas.generated.d.ts +1 -1
  40. package/response-schemas.generated.js +46 -84
  41. package/run-types.d.ts +23 -216
  42. package/runs.d.ts +10 -58
  43. package/runs.js +19 -106
  44. package/schema-resource-types.d.ts +2 -139
  45. package/schema-resource-types.js +0 -8
  46. package/search-card-types.d.ts +1 -1
  47. package/search-index-plan-types.d.ts +6 -2
  48. package/search-request-types.d.ts +10 -2
  49. package/spec-types.d.ts +4 -4
  50. package/spec-types.js +2 -2
  51. package/specifications.d.ts +1 -9
  52. package/specifications.js +0 -12
  53. package/sse.d.ts +2 -2
  54. package/sse.js +2 -2
  55. package/types.d.ts +4 -38
  56. package/validation.d.ts +0 -74
  57. package/validation.js +2 -116
  58. package/webmcp.generated.js +9 -9
  59. package/workflows-client.d.ts +54 -0
  60. package/workflows-client.js +41 -0
  61. package/client-source-material-comments.d.ts +0 -51
  62. package/client-source-material-comments.js +0 -6
  63. package/codes-client.d.ts +0 -118
  64. package/codes-client.js +0 -99
  65. package/codes-types.d.ts +0 -325
  66. package/colour-aggregate-types.d.ts +0 -163
  67. package/coordinate-client.d.ts +0 -23
  68. package/coordinate-client.js +0 -13
  69. package/demand-batch-types.d.ts +0 -118
  70. package/demand-types.d.ts +0 -154
  71. package/identify-types.d.ts +0 -82
  72. package/material-composition-client.d.ts +0 -21
  73. package/material-composition-client.js +0 -13
  74. package/material-composition-types.d.ts +0 -403
  75. package/material-composition-types.js +0 -1
  76. package/source-material-validation.d.ts +0 -7
  77. package/source-material-validation.js +0 -214
  78. package/spec-facet-types.d.ts +0 -48
  79. package/spec-facet-types.js +0 -7
  80. package/substitute-types.d.ts +0 -102
  81. package/substitute-types.js +0 -1
  82. package/suggest-types.d.ts +0 -67
  83. package/suggest-types.js +0 -28
  84. package/taxonomy-coverage-types.d.ts +0 -34
  85. package/taxonomy-coverage-types.js +0 -1
  86. /package/{codes-types.js → colour-region-types.js} +0 -0
  87. /package/{colour-aggregate-types.js → find-variants-by-colour-types.js} +0 -0
  88. /package/{demand-batch-types.js → image-reference-types.js} +0 -0
  89. /package/{demand-types.js → list-enum-values-types.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  import type { OpenEnum } from "./types.js";
2
- /** The nine governed static resources. */
3
- export type SchemaResource = "blocks" | "attributes" | "verticals" | "productTypes" | "units" | "valueDictionaries" | "sourceRequirements" | "productTypeTemplates" | "mappings";
2
+ /** The governed static resources. */
3
+ export type SchemaResource = "valueDictionaries";
4
4
  /**
5
5
  * Resource → the operation that serves it. Internal to the SDK (`index.ts`
6
6
  * re-exports this module's TYPES only), and it lives beside
@@ -8,15 +8,7 @@ export type SchemaResource = "blocks" | "attributes" | "verticals" | "productTyp
8
8
  * it must cover cannot drift apart.
9
9
  */
10
10
  export declare const SCHEMA_RESOURCE_OPERATION_IDS: {
11
- readonly attributes: "list_schema_attributes";
12
- readonly blocks: "list_schema_blocks";
13
- readonly mappings: "list_schema_mappings";
14
- readonly productTypeTemplates: "list_schema_product_type_templates";
15
- readonly productTypes: "list_schema_product_types";
16
- readonly sourceRequirements: "list_schema_source_requirements";
17
- readonly units: "list_schema_units";
18
11
  readonly valueDictionaries: "list_schema_value_dictionaries";
19
- readonly verticals: "list_schema_verticals";
20
12
  };
21
13
  export type SchemaResourceRequest = SchemaResource;
22
14
  export type SchemaLifecycle = {
@@ -37,81 +29,6 @@ export type SchemaExternalMapping = {
37
29
  notes?: string;
38
30
  };
39
31
  export type SchemaMatchStrength = OpenEnum<"exact" | "close" | "broad" | "narrow" | "related">;
40
- export type SchemaBlockItem = {
41
- id: string;
42
- semanticId: string;
43
- lifecycle: SchemaLifecycle;
44
- name: string;
45
- description: string;
46
- attributeIds: string[];
47
- };
48
- export type KnownSchemaQuantityKind = "length" | "area" | "volume" | "mass" | "time" | "temperature" | "currency" | "ratio" | "density" | "coverage" | "emissions" | "force" | "thermal_conductivity" | "power" | "voltage" | "current" | "frequency" | "luminous_flux" | "color_temperature" | "count" | "unitless";
49
- export type SchemaQuantityKind = OpenEnum<KnownSchemaQuantityKind>;
50
- export type SchemaAttributeItem = {
51
- id: string;
52
- semanticId: string;
53
- lifecycle: SchemaLifecycle;
54
- name: string;
55
- description: string;
56
- valueKind: OpenEnum<"string" | "text" | "integer" | "number" | "boolean" | "enum" | "object" | "reference">;
57
- quantityKind: SchemaQuantityKind | null;
58
- canonicalUnitId: string | null;
59
- acceptedUnitIds: string[];
60
- valueDictionaryId: string | null;
61
- defaultSourceRequirementId: string | null;
62
- externalMappings: SchemaExternalMapping[];
63
- searchFacet: boolean;
64
- comparable: boolean;
65
- usedInBlocks: string[];
66
- enumValues: string[] | null;
67
- };
68
- export type SchemaVerticalItem = {
69
- id: string;
70
- displayName: string;
71
- description: string;
72
- };
73
- export type SchemaApplicability = OpenEnum<"required" | "recommended" | "optional" | "unusual">;
74
- export type SchemaProductTypeBlock = {
75
- blockId: string;
76
- applicability: SchemaApplicability;
77
- requiredAttributes?: string[];
78
- optionalAttributes?: string[];
79
- sourceRequirementId?: string;
80
- completenessWeight?: number;
81
- notes?: string;
82
- optional?: boolean;
83
- };
84
- export type SchemaProductTypeItem = {
85
- id: string;
86
- name: string;
87
- description?: string;
88
- /** Display names this type carried before a rename, kept so they still find it. */
89
- formerNames?: string[];
90
- verticalId: string;
91
- parentProductTypeGroupId?: string;
92
- blocks: SchemaProductTypeBlock[];
93
- productTypeSpecificAttributes?: string[];
94
- semanticId: string;
95
- lifecycle: SchemaLifecycle;
96
- };
97
- export type SchemaUnitItem = {
98
- id: string;
99
- name: string;
100
- symbol: string;
101
- quantityKind: SchemaQuantityKind;
102
- acceptedSourceUnits?: string[];
103
- conversionToCanonical?: {
104
- factor: number;
105
- offset?: number;
106
- };
107
- notes?: string;
108
- /** UN/CEFACT Rec 20 common code (schema.org `unitCode`); absent when Rec 20 has none. */
109
- uncefactCode?: string;
110
- /** QUDT unit IRI, where exactly one QUDT unit matches. */
111
- qudtUnit?: string;
112
- semanticId: string;
113
- lifecycle: SchemaLifecycle;
114
- };
115
32
  export type SchemaValueDictionaryTerm = {
116
33
  id: string;
117
34
  label: string;
@@ -129,62 +46,8 @@ export type SchemaValueDictionaryItem = {
129
46
  semanticId: string;
130
47
  lifecycle: SchemaLifecycle;
131
48
  };
132
- export type KnownSchemaSourceType = "manufacturer_page" | "technical_data_sheet" | "safety_data_sheet" | "test_report" | "certificate" | "image" | "commerce_page" | "catalog_pdf" | "derived_analysis";
133
- export type SchemaSourceType = OpenEnum<KnownSchemaSourceType>;
134
- export type KnownSchemaSourceMethod = "manual_review" | "agent_extract" | "pdf_extract" | "image_analysis" | "html_scrape" | "structured_feed" | "calculation";
135
- export type SchemaSourceMethod = OpenEnum<KnownSchemaSourceMethod>;
136
- export type SchemaSourceRequirementItem = {
137
- id: string;
138
- name: string;
139
- description: string;
140
- allowedSourceTypes: SchemaSourceType[];
141
- allowedMethods: SchemaSourceMethod[];
142
- minConfidence: number;
143
- reviewRequired: boolean;
144
- freshnessDays?: number;
145
- sourceBasis?: OpenEnum<"declared" | "derived">;
146
- semanticId: string;
147
- lifecycle: SchemaLifecycle;
148
- };
149
- export type SchemaProductTypeTemplateBlock = {
150
- blockId: string;
151
- applicability: SchemaApplicability;
152
- requiredAttributes?: string[];
153
- optionalAttributes?: string[];
154
- sourceRequirementId?: string;
155
- completenessWeight?: number;
156
- notes?: string;
157
- };
158
- export type SchemaProductTypeTemplateItem = {
159
- id: string;
160
- name: string;
161
- productTypeId: string;
162
- blocks: SchemaProductTypeTemplateBlock[];
163
- defaultSourceRequirementId?: string;
164
- notes?: string;
165
- semanticId: string;
166
- lifecycle: SchemaLifecycle;
167
- };
168
- export type SchemaMappingItem = {
169
- target: SchemaExternalMapping["target"];
170
- subjectKind?: OpenEnum<"attribute" | "block" | "product_type" | "template" | "unit" | "value_dictionary" | "value_dictionary_term">;
171
- subjectId?: string;
172
- canonicalPath: string;
173
- targetPath: string;
174
- mappingType: SchemaExternalMapping["mappingType"];
175
- matchStrength?: SchemaMatchStrength;
176
- notes?: string;
177
- };
178
49
  export type SchemaResourceItemMap = {
179
- blocks: SchemaBlockItem;
180
- attributes: SchemaAttributeItem;
181
- verticals: SchemaVerticalItem;
182
- productTypes: SchemaProductTypeItem;
183
- units: SchemaUnitItem;
184
50
  valueDictionaries: SchemaValueDictionaryItem;
185
- sourceRequirements: SchemaSourceRequirementItem;
186
- productTypeTemplates: SchemaProductTypeTemplateItem;
187
- mappings: SchemaMappingItem;
188
51
  };
189
52
  export type SchemaResourceResponse<K extends SchemaResource = SchemaResource> = {
190
53
  kind: K;
@@ -5,13 +5,5 @@
5
5
  * it must cover cannot drift apart.
6
6
  */
7
7
  export const SCHEMA_RESOURCE_OPERATION_IDS = {
8
- attributes: "list_schema_attributes",
9
- blocks: "list_schema_blocks",
10
- mappings: "list_schema_mappings",
11
- productTypeTemplates: "list_schema_product_type_templates",
12
- productTypes: "list_schema_product_types",
13
- sourceRequirements: "list_schema_source_requirements",
14
- units: "list_schema_units",
15
8
  valueDictionaries: "list_schema_value_dictionaries",
16
- verticals: "list_schema_verticals",
17
9
  };
@@ -16,7 +16,7 @@ import type { OpenEnum, SearchData, SearchResponse } from "./types.js";
16
16
  *
17
17
  * A PROJECTION, not a smaller answer: a field the card omits (palette, verdict,
18
18
  * signals, availability) is unread here, never known-absent. Re-read the same
19
- * `variantId` at `view: "full"` or via `material()` before claiming anything the
19
+ * `variantId` at `view: "full"` or via `getVariant()` before claiming anything the
20
20
  * card does not carry.
21
21
  */
22
22
  export type SearchCardItem = {
@@ -5,9 +5,10 @@
5
5
  * `@materialgraph/products/search-index/plan-schema`; `key-parity.test.ts`
6
6
  * holds the two to the same fields.
7
7
  */
8
+ import type { ColourRegionRange } from "./colour-region-types.js";
8
9
  import type { CorpusScope } from "./corpus-scope-types.js";
9
10
  /** One attribute the plan wants: its terms, or any value when `presence`. */
10
- export type SearchIndexPlanWant = {
11
+ type SearchIndexPlanWant = {
11
12
  attributeId: string;
12
13
  /** Share of the category's materials stating the attribute, 0 to 1. */
13
14
  fill: number;
@@ -20,7 +21,7 @@ export type SearchIndexPlanWant = {
20
21
  terms: string[];
21
22
  };
22
23
  /**
23
- * The query's plan: the category, makers, wanted and excluded attribute terms,
24
+ * The query's plan: the category, brands, wanted and excluded attribute terms,
24
25
  * the colour, the words left for text, and the caller's corpus scope.
25
26
  */
26
27
  export type SearchIndexPlan = {
@@ -40,6 +41,8 @@ export type SearchIndexPlan = {
40
41
  hex: string;
41
42
  oklab: [number, number, number];
42
43
  phrase: string;
44
+ /** The colour's region, when the plan holds one rather than a point. */
45
+ range?: ColourRegionRange;
43
46
  } | null;
44
47
  /** Present only when the caller sent a scope narrower than the whole graph. */
45
48
  corpusScope?: Exclude<CorpusScope, "all">;
@@ -68,3 +71,4 @@ export type SearchPlanReceipt = {
68
71
  source: "dictionary" | "jev";
69
72
  version: string;
70
73
  };
74
+ export {};
@@ -5,6 +5,7 @@
5
5
  * repo's source-size gate; every name here is re-exported from `types.ts`, so
6
6
  * no import path changes.
7
7
  */
8
+ import type { ColourRegionRange } from "./colour-region-types.js";
8
9
  import type { CorpusScope } from "./corpus-scope-types.js";
9
10
  import type { Cursor, VariantId } from "./identifiers.js";
10
11
  import type { OpenEnum, SearchImageInput } from "./types.js";
@@ -93,16 +94,23 @@ export type SearchInput = {
93
94
  * existing Variant. The page is the colour's family, nearest first by OKLab
94
95
  * distance; it replaces any colour read from `text`. A Variant with no colour
95
96
  * on the index is a 400.
97
+ *
98
+ * `oklab` and `range` are additive: send them when you already resolved the
99
+ * exact OKLab point or the named colour's region (see `resolveColour()`), and
100
+ * the plan carries that colour without re-deriving it from `hex`. `hex` stays
101
+ * required.
96
102
  */
97
103
  colour?: {
98
104
  hex: string;
105
+ oklab?: [number, number, number];
106
+ range?: ColourRegionRange;
99
107
  } | {
100
108
  variantId: VariantId;
101
109
  };
102
110
  /**
103
- * Makers the page must come from: canonical brand ids, exact slugs
111
+ * Brands the page must come from: canonical brand ids, exact slugs
104
112
  * ("sherwin-williams") or exact display names ("Sherwin-Williams"), up to
105
- * 50. They replace the makers `text` was read as. An empty list is the
113
+ * 50. They replace the brands `text` was read as. An empty list is the
106
114
  * same request as omitting it — every brand. An unrecognised value is a
107
115
  * 400 naming it; a display name shared by more than one brand is a 400
108
116
  * naming the exact slugs to choose between; a brand MaterialGraph holds no
package/spec-types.d.ts CHANGED
@@ -22,8 +22,8 @@
22
22
  * object literal for anything else). Reach for it when the spec is the
23
23
  * whole question and ranking would be noise.
24
24
  *
25
- * Discover the tokens before you spend them: `client.specificationFacets()` for
26
- * what is facetable at all, `client.attributeValues()` for one attribute's
25
+ * Discover the tokens before you spend them: `client.listVariantFacets()` for
26
+ * the live values of the attributes you name, `client.attributeValues()` for one attribute's
27
27
  * values, `client.listAttributes({ query })` to turn a phrase into a canonical
28
28
  * attribute id. A hand-guessed token returns an honest empty answer, which is
29
29
  * the hardest kind of bug to see.
@@ -57,8 +57,8 @@ export type CertificationProgrammeAttributeId = typeof CERTIFICATION_PROGRAMME_A
57
57
  /**
58
58
  * A term-equality spec criterion: the attribute must carry this canonical value,
59
59
  * e.g. `{ attributeId: "fire_classifications", term: "astm_e84_class_a" }`.
60
- * Discover valid `attributeId`/`term` pairs via `client.specificationFacets()`
61
- * and `client.attributeValues()`, or find an attribute from free text with
60
+ * Discover valid `attributeId`/`term` pairs via `client.listVariantFacets()`
61
+ * and `client.listEnumValues()`, or find an attribute from free text with
62
62
  * `client.listAttributes({ query })`.
63
63
  */
64
64
  export type SpecTermFilter = {
package/spec-types.js CHANGED
@@ -22,8 +22,8 @@
22
22
  * object literal for anything else). Reach for it when the spec is the
23
23
  * whole question and ranking would be noise.
24
24
  *
25
- * Discover the tokens before you spend them: `client.specificationFacets()` for
26
- * what is facetable at all, `client.attributeValues()` for one attribute's
25
+ * Discover the tokens before you spend them: `client.listVariantFacets()` for
26
+ * the live values of the attributes you name, `client.attributeValues()` for one attribute's
27
27
  * values, `client.listAttributes({ query })` to turn a phrase into a canonical
28
28
  * attribute id. A hand-guessed token returns an honest empty answer, which is
29
29
  * the hardest kind of bug to see.
@@ -1,12 +1,4 @@
1
- import type { CertificationProgrammeFilter, SpecExclusionFilter, SpecPresenceFilter, SpecTermFilter } from "./spec-types.js";
2
- /**
3
- * A hard criterion excluding one canonical value.
4
- *
5
- * By default retains only variants with a KNOWN value (unstated does not
6
- * pass). Pass `whenUnstated: "pass"` to admit unstated variants too — only a
7
- * variant that STATES the excluded term is dropped.
8
- */
9
- export declare const excludeSpec: (attributeId: string, excludesTerm: string, whenUnstated?: "drop" | "pass") => SpecExclusionFilter;
1
+ import type { CertificationProgrammeFilter, SpecPresenceFilter, SpecTermFilter } from "./spec-types.js";
10
2
  /**
11
3
  * A term-equality criterion for `search({ filters })` — the attribute must
12
4
  * carry this canonical value.
package/specifications.js CHANGED
@@ -15,18 +15,6 @@
15
15
  * object literal needs no encoder (MG-2222).
16
16
  */
17
17
  import { CERTIFICATION_PROGRAMME_ATTRIBUTE_ID } from "./spec-types.js";
18
- /**
19
- * A hard criterion excluding one canonical value.
20
- *
21
- * By default retains only variants with a KNOWN value (unstated does not
22
- * pass). Pass `whenUnstated: "pass"` to admit unstated variants too — only a
23
- * variant that STATES the excluded term is dropped.
24
- */
25
- export const excludeSpec = (attributeId, excludesTerm, whenUnstated) => ({
26
- attributeId,
27
- excludesTerm,
28
- ...(whenUnstated === undefined ? {} : { whenUnstated }),
29
- });
30
18
  /**
31
19
  * A term-equality criterion for `search({ filters })` — the attribute must
32
20
  * carry this canonical value.
package/sse.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * A minimal, dependency-free Server-Sent Events reader — the primitive behind
3
- * {@link MaterialGraphClient.streamRunEvents}. Hand-rolled (no `eventsource`,
3
+ * {@link WorkflowsClient.streamRunEvents}. Hand-rolled (no `eventsource`,
4
4
  * no `undici`) so the SDK stays zero-runtime-dep and works unchanged inside
5
5
  * Node route handlers, where `fetch` yields a byte `ReadableStream`.
6
6
  *
7
7
  * The parser follows the WHATWG event-stream tokenizer closely enough for the
8
- * `/api/v1/runs/{runId}/events` contract: `\n`, `\r\n`, and `\r` line endings,
8
+ * `/api/v1/workflows/{workflowId}/runs/{runId}/events` contract: `\n`, `\r\n`, and `\r` line endings,
9
9
  * multi-line `data:` accumulation, comment (`:`-prefixed) lines, and a single
10
10
  * optional leading space after the field colon. Frames split across network
11
11
  * chunks are held in an internal buffer until their terminating blank line.
package/sse.js CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * A minimal, dependency-free Server-Sent Events reader — the primitive behind
3
- * {@link MaterialGraphClient.streamRunEvents}. Hand-rolled (no `eventsource`,
3
+ * {@link WorkflowsClient.streamRunEvents}. Hand-rolled (no `eventsource`,
4
4
  * no `undici`) so the SDK stays zero-runtime-dep and works unchanged inside
5
5
  * Node route handlers, where `fetch` yields a byte `ReadableStream`.
6
6
  *
7
7
  * The parser follows the WHATWG event-stream tokenizer closely enough for the
8
- * `/api/v1/runs/{runId}/events` contract: `\n`, `\r\n`, and `\r` line endings,
8
+ * `/api/v1/workflows/{workflowId}/runs/{runId}/events` contract: `\n`, `\r\n`, and `\r` line endings,
9
9
  * multi-line `data:` accumulation, comment (`:`-prefixed) lines, and a single
10
10
  * optional leading space after the field colon. Frames split across network
11
11
  * chunks are held in an internal buffer until their terminating blank line.
package/types.d.ts CHANGED
@@ -28,7 +28,7 @@ import type { ResponseAttribution } from "./attribution-types.js";
28
28
  import type { CorpusScope } from "./corpus-scope-types.js";
29
29
  import type { Cursor, ProductId, VariantId } from "./identifiers.js";
30
30
  import type { FilterOp } from "./list-variants-types.js";
31
- import type { MaterialDetail, MaterialTile } from "./material-types.js";
31
+ import type { MaterialTile } from "./material-types.js";
32
32
  import type { SearchMode, SearchResponseExplainReceipts } from "./search-response-receipt-types.js";
33
33
  export type { SearchResponse } from "./search-response-types.js";
34
34
  export type * from "./search-response-receipt-types.js";
@@ -77,7 +77,7 @@ export type MaterialColour = {
77
77
  };
78
78
  /** Where the served image came from. */
79
79
  export type ImageSource = OpenEnum<"r2" | "origin">;
80
- export type { DimensionEntry, MaterialAvailability, MaterialDetail, MaterialFacet, MaterialSuccessor, MaterialTile, } from "./material-types.js";
80
+ export type { MaterialAvailability, MaterialTile } from "./material-types.js";
81
81
  /**
82
82
  * Match only: the image-space cosine between the query image and this row's
83
83
  * image, in [0,1]. Null when it was not measured.
@@ -98,7 +98,7 @@ export type SearchResultItem = {
98
98
  resultId?: string;
99
99
  /** Accepted sampleability fact. Absent means unknown, never false. */
100
100
  sampleable?: boolean;
101
- /** Opaque — round-trip verbatim into `material()`, `pairings()`, `similarTo`. */
101
+ /** Opaque — round-trip verbatim into `getVariant()`, `pairings()`, `similarTo`. */
102
102
  variantId: VariantId;
103
103
  brand: string;
104
104
  product: string;
@@ -485,17 +485,6 @@ export type PairingsResponse = {
485
485
  /** Opaque continuation bound to the seed, filters, corpus, and order. */
486
486
  nextCursor?: Cursor;
487
487
  };
488
- export type MaterialResponse = {
489
- material: MaterialDetail;
490
- };
491
- export type SuggestColourResponse = {
492
- suggestions: {
493
- term: string;
494
- hex: string;
495
- libraryId?: string;
496
- kind: string;
497
- }[];
498
- };
499
488
  /**
500
489
  * How a {@link AttributeListItem} matched the query. Declared here rather than
501
490
  * imported: this package is published, so it may not reach across into
@@ -554,7 +543,6 @@ export type ListAttributesResult = {
554
543
  };
555
544
  export type * from "./catalog-discovery-types.js";
556
545
  export type * from "./resolve-colour-types.js";
557
- export type * from "./suggest-types.js";
558
546
  export type * from "./by-spec-types.js";
559
547
  export type WhoamiResponse = {
560
548
  principal: string;
@@ -578,6 +566,7 @@ export type SearchImageInput = {
578
566
  };
579
567
  export type { SearchGetParams, SearchIndexFilter, SearchInput, } from "./search-request-types.js";
580
568
  export type { SearchIndexPlan, SearchPlanReceipt, } from "./search-index-plan-types.js";
569
+ export type { ColourRegionRange } from "./colour-region-types.js";
581
570
  /** Options for a pairings read. */
582
571
  export type PairingsOptions = {
583
572
  /** Comma-separated coarse category display names; filters both arms. */
@@ -608,28 +597,6 @@ export type ListAttributesOptions = {
608
597
  /** `pageInfo.endCursor` from the previous page, with the same query and scope. */
609
598
  cursor?: string;
610
599
  };
611
- export type * from "./demand-types.js";
612
- /** One quarter's tally. Sparse across a series — an absent quarter is not a zero. */
613
- export type DemandQuarter = {
614
- quarter: string;
615
- specCount: number;
616
- projectCount: number;
617
- };
618
- /**
619
- * Which behavioural signal a demand read is scoped to — and therefore what a
620
- * number drawn from it may honestly be called.
621
- *
622
- * - `sampled` — real ORDER co-occurrence. The default everywhere. Present as
623
- * "specified together" / "specified on N projects".
624
- * - `considered` — board / moodboard CURATION. Somebody assembled them; nobody
625
- * is known to have bought them. Present as "considered alongside", never as
626
- * a specification.
627
- * - `specified` — the won tier. STATS ONLY: no co-specification edges are built
628
- * at this grain, so asking for `specified` companions is a rejected request,
629
- * not an empty result.
630
- */
631
- export type DemandSignal = OpenEnum<"sampled" | "considered" | "specified">;
632
- export type * from "./demand-batch-types.js";
633
600
  export type ExtractedPalette = {
634
601
  colors: {
635
602
  hex: string;
@@ -647,7 +614,6 @@ export type ExtractedPalette = {
647
614
  export type ExtractPaletteResponse = {
648
615
  palette: ExtractedPalette | null;
649
616
  };
650
- export type * from "./spec-facet-types.js";
651
617
  /** Body for `POST /api/v1/search/palettes/extract`. */
652
618
  export type ExtractPaletteInput = {
653
619
  /** The query image as a data URI or bare base64 string. */
package/validation.d.ts CHANGED
@@ -15,37 +15,19 @@
15
15
  * this file knowing what a Match frame or a Run event is.
16
16
  */
17
17
  import type { MaterialGraphError } from "./errors.js";
18
- import type { JsonValue } from "./types.js";
19
18
  /**
20
19
  * Builds the one error a validation run raises. The calling module supplies it,
21
20
  * so the message names that payload and quotes its source.
22
21
  */
23
22
  export type ValidationFailure = (reason: string) => MaterialGraphError;
24
- export declare const isRecord: (value: unknown) => value is Record<string, unknown>;
25
23
  /** A `z.object({…})`. */
26
24
  export declare const requireRecord: (value: unknown, what: string, fail: ValidationFailure) => Record<string, unknown>;
27
25
  /** A `z.string()`. */
28
26
  export declare const requireString: (value: unknown, what: string, fail: ValidationFailure) => string;
29
- /** A `z.string().min(1)`. */
30
- export declare const requireNonEmptyString: (value: unknown, what: string, fail: ValidationFailure) => string;
31
27
  /** A `z.string().optional()`: absent is fine, present-but-wrong is not. */
32
28
  export declare const requireOptionalString: (value: unknown, what: string, fail: ValidationFailure) => void;
33
29
  /** A `z.string().nullable()`. */
34
30
  export declare const requireNullableString: (value: unknown, what: string, fail: ValidationFailure) => string | null;
35
- /** A `z.string().min(1).nullable()`. */
36
- export declare const requireNullableNonEmptyString: (value: unknown, what: string, fail: ValidationFailure) => string | null;
37
- /**
38
- * A `z.string().trim().min(1).max(max)`.
39
- *
40
- * The `.trim()` is a TRANSFORM, so the schema's parsed output is the trimmed
41
- * string and its length bounds apply AFTER trimming. A mirror that checked the
42
- * raw length would disagree with the schema twice over: it would accept a
43
- * whitespace-only value the schema rejects, and reject a padded value the schema
44
- * accepts. Returns the trimmed string, which is what the schema returns.
45
- */
46
- export declare const requireTrimmedBoundedString: (value: unknown, what: string, max: number, fail: ValidationFailure) => string;
47
- /** A `z.string().trim().min(1).max(max).nullable()`. */
48
- export declare const requireNullableTrimmedBoundedString: (value: unknown, what: string, max: number, fail: ValidationFailure) => string | null;
49
31
  /** A `z.boolean()`. */
50
32
  export declare const requireBoolean: (value: unknown, what: string, fail: ValidationFailure) => boolean;
51
33
  /** A `z.boolean().optional()`. */
@@ -55,8 +37,6 @@ export declare const requireOptionalBoolean: (value: unknown, what: string, fail
55
37
  * out of JSON as `Infinity`, so finiteness is a reachable check.
56
38
  */
57
39
  export declare const requireNumber: (value: unknown, what: string, fail: ValidationFailure) => number;
58
- /** A `z.number().optional()`. */
59
- export declare const requireOptionalNumber: (value: unknown, what: string, fail: ValidationFailure) => void;
60
40
  /** A `z.number().nullable()`. */
61
41
  export declare const requireNullableNumber: (value: unknown, what: string, fail: ValidationFailure) => number | null;
62
42
  /**
@@ -64,29 +44,10 @@ export declare const requireNullableNumber: (value: unknown, what: string, fail:
64
44
  * comparisons, exactly as the bounded Zod schema rejects them.
65
45
  */
66
46
  export declare const requireBoundedNumber: (value: unknown, what: string, fail: ValidationFailure, min: number, max: number) => number;
67
- /** A `z.number().min(min).max(max).nullable()`. */
68
- export declare const requireNullableBoundedNumber: (value: unknown, what: string, fail: ValidationFailure, min: number, max: number) => number | null;
69
- /**
70
- * A bare `z.number().int()` — integer, finite, and within the SAFE range, with
71
- * NO lower bound.
72
- *
73
- * Measured against the pinned Zod (4.4.3), `.int()` is exactly
74
- * `Number.isSafeInteger`: it accepts `0`, `-1`, and `±MAX_SAFE_INTEGER`, and
75
- * rejects `1.5`, `±2**53`, `NaN`, and `±Infinity`.
76
- *
77
- * Two ways to get this wrong, both of which break parity in a different
78
- * direction. Adding a `min: 0` REJECTS a negative the schema accepts — a client
79
- * refusing a legitimate response. Using `Number.isInteger` ACCEPTS `2**53`,
80
- * which the schema rejects — so `requireIntegerAtLeast` is not this helper with
81
- * the bound dropped, and the safe-range test is why.
82
- */
83
- export declare const requireSafeInteger: (value: unknown, what: string, fail: ValidationFailure) => number;
84
47
  /** A `z.number().int().min(min)` — the integer constraint AND the lower bound. */
85
48
  export declare const requireIntegerAtLeast: (value: unknown, what: string, fail: ValidationFailure, min: number) => number;
86
49
  /** A `z.enum([…])` — CLOSED, exactly like the canonical member list. */
87
50
  export declare const requireEnum: (value: unknown, allowed: readonly string[], what: string, fail: ValidationFailure) => string;
88
- /** A `z.enum([…]).nullable()`. */
89
- export declare const requireNullableEnum: (value: unknown, allowed: readonly string[], what: string, fail: ValidationFailure) => string | null;
90
51
  /** A `z.array(…)`. */
91
52
  export declare const requireArray: (value: unknown, what: string, fail: ValidationFailure) => unknown[];
92
53
  /**
@@ -94,38 +55,3 @@ export declare const requireArray: (value: unknown, what: string, fail: Validati
94
55
  * `[]`; a present non-array is not.
95
56
  */
96
57
  export declare const requireDefaultedArray: (value: unknown, what: string, fail: ValidationFailure) => unknown[];
97
- /** A `z.array(z.string()).min(1)` — non-empty, and every element a string. */
98
- export declare const requireNonEmptyStringArray: (value: unknown, what: string, fail: ValidationFailure) => string[];
99
- /**
100
- * A `z.json()` — a JSON value, recursively: `string | number | boolean | null`,
101
- * an array of them, or an object of them, at ANY depth.
102
- *
103
- * WHY THIS EXISTS, given it can never fire over the wire. Every SDK response
104
- * has already been through `JSON.parse`, so a `Date`, `bigint`, `undefined`, or
105
- * function CANNOT be present by construction — this check is unreachable in
106
- * practice. It is here for PARITY: the canonical `sourceImageAnalysisResultSchema`
107
- * uses `z.json()` precisely because those four break differently on the way to
108
- * `jsonb` (a `bigint` throws in `JSON.stringify`, an `undefined` is silently
109
- * dropped, and a `Date` round-trips as an ISO *string* — a different type read
110
- * back than written). The mirror has to reject what the schema rejects or the
111
- * parity test is lying. Do not delete this as dead code.
112
- */
113
- export declare const requireJsonValue: (value: unknown, what: string, fail: ValidationFailure) => JsonValue;
114
- /**
115
- * A `z.record(z.string(), z.json())` — a PLAIN JSON object of JSON values.
116
- *
117
- * Deliberately NOT `requireRecord` + walk the entries. That combination has a
118
- * top-level hole: `Object.entries(new Date())` and `Object.entries(new Map())`
119
- * are both `[]`, so there is nothing to recurse over and the value is accepted
120
- * as `{}` — while `z.record(z.string(), z.json())` rejects both outright. A
121
- * "non-array object" guard would close those two and still miss a class instance
122
- * with real own properties, which canonical also rejects. Only a prototype test
123
- * matches, and {@link requireJsonValue} already applies it at every depth — so
124
- * this delegates there and then narrows to an object, rather than reimplementing
125
- * the test and acquiring the same hole one level up.
126
- *
127
- * `requireRecord` is left alone: its other callers mirror `z.object({…})`, which
128
- * genuinely does accept any record, and tightening a shared helper under them
129
- * would be a change none of them asked for.
130
- */
131
- export declare const requireJsonRecord: (value: unknown, what: string, fail: ValidationFailure) => Record<string, JsonValue>;