@instruments/materialgraph 0.25.0 → 0.27.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 (158) hide show
  1. package/association-types.d.ts +38 -27
  2. package/associations-client.d.ts +4 -4
  3. package/associations-client.js +3 -10
  4. package/attribution-types.d.ts +4 -4
  5. package/brand-types.d.ts +14 -6
  6. package/brands-client.d.ts +7 -38
  7. package/brands-client.js +10 -40
  8. package/by-colour-types.d.ts +58 -31
  9. package/by-spec-types.d.ts +6 -73
  10. package/by-spec-types.js +7 -5
  11. package/catalog-discovery-types.d.ts +11 -26
  12. package/catalogue-client.d.ts +16 -35
  13. package/catalogue-client.js +32 -67
  14. package/catalogue-types.d.ts +44 -4
  15. package/categories-client.d.ts +63 -0
  16. package/categories-client.js +48 -0
  17. package/category-types.d.ts +114 -0
  18. package/citation-types.d.ts +4 -4
  19. package/client-config.d.ts +4 -6
  20. package/client-config.js +2 -4
  21. package/client-source-material-comments.d.ts +4 -4
  22. package/client-source-material-comments.js +4 -38
  23. package/client-vocabulary.d.ts +7 -9
  24. package/client-vocabulary.js +22 -30
  25. package/client.d.ts +110 -244
  26. package/client.js +217 -387
  27. package/codes-client.d.ts +2 -2
  28. package/codes-client.js +8 -8
  29. package/codes-types.d.ts +55 -34
  30. package/colour-aggregate-types.d.ts +24 -24
  31. package/colours-client.d.ts +6 -11
  32. package/colours-client.js +11 -19
  33. package/coordinate-client.d.ts +2 -2
  34. package/coordinate-client.js +1 -13
  35. package/corpus-scope-types.d.ts +3 -3
  36. package/corpus-scope-types.js +1 -25
  37. package/demand-batch-types.d.ts +18 -18
  38. package/demand-types.d.ts +24 -24
  39. package/errors.d.ts +13 -13
  40. package/errors.js +54 -52
  41. package/http-transport.d.ts +13 -21
  42. package/http-transport.js +31 -28
  43. package/identify-types.d.ts +54 -44
  44. package/identify-types.js +5 -3
  45. package/index.d.ts +11 -27
  46. package/index.js +4 -6
  47. package/list-variant-facets-types.d.ts +60 -0
  48. package/list-variants-types.d.ts +142 -0
  49. package/list-variants-types.js +12 -0
  50. package/match-stream-types.d.ts +45 -32
  51. package/match-stream-types.js +2 -0
  52. package/match-stream.d.ts +2 -2
  53. package/match-stream.js +67 -49
  54. package/match-types.d.ts +32 -8
  55. package/material-asset-types.d.ts +89 -69
  56. package/material-block-types.d.ts +8 -6
  57. package/material-composition-client.d.ts +21 -0
  58. package/material-composition-client.js +13 -0
  59. package/material-composition-types.d.ts +403 -0
  60. package/material-query-plan-types.d.ts +61 -145
  61. package/material-resources-client.d.ts +12 -10
  62. package/material-resources-client.js +27 -22
  63. package/material-types.d.ts +16 -24
  64. package/ndjson.js +16 -8
  65. package/operations.d.ts +6 -6
  66. package/operations.js +29 -156
  67. package/package.json +5 -1
  68. package/palette-search-types.d.ts +87 -52
  69. package/query-understanding-types.d.ts +65 -40
  70. package/resolve-client.d.ts +8 -12
  71. package/resolve-client.js +9 -13
  72. package/resolve-colour-types.d.ts +8 -8
  73. package/resolve-types.d.ts +10 -10
  74. package/response-schemas.d.ts +20 -0
  75. package/response-schemas.generated.d.ts +5 -0
  76. package/response-schemas.generated.js +160 -0
  77. package/response-schemas.js +113 -0
  78. package/run-types.d.ts +64 -145
  79. package/runs.d.ts +9 -58
  80. package/runs.js +60 -149
  81. package/samplize-catalogue-types.d.ts +18 -18
  82. package/samplize-colorvec.d.ts +20 -20
  83. package/samplize-colorvec.js +66 -42
  84. package/schema-resource-types.d.ts +52 -39
  85. package/schema-resource-types.js +5 -5
  86. package/search-card-types.d.ts +26 -4
  87. package/search-index-plan-types.d.ts +70 -0
  88. package/search-refinement-types.d.ts +10 -40
  89. package/search-refinement-types.js +1 -0
  90. package/search-request-types.d.ts +121 -204
  91. package/search-response-receipt-types.d.ts +13 -253
  92. package/search-response-types.d.ts +2 -2
  93. package/search-result-validation.d.ts +3 -19
  94. package/search-result-validation.js +42 -183
  95. package/source-material-validation.d.ts +3 -3
  96. package/source-material-validation.js +35 -39
  97. package/spec-facet-types.d.ts +11 -16
  98. package/spec-types.d.ts +23 -16
  99. package/spec-types.js +8 -7
  100. package/specifications.d.ts +14 -72
  101. package/specifications.js +39 -89
  102. package/sse.d.ts +2 -2
  103. package/sse.js +32 -16
  104. package/substitute-types.d.ts +22 -22
  105. package/suggest-types.d.ts +11 -17
  106. package/suggest-types.js +3 -3
  107. package/taxonomy-coverage-types.d.ts +8 -8
  108. package/types.d.ts +202 -405
  109. package/validation.d.ts +26 -26
  110. package/validation.js +97 -92
  111. package/webmcp.d.ts +3 -3
  112. package/webmcp.generated.js +10 -93
  113. package/brand-most-sampled-types.d.ts +0 -33
  114. package/browse-types.d.ts +0 -236
  115. package/client-browse.d.ts +0 -78
  116. package/client-browse.js +0 -72
  117. package/client-exploration.d.ts +0 -9
  118. package/client-exploration.js +0 -7
  119. package/compare-types.d.ts +0 -89
  120. package/composition-client.d.ts +0 -33
  121. package/composition-client.js +0 -27
  122. package/composition-types.d.ts +0 -455
  123. package/composition-types.js +0 -10
  124. package/correction-types.d.ts +0 -88
  125. package/exploration-types.d.ts +0 -118
  126. package/exploration-types.js +0 -1
  127. package/fan-deck-types.d.ts +0 -42
  128. package/fan-deck-types.js +0 -9
  129. package/match-rejection-types.d.ts +0 -43
  130. package/match-rejection-types.js +0 -7
  131. package/palette-completion-types.d.ts +0 -115
  132. package/palette-completion-types.js +0 -1
  133. package/project-types.d.ts +0 -79
  134. package/project-types.js +0 -9
  135. package/projects.d.ts +0 -13
  136. package/projects.js +0 -46
  137. package/render-assets-types.d.ts +0 -65
  138. package/render-assets-types.js +0 -1
  139. package/run-events.d.ts +0 -106
  140. package/run-events.js +0 -32
  141. package/schedule-reference-types.d.ts +0 -46
  142. package/schedule-reference-types.js +0 -1
  143. package/schedule-references-client.d.ts +0 -14
  144. package/schedule-references-client.js +0 -26
  145. package/schedule-types.d.ts +0 -261
  146. package/schedule-types.js +0 -1
  147. package/search-collapse-types.d.ts +0 -69
  148. package/search-collapse-types.js +0 -1
  149. package/search-mood-types.d.ts +0 -6
  150. package/search-mood-types.js +0 -1
  151. package/search-window-types.d.ts +0 -25
  152. package/search-window-types.js +0 -1
  153. package/slot-pool-types.d.ts +0 -372
  154. package/slot-pool-types.js +0 -1
  155. /package/{brand-most-sampled-types.js → category-types.js} +0 -0
  156. /package/{browse-types.js → list-variant-facets-types.js} +0 -0
  157. /package/{compare-types.js → material-composition-types.js} +0 -0
  158. /package/{correction-types.js → search-index-plan-types.js} +0 -0
