@instruments/materialgraph 3.1.0 → 3.2.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 (55) hide show
  1. package/association-types.d.ts +20 -20
  2. package/brand-types.d.ts +6 -6
  3. package/by-spec-types.d.ts +6 -6
  4. package/catalog-discovery-types.d.ts +4 -4
  5. package/categories-client.d.ts +3 -3
  6. package/category-types.d.ts +18 -18
  7. package/client-config.d.ts +2 -2
  8. package/client-response-schema.d.ts +2 -2
  9. package/client-response-schema.js +4 -4
  10. package/client-vocabulary.js +1 -1
  11. package/client.js +8 -10
  12. package/color-profiles-types.d.ts +8 -8
  13. package/color-wire-types.d.ts +6 -6
  14. package/colors-client.d.ts +3 -3
  15. package/discovery-context-types.d.ts +8 -8
  16. package/errors.d.ts +12 -13
  17. package/errors.js +84 -74
  18. package/find-sampled-together-types.d.ts +6 -6
  19. package/find-variants-by-color-types.d.ts +30 -30
  20. package/find-variants-by-vector-types.d.ts +13 -13
  21. package/get-variant-types.d.ts +6 -6
  22. package/http-transport.d.ts +14 -10
  23. package/http-transport.js +14 -12
  24. package/image-reference-types.d.ts +2 -2
  25. package/json.d.ts +18 -0
  26. package/json.js +36 -0
  27. package/list-enum-values-types.d.ts +8 -8
  28. package/list-sampled-together-pairs-types.d.ts +6 -6
  29. package/list-variant-facets-types.d.ts +8 -8
  30. package/list-variants-types.d.ts +40 -31
  31. package/material-asset-types.d.ts +26 -26
  32. package/material-block-types.d.ts +6 -6
  33. package/material-types.d.ts +6 -6
  34. package/nearest-paints-types.d.ts +8 -8
  35. package/operation-responses.d.ts +2 -2
  36. package/operations.d.ts +1 -1
  37. package/operations.js +1 -1
  38. package/package.json +1 -1
  39. package/parse-operation-response.d.ts +4 -3
  40. package/parse-operation-response.js +112 -135
  41. package/resolve-color-types.d.ts +6 -6
  42. package/resolve-variant-types.d.ts +10 -10
  43. package/response-schema-catalog.d.ts +8 -0
  44. package/response-schema-catalog.js +82 -0
  45. package/response-schemas.d.ts +32 -3
  46. package/response-schemas.generated.js +26 -26
  47. package/response-schemas.js +5 -77
  48. package/schema-resource-types.d.ts +12 -12
  49. package/search-catalog-subset-types.d.ts +2 -2
  50. package/search-variants-types.d.ts +12 -12
  51. package/source-material-types.d.ts +6 -6
  52. package/source-material.js +2 -32
  53. package/types.d.ts +38 -38
  54. package/webmcp.d.ts +10 -4
  55. package/webmcp.generated.js +5 -4
@@ -27,86 +27,14 @@
27
27
  * client does not load it, and it is parsed on the first `responseSchema()`
28
28
  * call rather than on import.
29
29
  */
30
- import { MaterialGraphError } from "./errors.js";
31
- import { RESPONSE_SCHEMA_CATALOG_JSON } from "./response-schemas.generated.js";
30
+ import { JSON_SCHEMA_DIALECT, buildResponseSchema, } from "./response-schema-catalog.js";
32
31
  export { RESPONSE_SCHEMA_API_VERSION, RESPONSE_SCHEMA_OPERATION_IDS, } from "./response-schemas.generated.js";
