@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
package/runs.js CHANGED
@@ -1,72 +1,76 @@
1
1
  /**
2
2
  * The Run + source-material namespace — the agentic half of the SDK. These
3
3
  * functions take the shared {@link HttpTransport} and speak the hosted Run
4
- * lifecycle: upload source material, list capabilities, create/read/resume/
5
- * cancel Runs, and stream (or drain) their events. Box's proxy routes are thin
6
- * wrappers over exactly these calls.
4
+ * lifecycle: upload source material, create/read Runs, and stream (or drain)
5
+ * their events. Box's proxy routes are thin wrappers over exactly these calls.
7
6
  */
8
7
  import { MaterialGraphError } from "./errors.js";
9
- import { HttpTransport } from "./http-transport.js";
10
- import { findSdkOperation, operationPath, } from "./operations.js";
11
- import { TERMINAL_RUN_EVENT_TYPES, } from "./run-types.js";
8
+ import { findSdkOperation, operationPath } from "./operations.js";
9
+ import { TERMINAL_RUN_EVENT_TYPES } from "./run-types.js";
12
10
  import { checkPostSourceMaterialCommentResult, checkSourceMaterialBatchDetail, checkSourceMaterialCommentThread, } from "./source-material-validation.js";
13
11
  import { readSseFrames } from "./sse.js";
14
- function runOperation(operationId) {
12
+ const runOperation = (operationId) => {
15
13
  const match = findSdkOperation(operationId);
16
- if (!match)
14
+ if (!match) {
17
15
  throw MaterialGraphError.unexpected(`Unknown SDK operation: ${operationId}`);
16
+ }
18
17
  return match;
19
- }
18
+ };
20
19
  /** Build a `Blob` from raw bytes, normalising to an ArrayBuffer-backed view. */
21
- function bytesToBlob(input) {
20
+ const bytesToBlob = (input) => {
22
21
  const type = input.contentType ? { type: input.contentType } : {};
23
- if (input.data instanceof ArrayBuffer)
22
+ if (input.data instanceof ArrayBuffer) {
24
23
  return new Blob([input.data], type);
24
+ }
25
25
  // A Uint8Array may be SharedArrayBuffer-backed; copy into a fresh view so the
26
26
  // Blob part is unambiguously ArrayBuffer-backed (no cast needed).
27
27
  const copy = new Uint8Array(input.data.byteLength);
28
28
  copy.set(input.data);
29
29
  return new Blob([copy], type);
30
- }
30
+ };
31
31
  /** Append one file to the multipart body, from either input form. */
32
- function appendFile(form, field, input) {
32
+ const appendFile = (form, field, input) => {
33
33
  if (input instanceof Blob) {
34
- if (input instanceof File)
34
+ if (input instanceof File) {
35
35
  form.append(field, input, input.name);
36
- else
36
+ }
37
+ else {
37
38
  form.append(field, input);
39
+ }
38
40
  return;
39
41
  }
40
42
  form.append(field, bytesToBlob(input), input.filename);
41
- }
43
+ };
42
44
  /**
43
45
  * Upload one atomic source-material batch (`POST /api/v1/source-material`).
44
46
  * Accepts the pile-of-files shape (`{ files }` → repeatable `files` field) or
45
47
  * the legacy `{ brief, references }` shape (→ `brief` + repeatable `references`
46
48
  * fields). Both wire to multipart the server accepts.
47
49
  */