@@ -1,57 +1,94 @@
1
1
  /**
2
- * Wire types for the material ASSET projection
3
- * (`GET /api/v1/materials/{variantId}/assets`).
2
+ * Wire types for `list_variant_assets`
3
+ * (`GET /api/v1/variants/{variantId}/assets`, MG-2232): one bounded, filtered,
4
+ * cursor-paged page of a variant's images and files.
4
5
  *
5
- * THE LENS: "what may I show for this material?" — the redistribution-safe
6
- * images and downloads, not every file on record. An asset absent here is not
7
- * an asset that does not exist; it is one this surface does not hand out.
6
+ * Classification (`kind`, `imageRole`, `presentation`, `documentTypes`)
7
+ * mirrors the one registry `@materialgraph/schema/asset-classification`
8
+ * carries server-side; every field that names a registry term is an
9
+ * {@link OpenEnum} so a server-added term still type-checks here.
8
10
  */
9
11
  import type { VariantId } from "./identifiers.js";
10
12
  import type { OpenEnum } from "./types.js";
11
- export type MaterialAssetVisualRole = OpenEnum<"grid" | "detail" | "scene" | "swatch" | "technical" | "unknown">;
12
13
  /**
13
- * Whether we hold the bytes.
14
- * - `downloaded` — held and served by us.
15
- * - `linked_not_downloaded` — the source names it; we have not fetched it. Not
16
- * a broken asset.
17
- * - `failed` — we tried and could not. Says nothing about the source.
18
- * - `retired_placeholder` — a stand-in for a withdrawn asset.
14
+ * `available`: MaterialGraph serves the file at `url`. `unknown`: `url` is the
15
+ * maker's own link, unchecked. `unavailable`: no working copy is known and
16
+ * `url` is null.
19
17
  */