33
- const JSON_SCHEMA_DIALECT = "https://json-schema.org/draft/2020-12/schema";
34
- const DEFINITION_PREFIX = "#/$defs/";
35
- const isJsonSchemaMap = (value) => typeof value === "object" &&
36
- value !== null &&
37
- Object.values(value).every((schema) => typeof schema === "object" && schema !== null && !Array.isArray(schema));
38
- const isCatalog = (value) => typeof value === "object" &&
39
- value !== null &&
40
- "definitions" in value &&
41
- isJsonSchemaMap(value.definitions) &&
42
- "operations" in value &&
43
- isJsonSchemaMap(value.operations);
44
- let parsedCatalog;
45
- const loadCatalog = () => {
46
- if (parsedCatalog === undefined) {
47
- const parsed = JSON.parse(RESPONSE_SCHEMA_CATALOG_JSON);
48
- if (!isCatalog(parsed)) {
49
- throw MaterialGraphError.unexpected("The response schema catalog is malformed");
50
- }
51
- parsedCatalog = parsed;
52
- }
53
- return parsedCatalog;
54
- };
55
- /** Add every definition `value` reaches, transitively, to `into`. */
56
- const collectReferences = (catalog, value, into) => {
57
- if (Array.isArray(value)) {
58
- for (const item of value) {
59
- collectReferences(catalog, item, into);
60
- }
61
- return;
62
- }
63
- if (typeof value !== "object" || value === null) {
64
- return;
65
- }
66
- for (const [key, child] of Object.entries(value)) {
67
- if (key === "$ref" &&
68
- typeof child === "string" &&
69
- child.startsWith(DEFINITION_PREFIX)) {
70
- const name = child
71
- .slice(DEFINITION_PREFIX.length)
72
- .replaceAll("~1", "/")
73
- .replaceAll("~0", "~");
74
- if (!into.has(name)) {
75
- into.add(name);
76
- collectReferences(catalog, catalog.definitions[name], into);
77
- }
78
- }
79
- else {
80
- collectReferences(catalog, child, into);
81
- }
82
- }
83
- };
84
32
  /**
85
33
  * The success-response schema for one operation, self-contained and carrying
86
34
  * only the definitions it reaches. Each call returns a fresh copy, so a caller
87
35
  * that annotates or mutates it cannot change what the next caller gets.
88
36
  */
89
- export const responseSchema = (operationId) => {
90
- const catalog = loadCatalog();
91
- const root = Object.hasOwn(catalog.operations, operationId)
92
- ? catalog.operations[operationId]
93
- : undefined;
94
- if (root === undefined) {
95
- throw MaterialGraphError.unexpected(`No response schema for operation: ${operationId}`);
96
- }
97
- const names = new Set();
98
- collectReferences(catalog, root, names);
99
- const definitions = {};
100
- for (const name of [...names].toSorted()) {
101
- const definition = catalog.definitions[name];
102
- if (definition !== undefined) {
103
- definitions[name] = definition;
104
- }
105
- }
106
- const schema = {
107
- $schema: JSON_SCHEMA_DIALECT,
108
- ...root,
109
- ...(names.size > 0 ? { $defs: definitions } : {}),
110
- };
111
- return structuredClone(schema);
112
- };
37
+ export const responseSchema = (operationId) => ({
38
+ ...buildResponseSchema(operationId),
39
+ $schema: JSON_SCHEMA_DIALECT,
40
+ });
@@ -11,13 +11,13 @@ export declare const SCHEMA_RESOURCE_OPERATION_IDS: {
11
11
  readonly valueDictionaries: "list_schema_value_dictionaries";
12
12
  };
13
13
  export type SchemaResourceRequest = SchemaResource;
