@instruments/materialgraph 0.6.1 → 0.7.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 (3) hide show
  1. package/client.js +3 -1
  2. package/package.json +1 -1
  3. package/types.d.ts +36 -0
package/client.js CHANGED
@@ -294,7 +294,9 @@ export class MaterialGraphClient {
294
294
  * you how much of the rail is real order evidence.
295
295
  */
296
296
  pairings(variantId, options, signal) {
297
- return this.#get("get_material_pairings", { categories: options?.categories, limit: options?.limit }, signal, { variantId });
297
+ return this.#get("get_material_pairings", { ...options }, signal, {
298
+ variantId,
299
+ });
298
300
  }
299
301
  materials(ids, options, signal) {
300
302
  if (ids.length > MAX_BATCH_IDS) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instruments/materialgraph",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
package/types.d.ts CHANGED
@@ -395,6 +395,8 @@ export interface CospecPairing {
395
395
  liftLabel: string;
396
396
  demand: CompanionDemand | null;
397
397
  topProjectTypes: ProjectTypeShare[];
398
+ /** Graph-owned colour ranking facts, present only for an explicitly ordered rail. */
399
+ ranking?: PairingRanking;
398
400
  }
399
401
  /**
400
402
  * A pairing item topped up from colour palette-similarity — a LOOK-ALIKE, not
@@ -405,6 +407,30 @@ export interface CospecPairing {
405
407
  export interface ColourPairing extends MaterialTile {
406
408
  source: "colour";
407
409
  score: number;
410
+ /** Graph-owned colour ranking facts, present only for an explicitly ordered rail. */
411
+ ranking?: PairingRanking;
412
+ }
413
+ export type PairingOrderMode = "relevance" | "lightness_asc" | "lightness_desc";
414
+ export type PairingCorpus = "all" | "material_bank";
415
+ export interface PairingRanking {
416
+ anchorColourSimilarity: number | null;
417
+ lightness: number | null;
418
+ anchorColourSimilarityMeasurable: boolean;
419
+ lightnessMeasurable: boolean;
420
+ basis: OpenEnum<"dominant_colour_oklab">;
421
+ }
422
+ export interface PairingOrdering {
423
+ requested: OpenEnum<PairingOrderMode>;
424
+ applied: OpenEnum<PairingOrderMode>;
425
+ direction: OpenEnum<"ascending" | "descending">;
426
+ anchorColourBasis: OpenEnum<"one_minus_oklab_euclidean_distance">;
427
+ colourSpace: OpenEnum<"oklab">;
428
+ lightnessRange: {
429
+ min: 0;
430
+ max: 1;
431
+ };
432
+ missingValues: OpenEnum<"last">;
433
+ tieBreak: OpenEnum<"variantId_asc">;
408
434
  }
409
435
  /**
410
436
  * One pairing, discriminated by `source` into three tiers of very different
@@ -422,6 +448,10 @@ export interface PairingsResponse {
422
448
  * check it before presenting the rail as demand evidence.
423
449
  */
424
450
  cospecCount: number;
451
+ /** Present only when `order` was requested. Evidence tiers remain independent. */
452
+ ordering?: PairingOrdering;
453
+ /** Opaque continuation bound to the seed, filters, corpus, and order. */
454
+ nextCursor?: Cursor;
425
455
  }
426
456
  export interface MaterialResponse {
427
457
  material: MaterialDetail;
@@ -666,6 +696,12 @@ export interface PairingsOptions {
666
696
  /** Comma-separated coarse category display names; filters both arms. */
667
697
  categories?: string;
668
698
  limit?: number;
699
+ /** Graph-owned order applied within fixed cospec → considered → colour tiers. */
700
+ order?: PairingOrderMode;
701
+ /** Optional Material Bank/orderable gate; requires an explicit `order`. */
702
+ corpus?: PairingCorpus;
703
+ /** The previous response's `nextCursor`, passed back verbatim. */
704
+ cursor?: Cursor;
669
705
  }
670
706
  /** Options for `catalog/attributes/resolve`. */
671
707
  export interface ResolveAttributeOptions {