20
- export type MaterialAssetStatus = OpenEnum<"downloaded" | "linked_not_downloaded" | "failed" | "retired_placeholder">;
21
- export interface MaterialAssetProjectionImage {
22
- key: string;
23
- ordinal: number;
24
- proxyPath: string;
25
- visualRole: MaterialAssetVisualRole;
26
- status: MaterialAssetStatus;
27
- contentType: string | null;
28
- fileExtension: string | null;
29
- filename: string | null;
30
- byteSize: number | null;
31
- }
32
- export interface MaterialAssetProjectionDownload {
33
- ordinal: number;
34
- url: string;
35
- label: string | null;
36
- assetKind: string;
37
- status: string;
38
- contentType: string | null;
39
- fileExtension: string | null;
40
- filename: string | null;
41
- }
18
+ export type VariantAssetAvailability = OpenEnum<"available" | "unknown" | "unavailable">;
19
+ /** What an image primarily shows. */
20
+ export type VariantImageRole = OpenEnum<"product" | "swatch" | "detail" | "scene" | "technical" | "colour_chart" | "sample_collection" | "other" | "unknown">;
21
+ /** How an image must be framed, a different question from what it shows. */
22
+ export type VariantImagePresentation = OpenEnum<"edge_to_edge" | "packshot" | "cutout_margin" | "montage" | "unknown">;
23
+ /** What a document is for; a document can carry more than one purpose. */
24
+ export type VariantDocumentType = OpenEnum<"technical_data_sheet" | "product_sheet" | "technical_bulletin" | "sustainability_report" | "specification" | "installation_guide" | "care_maintenance_guide" | "operation_manual" | "warranty" | "parts_list" | "technical_drawing" | "test_report" | "certificate" | "declaration_of_performance" | "environmental_product_declaration" | "health_product_declaration" | "ingredient_disclosure" | "safety_data_sheet" | "brochure" | "catalogue" | "colour_finish_chart" | "other" | "unknown">;
25
+ /** Every asset kind the registry knows. */
26
+ export type VariantAssetKind = OpenEnum<"image" | "document" | "cad" | "bim" | "model_3d" | "texture" | "archive" | "other" | "unknown">;
27
+ /**
28
+ * One asset. A field is absent only where it says so: kind-scoped fields
29
+ * appear on their kind, and an absent value is unknown. `url` is absent when
30
+ * `availability` is `unavailable`; `appliesTo` appears only as `product`.
31
+ */
32
+ export type VariantAssetItem = {
33
+ /** Only `product`: filed against the whole product. Absent: this variant's own. */
34
+ appliesTo?: "product";
35
+ assetId: string;
36
+ availability: VariantAssetAvailability;
37
+ /** Not on images; absent when unknown. */
38
+ byteSize?: number;
39
+ /** Documents only; absent when unknown. */
40
+ documentTypes?: VariantDocumentType[];
41
+ /** Images only; absent when unknown. */
42
+ height?: number;
43
+ /** Images only; absent when unknown. */
44
+ imageRole?: VariantImageRole;
45
+ kind: VariantAssetKind;
46
+ /** Not on images; absent when unknown. */
47
+ name?: string;
48
+ /** Images only; absent when unknown. */
49
+ presentation?: VariantImagePresentation;
50
+ url?: string;
51
+ /** Images only; absent when unknown. */
52
+ width?: number;
53
+ };
54
+ /** Whether the maker's document source was read for this variant. Absent when documents are filtered out. */
55
+ export type VariantDocumentCoverageState = OpenEnum<"available" | "none_declared" | "not_ingested" | "unavailable_source" | "dead_link" | "failed_ingest">;
56
+ export type VariantAssetPageInfo = {
57
+ nextCursor: string | null;
58
+ returnedCount: number;
59
+ totalMatches: number;
60
+ };
61
+ /** Request filters and paging for `listVariantAssets`. Each list is OR within itself, AND across lists. */
62
+ export type ListVariantAssetsOptions = {
63
+ kinds?: VariantAssetKind[];
64
+ imageRoles?: VariantImageRole[];
65
+ documentTypes?: VariantDocumentType[];
66
+ /** 1..50, default 20. */
67
+ limit?: number;
68
+ /** `pageInfo.nextCursor` from the previous page, with the same variantId and filters. */
69
+ cursor?: string;
70
+ };
71
+ /** One page. An unknown variant is a 404, never a page. */
72
+ export type VariantAssetPage = {
73
+ documentCoverage?: VariantDocumentCoverageState;
74
+ items: VariantAssetItem[];
75
+ pageInfo: VariantAssetPageInfo;
76
+ /** The variant's primary image. Absent when it has none. */
77
+ primaryAssetId?: string;
78
+ };
42
79
  export type MaterialDocumentStatus = OpenEnum<"downloaded" | "linked_not_downloaded" | "unavailable_source" | "dead_link" | "failed_ingest">;