48
- export async function uploadSourceMaterial(transport, input, signal) {
50
+ export const uploadSourceMaterial = async (transport, input, signal) => {
49
51
  const form = new FormData();
50
52
  if ("files" in input) {
51
- for (const file of input.files)
53
+ for (const file of input.files) {
52
54
  appendFile(form, "files", file);
55
+ }
53
56
  }
54
57
  else {
55
58
  appendFile(form, "brief", input.brief);
56
- for (const reference of input.references ?? [])
59
+ for (const reference of input.references ?? []) {
57
60
  appendFile(form, "references", reference);
61
+ }
58
62
  }
59
63
  const url = transport.buildUrl(operationPath(runOperation("upload_source_material")));
60
64
  // No Content-Type header: fetch sets multipart/form-data with the boundary.
61
65
  const { parsed } = await transport.send({
62
- method: "POST",
63
- url,
64
- headers: transport.authHeaders(),
65
66
  body: form,
67
+ headers: transport.authHeaders(),
68
+ method: "POST",
66
69
  signal,
70
+ url,
67
71
  });
68
72
  return parsed;
69
- }
73
+ };
70
74
  /**
71
75
  * Read back one uploaded batch (`GET /api/v1/source-material/{batchId}`): every
72
76
  * file with a fetchable `url`, and every analysis computed over its bytes
@@ -79,13 +83,13 @@ export async function uploadSourceMaterial(transport, input, signal) {
79
83
  * the server's Zod contract so a malformed response fails here with a path into
80
84
  * the payload rather than as an undefined three frames away in caller code.
81
85
  */
82
- export async function getSourceMaterialBatch(transport, batchId, signal) {
86
+ export const getSourceMaterialBatch = async (transport, batchId, signal) => {
83
87
  const body = await transport.requestJson(runOperation("get_source_material_batch"), {
84
88
  pathParams: { batchId },
85
89
  signal,
86
90
  });
87
91
  return checkSourceMaterialBatchDetail(body, batchId);
88
- }
92
+ };
89
93
  /**
90
94
  * Read one file's comment thread
91
95
  * (`GET /api/v1/source-material/{batchId}/sources/{sourceId}/comments`).
@@ -103,13 +107,13 @@ export async function getSourceMaterialBatch(transport, batchId, signal) {
103
107
  * A file that is not in that batch, or a batch you do not own, raises the same
104
108
  * 404 as a file that never existed.
105
109
  */
106
- export async function listSourceMaterialComments(transport, batchId, sourceId, signal) {
110
+ export const listSourceMaterialComments = async (transport, batchId, sourceId, signal) => {
107
111
  const body = await transport.requestJson(runOperation("list_source_material_comments"), {
108
112
  pathParams: { batchId, sourceId },
109
113
  signal,
110
114
  });
111
115
  return checkSourceMaterialCommentThread(body, sourceId);
112
- }
116
+ };
113
117
  /**
114
118
  * Add one remark to a file's thread
115
119
  * (`POST /api/v1/source-material/{batchId}/sources/{sourceId}/comments`).
@@ -125,7 +129,7 @@ export async function listSourceMaterialComments(transport, batchId, sourceId, s
125
129
  * The result is discriminated on `kind`: switch on it rather than reaching for
126
130
  * `replies`, which a `reply` does not have.
127
131
  */