14
- export type SchemaLifecycle = {
14
+ export interface SchemaLifecycle {
15
15
  status: OpenEnum<"draft" | "active" | "deprecated">;
16
16
  introducedIn: string;
17
17
  deprecatedIn?: string;
18
18
  supersededBy?: string;
19
- };
20
- export type SchemaExternalMapping = {
19
+ }
20
+ export interface SchemaExternalMapping {
21
21
  target: OpenEnum<"schema_org" | "ifc_pset" | "bsdd" | "iso_23387" | "eclass" | "gs1_gdm" | "gdsn" | "etim" | "uniclass">;
22
22
  targetPath: string;
23
23
  mappingType: OpenEnum<"direct" | "transform" | "derived" | "classification" | "semantic">;
@@ -27,9 +27,9 @@ export type SchemaExternalMapping = {
27
27
  */
28
28
  matchStrength?: SchemaMatchStrength;
29
29
  notes?: string;
30
- };
30
+ }
31
31
  export type SchemaMatchStrength = OpenEnum<"exact" | "close" | "broad" | "narrow" | "related">;
32
- export type SchemaValueDictionaryTerm = {
32
+ export interface SchemaValueDictionaryTerm {
33
33
  id: string;
34
34
  label: string;
35
35
  aliases?: string[];
@@ -37,21 +37,21 @@ export type SchemaValueDictionaryTerm = {
37
37
  externalMappings?: SchemaExternalMapping[];
38
38
  semanticId: string;
39
39
  lifecycle: SchemaLifecycle;
40
- };
41
- export type SchemaValueDictionaryItem = {
40
+ }
41
+ export interface SchemaValueDictionaryItem {
42
42
  id: string;
43
43
  name: string;
44
44
  description: string;
45
45
  terms: SchemaValueDictionaryTerm[];
46
46
  semanticId: string;
47
47
  lifecycle: SchemaLifecycle;
48
- };
49
- export type SchemaResourceItemMap = {
48
+ }
49
+ export interface SchemaResourceItemMap {
50
50
  valueDictionaries: SchemaValueDictionaryItem;
51
- };
52
- export type SchemaResourceResponse<K extends SchemaResource = SchemaResource> = {
51
+ }
52
+ export interface SchemaResourceResponse<K extends SchemaResource = SchemaResource> {
53
53
  kind: K;
54
54
  schemaVersion: string;
55
55
  items: SchemaResourceItemMap[K][];
56
56
  totalCount: number;
57
- };
57
+ }
@@ -50,8 +50,8 @@ export type SearchCatalogSubset = OpenEnum<"samplizeOrderable" | "all" | "design
50
50
  * the counts: a short page under a scope is a small SCOPED corpus, never a
51
51
  * truncated one.
52
52
  */
53
- export type SearchCatalogSubsetReceipt = {
53
+ export interface SearchCatalogSubsetReceipt {
54
54
  scope: SearchCatalogSubset;
55
55
  /** What the scope admits, in one sentence, for a human reader. */
56
56
  description: string;
57
- };
57
+ }
@@ -10,12 +10,12 @@
10
10
  import type { ColorRangeCondition, FilterGroups, ListVariantsInclude, ListVariantsOutput, OptionalFilterGroups } from "./list-variants-types.js";
11
11
  import type { SearchCatalogSubset } from "./search-catalog-subset-types.js";
12
12
  /** Switches one of a previous answer's `choices`: its `handle`, and the `group` and `id` of the alternative to read it as. */
13
- export type SearchVariantsSelection = {
13
+ export interface SearchVariantsSelection {
14
14
  group: string;
15
15
  handle: string;
16
16
  id: string;
17
- };
18
- export type SearchVariantsInput = {
17
+ }
18
+ export interface SearchVariantsInput {
19
19
  /** Attribute ids to project under each item's `specifications`, as `listVariants()` takes. */
20
20
  attributes?: string[];
21
21
  /** The previous page's `pageInfo.endCursor`. Tied to the vocabulary version the query was read against, and not a `listVariants()` cursor. */
@@ -32,12 +32,12 @@ export type SearchVariantsInput = {
32
32
  searchCatalogSubset?: SearchCatalogSubset;
33
33
  /** Up to eight choices to switch, from the previous answer's `choices`. */
34
34
  selections?: SearchVariantsSelection[];
35
- };
35
+ }
36
36
  /**
37
37
  * What became of one phrase of the query. `filter` narrowed the page,
38
38
  * `preference` only ranked it, `not_applied` did neither and `note` says why.
39
39
  */
40
- export type SearchVariantsUnderstood = {
40
+ export interface SearchVariantsUnderstood {
41
41
  applied: "filter" | "preference" | "not_applied";
42
42
  /** The parser's condition id. */
43
43
  id: string;
@@ -47,33 +47,33 @@ export type SearchVariantsUnderstood = {
47
47
  note?: string;
48
48
  /** The query words it came from. */
49
49
  text: string;
50
- };
50
+ }
51
51
  /** One reading of an ambiguous phrase. */
52
- export type SearchVariantsReading = {
52
+ export interface SearchVariantsReading {
53
53
  group: string;
54
54
  id: string;
55
55
  kind: string;
56
56
  label: string;
57
57
  /** Variants in search scope that hold this reading. */
58
58
  variants?: number;
59
- };
59
+ }
60
60
  /** On an empty page: a change to the next call that returns variants. */
61
- export type SearchVariantsSuggestion = {
61
+ export interface SearchVariantsSuggestion {
62
62
  /** The `leaveOut` entries to send. */
63
63
  leaveOut?: string[];
64
64
  note: string;
65
65
  /** Variants the search returns with this change. */
66
66
  variants: number;
67
- };
67
+ }
68
68
  /** A phrase with more than one meaning: the reading used, and the others a caller may switch to by `handle`. */
69
- export type SearchVariantsChoice = {
69
+ export interface SearchVariantsChoice {
70
70
  alternatives: SearchVariantsReading[];
71
71
  basis: string;
72
72
  handle: string;
73
73
  reason: string;
74
74
  selected: SearchVariantsReading;
75
75
  text: string;
76
- };
76
+ }
77
77
  /** The `listVariants()` page, with how the words were read beside it. */
78
78
  export type SearchVariantsOutput = ListVariantsOutput & {
79
79
  choices?: SearchVariantsChoice[];
@@ -30,11 +30,11 @@ export type FileInput = Blob | {
30
30
  * plain-text/markdown, and images (≥1, ≤16). The server classifies each file
31
31
  * and assigns its receipt {@link SourceMaterialReceiptFile.role}.
32
32
  */
33
- export type UploadSourceMaterialInput = {
33
+ export interface UploadSourceMaterialInput {
34
34
  files: FileInput[];
35
- };
35
+ }
36
36
  /** One stored file in an upload receipt. */
37
- export type SourceMaterialReceiptFile = {
37
+ export interface SourceMaterialReceiptFile {
38
38
  /** The stored file id (`smf_…`). Opaque — the prefix is a reading aid, not a contract. */
39
39
  sourceId: SourceFileId;
40
40
  /**
@@ -50,10 +50,10 @@ export type SourceMaterialReceiptFile = {
50
50
  bytes: number;
51
51
  /** PDF page count; null for images. */
52
52
  pages: number | null;
53
- };
53
+ }
54
54
  /** The `201` receipt from `POST /api/v1/source-material`. */
55
- export type SourceMaterialBatchReceipt = {
55
+ export interface SourceMaterialBatchReceipt {
56
56
  /** The stored batch id (`smb_…`). Opaque. */
57
57
  batchId: BatchId;
58
58
  sources: SourceMaterialReceiptFile[];
59
- };
59
+ }
@@ -4,34 +4,7 @@
4
4
  */
5
5
  import { MaterialGraphError } from "./errors.js";
6
6
  import { findSdkOperation, operationPath } from "./operations.js";
7
- const hasSourceIdentity = (source) => typeof source === "object" &&
8
- source !== null &&
9
- "sourceId" in source &&
10
- typeof source.sourceId === "string" &&
11
- "role" in source &&
12
- typeof source.role === "string" &&
13
- "filename" in source &&
14
- typeof source.filename === "string" &&
15
- "mediaType" in source &&
16
- typeof source.mediaType === "string";
17
- const hasSourceMeasurements = (source) => typeof source === "object" &&
18
- source !== null &&
19
- "sha256" in source &&
20
- typeof source.sha256 === "string" &&
21
- "bytes" in source &&
22
- typeof source.bytes === "number" &&
23
- "pages" in source &&
24
- (source.pages === null || typeof source.pages === "number");
25
- const isSourceReceipt = (value) => typeof value === "object" &&
26
- value !== null &&
27
- "batchId" in value &&
28
- typeof value.batchId === "string" &&
29
- "sources" in value &&
30
- Array.isArray(value.sources) &&
31
- value.sources.every((source) => typeof source === "object" &&
32
- source !== null &&
33
- hasSourceIdentity(source) &&
34
- hasSourceMeasurements(source));
7
+ import { parseOperationResponse } from "./parse-operation-response.js";
35
8
  const sdkOperation = (operationId) => {
36
9
  const match = findSdkOperation(operationId);
37
10
  if (!match) {
@@ -85,8 +58,5 @@ export const uploadSourceMaterial = async (transport, input, signal) => {
85
58
  signal,
86
59
  url,
87
60
  });
88
- if (!isSourceReceipt(parsed)) {
89
- throw MaterialGraphError.unexpected("MaterialGraph source-material upload returned an invalid receipt");
90
- }
91
- return parsed;
61
+ return await parseOperationResponse("upload_source_material", parsed);
92
62
  };
package/types.d.ts CHANGED
@@ -29,13 +29,13 @@ import type { SearchCatalogSubset } from "./search-catalog-subset-types.js";
29
29
  export type OpenEnum<T extends string> = T | (string & Record<never, never>);
30
30
  export type { JsonValue } from "./json-value-types.js";
31
31
  /** OKLab triple. */
32
- export type OklabTriple = {
32
+ export interface OklabTriple {
33
33
  l: number;
34
34
  a: number;
35
35
  b: number;
36
- };
36
+ }
37
37
  /** The material's dominant-color block (tile/detail projections). */
38
- export type MaterialColor = {
38
+ export interface MaterialColor {
39
39
  dominantHex: string | null;
40
40
  hsl: {
41
41
  h: number;
@@ -45,25 +45,25 @@ export type MaterialColor = {
45
45
  oklab: OklabTriple | null;
46
46
  chroma: number | null;
47
47
  vibrancy: number | null;
48
- };
48
+ }
49
49
  /** Where the served image came from. */
50
50
  export type ImageSource = OpenEnum<"r2" | "origin">;
51
51
  export type { MaterialAvailability, MaterialTile } from "./material-types.js";
52
- export type DemandMomentum = {
52
+ export interface DemandMomentum {
53
53
  state: OpenEnum<"rising" | "fading" | "stable" | "emerging" | "insufficient_volume">;
54
54
  percentChange: number | null;
55
55
  trailingSpecCount: number;
56
56
  priorSpecCount: number;
57
- };
58
- export type CompanionDemand = {
57
+ }
58
+ export interface CompanionDemand {
59
59
  specCount: number;
60
60
  projectCount: number;
61
61
  momentum: DemandMomentum | null;
62
- };
63
- export type ProjectTypeShare = {
62
+ }
63
+ export interface ProjectTypeShare {
64
64
  projectType: string;
65
65
  projectCount: number;
66
- };
66
+ }
67
67
  /**
68
68
  * A pairing item from the behavioral arm — real order evidence, or board
69
69
  * curation when this seed has no order edges.
@@ -80,7 +80,7 @@ export type ProjectTypeShare = {
80
80
  *
81
81
  * See {@link ColorPairing} for the third, non-evidential arm.
82
82
  */
83
- export type CospecPairing = {
83
+ export interface CospecPairing {
84
84
  /** The evidence tier. `cospec` = orders; `considered` = boards. Read it before phrasing. */
85
85
  source: "cospec" | "considered";
86
86
  /**
@@ -124,7 +124,7 @@ export type CospecPairing = {
124
124
  topProjectTypes: ProjectTypeShare[];
125
125
  /** Graph-owned color ranking facts, present only for an explicitly ordered rail. */
126
126
  ranking?: PairingRanking;
127
- };
127
+ }
128
128
  /**
129
129
  * A pairing item topped up from color palette-similarity — a LOOK-ALIKE, not
130
130
  * evidence. Nobody ordered these together and nobody boarded them together; the
@@ -144,14 +144,14 @@ export type ColorPairing = {
144
144
  ranking?: PairingRanking;
145
145
  } & MaterialTile;
146
146
  export type PairingOrderMode = "relevance" | "lightness_asc" | "lightness_desc";
147
- export type PairingRanking = {
147
+ export interface PairingRanking {
148
148
  anchorColorSimilarity: number | null;
149
149
  lightness: number | null;
150
150
  anchorColorSimilarityMeasurable: boolean;
151
151
  lightnessMeasurable: boolean;
152
152
  basis: OpenEnum<"dominant_color_oklab">;
153
- };
154
- export type PairingOrdering = {
153
+ }
154
+ export interface PairingOrdering {
155
155
  requested: OpenEnum<PairingOrderMode>;
156
156
  applied: OpenEnum<PairingOrderMode>;
157
157
  direction: OpenEnum<"ascending" | "descending">;
@@ -163,14 +163,14 @@ export type PairingOrdering = {
163
163
  };
164
164
  missingValues: OpenEnum<"last">;
165
165
  tieBreak: OpenEnum<"variantId_asc">;
166
- };
166
+ }
167
167
  /**
168
168
  * One pairing, discriminated by `source` into three tiers of very different
169
169
  * strength: `cospec` (real orders) > `considered` (board activity) > `color`
170
170
  * (palette look-alike). Branch on `source` before you write a sentence about it.
171
171
  */
172
172
  export type PairingItem = CospecPairing | ColorPairing;
173
- export type PairingsResponse = {
173
+ export interface PairingsResponse {
174
174
  seed: MaterialTile;
175
175
  /** A rail, not a ranked corpus — mixed evidence tiers, capped by `limit`. */
176
176
  items: PairingItem[];
@@ -191,7 +191,7 @@ export type PairingsResponse = {
191
191
  ordering?: PairingOrdering;
192
192
  /** Opaque continuation bound to the seed, filters, corpus, and order. */
193
193
  nextCursor?: Cursor;
194
- };
194
+ }
195
195
  /**
196
196
  * How a {@link AttributeListItem} matched the query. Declared here rather than
197
197
  * imported: this package is published, so it may not reach across into
@@ -199,7 +199,7 @@ export type PairingsResponse = {
199
199
  * of truth this wire type tracks. `method` is deliberately open - a server
200
200
  * that grows a method must not break an older client.
201
201
  */
202
- export type AttributeMatch = {
202
+ export interface AttributeMatch {
203
203
  method: OpenEnum<"exact" | "alias" | "fuzzy" | "vector">;
204
204
  /** The id, name or alias that matched, or null for a match by meaning. */
205
205
  matchedText: string | null;
@@ -212,9 +212,9 @@ export type AttributeMatch = {
212
212
  * when the attribute was found through one of its values.
213
213
  */
214
214
  valueId?: string;
215
- };
215
+ }
216
216
  /** One attribute definition on a `listAttributes()` page. */
217
- export type AttributeListItem = {
217
+ export interface AttributeListItem {
218
218
  id: string;
219
219
  name: string;
220
220
  description: string;
@@ -230,14 +230,14 @@ export type AttributeListItem = {
230
230
  match?: AttributeMatch;
231
231
  /** Live variants in the requested categories stating it; absent without `categoryIds`. */
232
232
  statedBy?: number;
233
- };
233
+ }
234
234
  /** An attribute a block-scoped `listAttributes()` query missed, named with its real blocks. */
235
- export type OutsideScopeAttribute = {
235
+ export interface OutsideScopeAttribute {
236
236
  id: string;
237
237
  name: string;
238
238
  blockIds: string[];
239
- };
240
- export type ListAttributesResult = {
239
+ }
240
+ export interface ListAttributesResult {
241
241
  items: AttributeListItem[];
242
242
  /** Page one only: matches outside `blockIds` ranking above the best item. Absent when the check did not apply. */
243
243
  outsideScope?: OutsideScopeAttribute[];
@@ -247,16 +247,16 @@ export type ListAttributesResult = {
247
247
  endCursor: string | null;
248
248
  hasNextPage: boolean;
249
249
  };
250
- };
250
+ }
251
251
  export type { ResolveValueCandidate, ValueResolution, } from "./catalog-discovery-types.js";
252
252
  export type { ResolveColorOptions, ResolveColorCatalogVariant, ResolveColorVariant, ResolveColorResponse, } from "./resolve-color-types.js";
253
253
  export type { BySpecVerdictState, BySpecVerdictCell, BySpecVerdict, MaterialVerdict, BySpecUnresolvedCriterion, } from "./by-spec-types.js";
254
- export type WhoamiResponse = {
254
+ export interface WhoamiResponse {
255
255
  principal: string;
256
256
  scopes: string[];
257
- };
257
+ }
258
258
  /** Options for a pairings read. */
259
- export type PairingsOptions = {
259
+ export interface PairingsOptions {
260
260
  /** Comma-separated coarse category display names; filters both arms. */
261
261
  categories?: string;
262
262
  /** Page size, 1–24 inclusive (default 12). The server rejects (400), not clamps, values outside this range. */
@@ -269,9 +269,9 @@ export type PairingsOptions = {
269
269
  searchCatalogSubset?: SearchCatalogSubset;
270
270
  /** The previous response's `nextCursor`, passed back verbatim. */
271
271
  cursor?: Cursor;
272
- };
272
+ }
273
273
  /** Options for `listAttributes()` (GET `/api/v1/catalog/attributes`). */
274
- export type ListAttributesOptions = {
274
+ export interface ListAttributesOptions {
275
275
  /** An attribute id, name, misspelling or meaning, e.g. "reduces echo". */
276
276
  query?: string;
277
277
  /** Keep attributes in any of these blocks. */
@@ -284,8 +284,8 @@ export type ListAttributesOptions = {
284
284
  limit?: number;
285
285
  /** `pageInfo.endCursor` from the previous page, with the same query and scope. */
286
286
  cursor?: string;
287
- };
288
- export type ExtractedPalette = {
287
+ }
288
+ export interface ExtractedPalette {
289
289
  colors: {
290
290
  hex: string;
291
291
  name: string;
@@ -298,14 +298,14 @@ export type ExtractedPalette = {
298
298
  oklch: string;
299
299
  } | null;
300
300
  mood: string;
301
- };
302
- export type ExtractPaletteResponse = {
301
+ }
302
+ export interface ExtractPaletteResponse {
303
303
  palette: ExtractedPalette | null;
304
- };
304
+ }
305
305
  /** Body for `POST /api/v1/search/palettes/extract`. */
306
- export type ExtractPaletteInput = {
306
+ export interface ExtractPaletteInput {
307
307
  /** The query image as a data URI or bare base64 string. */
308
308
  image: string;
309
309
  /** Max palette swatches to return (default 6). */
310
310
  max?: number;
311
- };
311
+ }
package/webmcp.d.ts CHANGED
@@ -1,17 +1,23 @@
1
+ /** A JSON value, as a tool's input and output schemas are written. */
2
+ export type WebMcpJson = string | number | boolean | null | readonly WebMcpJson[] | WebMcpJsonObject;
3
+ /** A JSON object whose every member is a JSON value. */
4
+ export interface WebMcpJsonObject {
5
+ readonly [key: string]: WebMcpJson;
6
+ }
1
7
  /** Canonical operation contracts. Consumers validate both boundaries and supply their own transport. */
2
- export type WebMcpToolContract = {
8
+ export interface WebMcpToolContract {
3
9
  readonly name: "search";
4
10
  readonly operationId: string;
5
11
  readonly path: string;
6
12
  readonly method: "POST";
7
13
  readonly description: string;
8
- readonly inputSchema: Readonly<Record<string, unknown>>;
9
- readonly outputSchema: Readonly<Record<string, unknown>>;
14
+ readonly inputSchema: WebMcpJsonObject;
15
+ readonly outputSchema: WebMcpJsonObject;
10
16
  readonly annotations: {
11
17
  readonly readOnlyHint: boolean;
12
18
  readonly untrustedContentHint: boolean;
13
19
  };
14
20
  readonly requiresVisibleConfirmation: boolean;
15
21
  readonly requiredHeaders: readonly string[];
16
- };
22
+ }
17
23
  export { WEBMCP_TOOLS } from "./webmcp.generated.js";