43
80
  export type MaterialDocumentCoverageState = OpenEnum<"available" | "none_declared" | "not_ingested" | "unavailable_source" | "dead_link" | "failed_ingest">;
44
- export interface MaterialDocumentScope {
81
+ export type MaterialDocumentScope = {
45
82
  kind: "product" | "variant";
46
83
  id: string;
47
- }
48
- export interface MaterialDocumentSource {
84
+ };
85
+ export type MaterialDocumentSource = {
49
86
  /** Opaque, public identifier for one source collection; never a PIM/DAM path. */
50
87
  id: string;
51
88
  authority: string;
52
89
  revision: string;
53
- }
54
- export interface MaterialDocumentProjectionItem {
90
+ };
91
+ export type MaterialDocumentProjectionItem = {
55
92
  id: string;
56
93
  scope: MaterialDocumentScope & {
57
94
  inherited: boolean;
@@ -61,12 +98,12 @@ export interface MaterialDocumentProjectionItem {
61
98
  /** True only for a Product declaration or this exact requested Variant. */
62
99
  appliesToRequestedVariant: boolean;
63
100
  /** Every exact source-grain declaration collapsed into this URL identity. */
64
- declarations: Array<{
101
+ declarations: {
65
102
  scope: MaterialDocumentScope;
66
103
  source: MaterialDocumentSource;
67
104
  status: MaterialDocumentStatus;
68
105
  readable: boolean;
69
- }>;
106
+ }[];
70
107
  documentType: string | null;
71
108
  originalName: string;
72
109
  status: MaterialDocumentStatus;
@@ -75,51 +112,34 @@ export interface MaterialDocumentProjectionItem {
75
112
  contentType: string | null;
76
113
  fileExtension: string | null;
77
114
  source: MaterialDocumentSource;
78
- }
79
- export interface MaterialDocumentCoverageSource {
115
+ };
116
+ export type MaterialDocumentCoverageSource = {
80
117
  scope: MaterialDocumentScope;
81
118
  state: MaterialDocumentCoverageState;
82
119
  exact: boolean;
83
120
  declaredCount: number | null;
84
121
  readableCount: number;
85
122
  source: MaterialDocumentSource;
86
- }
87
- export interface MaterialDocumentCoverage {
123
+ };
124
+ export type MaterialDocumentCoverage = {
88
125
  productUnion: MaterialDocumentCoverageSummary;
89
126
  requestedVariant: MaterialDocumentCoverageSummary;
90
127
  sources: MaterialDocumentCoverageSource[];
91
- }
92
- export interface MaterialDocumentCoverageSummary {
128
+ };
129
+ export type MaterialDocumentCoverageSummary = {
93
130
  state: MaterialDocumentCoverageState;
94
131
  exact: boolean;
95
132
  declaredCount: number | null;
96
133
  readableCount: number;
97
- }
98
- export interface MaterialDocumentPageOptions {
134
+ };
135
+ export type MaterialDocumentPageOptions = {
99
136
  cursor?: string;
100
137
  limit?: number;
101
- }
102
- export interface MaterialDocumentPage {
138
+ };
139
+ export type MaterialDocumentPage = {
103
140
  variantId: VariantId;
104
141
  documents: MaterialDocumentProjectionItem[];
105
142
  coverage: MaterialDocumentCoverage;
106
143
  totalDocuments: number;
107
144
  nextCursor: string | null;
108
- }
109
- /** Tallies over what this projection returned — never a claim about the brand's own library. */
110
- export interface MaterialAssetProjectionSummary {
111
- imageCount: number;
112
- downloadCount: number;
113
- documentCount: number;
114
- readableDocumentCount: number;
115
- downloadedImageCount: number;
116
- }
117
- export interface MaterialAssetProjection {
118
- /** Opaque — echoed from the request. */
119
- variantId: VariantId;
120
- images: MaterialAssetProjectionImage[];
121
- downloads: MaterialAssetProjectionDownload[];
122
- documents: MaterialDocumentProjectionItem[];
123
- documentCoverage: MaterialDocumentCoverage;
124
- summary: MaterialAssetProjectionSummary;
125
- }
145
+ };
@@ -45,32 +45,34 @@ export type MaterialBlockFieldValue = string | number | boolean | unknown[] | Re
45
45
  * `status: "verified"` is a real negative you may publish; the same `false`
46
46
  * under `missing` is a placeholder for an unanswered question.
47
47
  */
48
- export interface MaterialBlockProjectionField {
48
+ export type MaterialBlockProjectionField = {
49
49
  /** Canonical vocabulary, not an opaque id — the same token `bySpec` accepts. */
50
50
  attributeId: string;
51
51
  label: string;
52
52
  value: MaterialBlockFieldValue;
53
+ /** The value dictionary's label for a single-term `value`. Absent when no label is on record; `value` stays the canonical token. */
54
+ displayValue?: string;
53
55
  unit?: string;
54
56
  status: MaterialBlockFieldStatus;
55
57
  /** Provenance supplied by the graph when a source-backed claim supports this field. */
56
58
  sourceBasis?: string;
57
59
  /** Claim confidence supplied by the graph; absence means no confidence was emitted. */
58
60
  confidence?: number;
59
- }
60
- export interface MaterialBlockProjectionItem {
61
+ };
62
+ export type MaterialBlockProjectionItem = {
61
63
  canonicalBlockId: string;
62
64
  canonicalBlockName: string;
63
65
  status: MaterialBlockStatus;
64
66
  fields: MaterialBlockProjectionField[];
65
67
  /** The work queue: attributes with `status: "missing"`. UNKNOWN, never "none". */
66
68
  missingAttributeIds: string[];
67
- }
69
+ };
68
70
  /**
69
71
  * Every canonical block for one material, each field carrying whether it is
70
72
  * determined. The whole surface, not a page — there is no cursor here.
71
73
  */
72
- export interface MaterialBlockProjection {
74
+ export type MaterialBlockProjection = {
73
75
  /** Opaque — echoed from the request. */
74
76
  variantId: VariantId;
75
77
  blocks: MaterialBlockProjectionItem[];
76
- }
78
+ };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The MATERIAL COMPOSITION lens: what a product is made of, and how far the
3
+ * corpus that answers that question has got (MG-1969).
4
+ *
5
+ * Not `./composition-client.ts`, which wraps the slot pools a scheme composer
6
+ * outside MaterialGraph reads.
7
+ */
8
+ import type { HttpTransport } from "./http-transport.js";
9
+ import type { CompositionCorpusSummary } from "./material-composition-types.js";
10
+ /**
11
+ * THE QUESTION: "which product types can we answer that question for yet?"
12
+ *
13
+ * Coverage per product type, counted in Live SKUs as well as in tuples. Read
14
+ * the SKU figure: one tuple can carry a hundred thousand SKUs or one, so a
15
+ * corpus that resolved every rare tuple and none of the common ones reads as
16
+ * good coverage counted by tuple.
17
+ *
18
+ * A type in `completeness.authoringQueue` has no bar set, which is never the
19
+ * same as a bar it missed. Requires the `mg:read` scope.
20
+ */
21
+ export declare const compositionReport: (transport: HttpTransport, signal?: AbortSignal) => Promise<CompositionCorpusSummary>;
@@ -0,0 +1,13 @@
1
+ import { resolveOperation } from "./operations.js";
2
+ /**
3
+ * THE QUESTION: "which product types can we answer that question for yet?"
4
+ *
5
+ * Coverage per product type, counted in Live SKUs as well as in tuples. Read
6
+ * the SKU figure: one tuple can carry a hundred thousand SKUs or one, so a
7
+ * corpus that resolved every rare tuple and none of the common ones reads as
8
+ * good coverage counted by tuple.
9
+ *
10
+ * A type in `completeness.authoringQueue` has no bar set, which is never the
11
+ * same as a bar it missed. Requires the `mg:read` scope.
12
+ */
13
+ export const compositionReport = async (transport, signal) => await transport.requestJson(resolveOperation("get_composition_report"), { signal });