128
- export async function postSourceMaterialComment(transport, batchId, sourceId, input, signal) {
132
+ export const postSourceMaterialComment = async (transport, batchId, sourceId, input, signal) => {
129
133
  const body = await transport.requestJson(runOperation("post_source_material_comment"), {
130
134
  // Built key by key rather than spread: `parentCommentId` and
131
135
  // `idempotencyKey` are forwarded only when PRESENT, so a caller that
@@ -145,122 +149,22 @@ export async function postSourceMaterialComment(transport, batchId, sourceId, in
145
149
  signal,
146
150
  });
147
151
  return checkPostSourceMaterialCommentResult(body, sourceId);
148
- }
149
- /** List invocable agents, workflows, and tools (`GET /api/v1/capabilities`). */
150
- export function capabilities(transport, signal) {
151
- return transport.requestJson(runOperation("list_public_capabilities"), {
152
- signal,
153
- });
154
- }
152
+ };
155
153
  /** Start an asynchronous capability Run (`POST /api/v1/runs`). */
156
- export function createRun(transport, body, signal) {
157
- return transport.requestJson(runOperation("create_public_run"), {
158
- body,
159
- signal,
160
- });
161
- }
162
- /**
163
- * List your own Runs, newest first (`GET /api/v1/runs`).
164
- *
165
- * The recovery path for a client that still holds its API key but has lost a Run
166
- * id — a reinstalled app, or a crash before the id from {@link createRun} was
167
- * persisted. `{ status: "suspended" }` finds the Run still waiting on an answer.
168
- *
169
- * Only the calling principal's own Runs are ever returned; there is no
170
- * cross-principal listing.
171
- *
172
- * Page by following `nextCursor` until it is ABSENT — a full page is not the
173
- * signal to stop, and an absent cursor is the only one.
174
- */
175
- export function listRuns(transport, options = {}) {
176
- const query = {
177
- ...(options.status === undefined ? {} : { status: options.status }),
178
- ...(options.limit === undefined ? {} : { limit: options.limit }),
179
- ...(options.cursor === undefined ? {} : { cursor: options.cursor }),
180
- };
181
- return transport.requestJson(runOperation("list_public_runs"), {
182
- ...(Object.keys(query).length > 0 ? { query } : {}),
183
- ...(options.signal ? { signal: options.signal } : {}),
184
- });
185
- }
154
+ export const createRun = async (transport, body, signal) => await transport.requestJson(runOperation("create_public_run"), {
155
+ body,
156
+ signal,
157
+ });
186
158
  /** Get a Run's current state (`GET /api/v1/runs/{runId}`). */
187
- export function getRun(transport, runId, signal) {
188
- return transport.requestJson(runOperation("get_public_run"), {
189
- pathParams: { runId },
190
- signal,
191
- });
192
- }
193
- /**
194
- * Export a completed compose Run's scheme as a finish schedule — one row per
195
- * slot, every attribute value carrying its source and verification state
196
- * (`GET /api/v1/runs/{runId}/schedule`).
197
- *
198
- * The `.xlsx` form of the same export is deliberately NOT an SDK method: this
199
- * transport parses every response as text/JSON and has no binary read path, so
200
- * a bytes-returning method would mean a second transport surface for one file.
201
- * Fetch `GET /api/v1/runs/{runId}/schedule.xlsx` directly with the same bearer
202
- * key when you want the workbook.
203
- */
204
- export function getRunSchedule(transport, runId, options = {}) {
205
- return transport.requestJson(runOperation("get_run_finish_schedule"), {
206
- pathParams: { runId },
207
- ...(options.schemeId ? { query: { schemeId: options.schemeId } } : {}),
208
- ...(options.signal ? { signal: options.signal } : {}),
209
- });
210
- }
211
- /**
212
- * Normalise `resumeRun`'s overloaded third argument.
213
- *
214
- * A bare `AbortSignal` stays supported because it is the published shape:
215
- * reordering that parameter would break any consumer passing it positionally,
216
- * and this ships with no version bump.
217
- *
218
- * Discriminated on `instanceof AbortSignal`, NOT on the presence of `stepId`.
219
- * `{ signal }` with no `stepId` is a perfectly valid options object, and a
220
- * key-presence test would misread it as a signal and silently drop the abort.
221
- */
222
- function resumeOptions(value) {
223
- if (value === undefined)
224
- return {};
225
- return value instanceof AbortSignal ? { signal: value } : value;
226
- }
227
- /**
228
- * Resume a suspended Run (`POST /api/v1/runs/{runId}/resume`).
229
- *
230
- * The third argument takes either an `AbortSignal` (legacy) or
231
- * {@link ResumeRunOptions}.
232
- *
233
- * `stepId` is forwarded whenever it is PRESENT — `!== undefined`, not truthy.
234
- * An empty string is a present-but-malformed value and must reach the server
235
- * so its schema rejects it; treating it as absent would silently downgrade a
236
- * guarded resume into an unguarded one, which is the exact failure this guard
237
- * exists to prevent.
238
- *
239
- * Omitting it sends a body byte-identical to what this sent before. Note the
240
- * wire cannot distinguish `{ stepId: undefined }` from no key at all —
241
- * `JSON.stringify` drops both — so the distinction here is construction
242
- * intent, kept so the serialised body is provably unchanged for old callers.
243
- */
244
- export function resumeRun(transport, runId, resumeData, signalOrOptions) {
245
- const { stepId, signal } = resumeOptions(signalOrOptions);
246
- return transport.requestJson(runOperation("resume_public_run"), {
247
- body: { resumeData, ...(stepId !== undefined ? { stepId } : {}) },
248
- pathParams: { runId },
249
- signal,
250
- });
251
- }
252
- /** Request durable Run cancellation (`POST /api/v1/runs/{runId}/cancel`). */
253
- export function cancelRun(transport, runId, signal) {
254
- return transport.requestJson(runOperation("cancel_public_run"), {
255
- body: {},
256
- pathParams: { runId },
257
- signal,
258
- });
259
- }
159
+ export const getRun = async (transport, runId, signal) => await transport.requestJson(runOperation("get_public_run"), {
160
+ pathParams: { runId },
161
+ signal,
162
+ });
260
163
  /** Decode one SSE `data:` frame into a {@link RunEvent}, or `null` when unusable. */
261
- function decodeRunEvent(data) {
262
- if (data.length === 0)
164
+ const decodeRunEvent = (data) => {
165
+ if (data.length === 0) {
263
166
  return null;
167
+ }
264
168
  let parsed;
265
169
  try {
266
170
  parsed = JSON.parse(data);
@@ -268,13 +172,15 @@ function decodeRunEvent(data) {
268
172
  catch (cause) {
269
173
  throw MaterialGraphError.unexpected(`MaterialGraph run-event stream sent an unparseable data frame: ${String(cause)}`);
270
174
  }
271
- if (typeof parsed !== "object" || parsed === null)
175
+ if (typeof parsed !== "object" || parsed === null) {
272
176
  return null;
177
+ }
273
178
  const record = parsed;
274
- if (typeof record.sequence !== "number" || typeof record.type !== "string")
179
+ if (typeof record.sequence !== "number" || typeof record.type !== "string") {
275
180
  return null;
181
+ }
276
182
  return parsed;
277
- }
183
+ };
278
184
  /**
279
185
  * Stream ordered Run events as an async iterator (`GET
280
186
  * /api/v1/runs/{runId}/events`, SSE). Iterates until the stream ends or
@@ -293,8 +199,9 @@ export async function* streamRunEvents(transport, runId, options = {}) {
293
199
  });
294
200
  for await (const frame of readSseFrames(body, options.signal)) {
295
201
  const event = decodeRunEvent(frame.data);
296
- if (event)
202
+ if (event) {
297
203
  yield event;
204
+ }
298
205
  }
299
206
  }
300
207
  /**
@@ -312,30 +219,34 @@ export async function* streamRunEvents(transport, runId, options = {}) {
312
219
  * failure (a real 4xx/5xx or transport error) still propagates, keeping the
313
220
  * fail-fast surface for genuine upstream problems.
314
221
  */
315
- export async function drainRunEvents(transport, runId, options) {
222
+ export const drainRunEvents = async (transport, runId, options) => {
316
223
  const collected = [];
317
224
  const controller = new AbortController();
318
- const timer = setTimeout(() => controller.abort(), options.deadlineMs);
225
+ const timer = setTimeout(() => {
226
+ controller.abort();
227
+ }, options.deadlineMs);
319
228
  try {
320
229
  for await (const event of streamRunEvents(transport, runId, {
321
230
  after: options.after,
322
231
  signal: controller.signal,
323
232
  })) {
324
233
  collected.push(event);
325
- if (TERMINAL_RUN_EVENT_TYPES.has(event.type))
234
+ if (TERMINAL_RUN_EVENT_TYPES.has(event.type)) {
326
235
  break;
236
+ }
327
237
  }
328
238
  }
329
239
  catch (error) {
330
240
  const causedByDeadline = controller.signal.aborted &&
331
241
  error instanceof MaterialGraphError &&
332
242
  error.kind === "aborted";
333
- if (!causedByDeadline)
243
+ if (!causedByDeadline) {
334
244
  throw error;
245
+ }
335
246
  }
336
247
  finally {
337
248
  clearTimeout(timer);
338
249
  controller.abort();
339
250
  }
340
251
  return collected;
341
- }
252
+ };
@@ -1,4 +1,4 @@
1
- export interface SamplizeCatalogueOptions {
1
+ export type SamplizeCatalogueOptions = {
2
2
  limit?: number;
3
3
  /** Continue with unchanged filters and sourceVersion; omit when filters change. */
4
4
  after?: string;
@@ -8,8 +8,8 @@ export interface SamplizeCatalogueOptions {
8
8
  collectionHandle?: string;
9
9
  /** Pin every subsequent page to the version returned by the first page. */
10
10
  sourceVersion?: string;
11
- }
12
- export interface SamplizeCatalogueProduct {
11
+ };
12
+ export type SamplizeCatalogueProduct = {
13
13
  variantId: string;
14
14
  productId: string;
15
15
  name: string;
@@ -38,18 +38,18 @@ export interface SamplizeCatalogueProduct {
38
38
  };
39
39
  sourceProductId: string;
40
40
  url: string;
41
- sizeVariants: Array<{
41
+ sizeVariants: {
42
42
  sourceVariantId: string;
43
43
  sku: string | null;
44
44
  title: string | null;
45
45
  price: number | null;
46
46
  inventoryAvailable: boolean;
47
47
  demand: SamplizeDemand | null;
48
- }>;
48
+ }[];
49
49
  publishedHexes: SamplizeHexObservation[];
50
50
  hexObservations: SamplizeHexObservation[];
51
- }
52
- export interface SamplizeCataloguePage {
51
+ };
52
+ export type SamplizeCataloguePage = {
53
53
  schemaVersion: 2;
54
54
  corpusScope: "samplizeCatalogue";
55
55
  sourceVersion: string;
@@ -60,8 +60,8 @@ export interface SamplizeCataloguePage {
60
60
  nextCursor: string | null;
61
61
  /** True on the final page; completeness requires collecting total unique IDs. */
62
62
  complete: boolean;
63
- }
64
- export interface SamplizeHexObservation {
63
+ };
64
+ export type SamplizeHexObservation = {
65
65
  hex: string;
66
66
  publisher: string;
67
67
  source: string;
@@ -69,30 +69,30 @@ export interface SamplizeHexObservation {
69
69
  sourceBasis: string;
70
70
  observedAt: string | null;
71
71
  differsFromSelected: boolean;
72
- }
73
- export interface SamplizePublicationSource {
72
+ };
73
+ export type SamplizePublicationSource = {
74
74
  publisher: "Samplize";
75
75
  source: "algolia_shopify_products";
76
76
  sourceUrl: string;
77
77
  observedAt: string | null;
78
- }
79
- export interface SamplizeLrvObservation extends SamplizePublicationSource {
78
+ };
79
+ export type SamplizeLrvObservation = {
80
80
  field: string;
81
81
  value: number;
82
- }
83
- export interface SamplizeDemand extends SamplizePublicationSource {
82
+ } & SamplizePublicationSource;
83
+ export type SamplizeDemand = {
84
84
  field: "recently_ordered_count";
85
85
  sourceVariantId: string;
86
86
  grain: "shopify_variant";
87
87
  recentlyOrderedCount: number;
88
88
  /** The publisher does not supply the time window. */
89
89
  window: null;
90
- }
91
- export interface SamplizeCollectionMembership {
90
+ } & SamplizePublicationSource;
91
+ export type SamplizeCollectionMembership = {
92
92
  sourceCollectionId: string;
93
93
  handle: string;
94
94
  url: string;
95
95
  publisher: "Samplize";
96
96
  source: "algolia_shopify_products";
97
97
  observedAt: string | null;
98
- }
98
+ };
@@ -1,6 +1,6 @@
1
1
  export declare const SAMPLIZE_COLORVEC_RANKING_VERSION = "solid-colorvec-cosine-v2";
2
2
  export declare const SAMPLIZE_COLORVEC_EMBEDDING_VERSION = "oklch-anchor-quantiles-v12";
3
- export interface SamplizeColorVecPaint {
3
+ export type SamplizeColorVecPaint = {
4
4
  variantId: string;
5
5
  hex: string;
6
6
  brand: string;
@@ -13,22 +13,22 @@ export interface SamplizeColorVecPaint {
13
13
  lightness: string;
14
14
  intensity: string;
15
15
  vector: number[] | string;
16
- }
17
- export interface SamplizeColorVecCache {
16
+ };
17
+ export type SamplizeColorVecCache = {
18
18
  sourceVersion: string;
19
19
  dictionaryVersion: string;
20
20
  embeddingVersion: string;
21
21
  rankingVersion: string;
22
22
  generatedAt: string;
23
23
  paints: SamplizeColorVecPaint[];
24
- }
25
- export interface SamplizeColorVecInput {
24
+ };
25
+ export type SamplizeColorVecInput = {
26
26
  hex?: string;
27
27
  reference?: string;
28
- palette?: Array<{
28
+ palette?: {
29
29
  hex: string;
30
30
  proportion: number;
31
- }>;
31
+ }[];
32
32
  direction?: "similar" | "lighter" | "darker" | "muted";
33
33
  brand?: string[];
34
34
  family?: string[];
@@ -39,32 +39,32 @@ export interface SamplizeColorVecInput {
39
39
  temperatureMin?: number;
40
40
  temperatureMax?: number;
41
41
  limit?: number;
42
- }
42
+ };
43
43
  export declare const samplizeSolidColorVector: (hex: string) => number[];
44
44
  /** Canonical constraints are shared by full-cache similarity and constrained text retrieval. */
45
- export declare function selectSamplizeEligiblePaints<T extends Omit<SamplizeColorVecPaint, "vector">>(paints: T[], input: SamplizeColorVecInput): {
46
- reference: T | undefined;
47
- eligible: T[];
45
+ export declare const selectSamplizeEligiblePaints: <T extends Omit<SamplizeColorVecPaint, "vector">>(paints: T[], input: SamplizeColorVecInput) => {
48
46
  counts: Record<"brand" | "family" | "intensity" | "lightness", Record<string, number>>;
47
+ eligible: T[];
48
+ reference: T | undefined;
49
49
  };
50
50
  /** Official portable MG ranking over its complete versioned sampling-channel projection. */
51
- export declare function createSamplizeColorVecIndex(cache: SamplizeColorVecCache): {
51
+ export declare const createSamplizeColorVecIndex: (cache: SamplizeColorVecCache) => {
52
52
  search(input: SamplizeColorVecInput): {
53
- ids: string[];
53
+ countBasis: "complete-catalogue";
54
+ counts: Record<"brand" | "family" | "intensity" | "lightness", Record<string, number>>;
55
+ dictionaryVersion: string;
56
+ eligibleCount: number;
57
+ embeddingVersion: string;
54
58
  groups: {
55
59
  hex: string;
60
+ ids: string[];
56
61
  proportion: number;
57
62
  quota: number;
58
- ids: string[];
59
63
  shortfall: number;
60
64
  }[];
65
+ ids: string[];
61
66
  limited: boolean;
62
- eligibleCount: number;
63
- counts: Record<"brand" | "family" | "intensity" | "lightness", Record<string, number>>;
64
- sourceVersion: string;
65
- dictionaryVersion: string;
66
- embeddingVersion: string;
67
67
  rankingVersion: string;
68
- countBasis: "complete-catalogue";
68
+ sourceVersion: string;
69
69
  };
70
70
  };