@instruments/materialgraph 0.25.0 → 0.26.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.
- package/association-types.d.ts +20 -20
- package/associations-client.d.ts +4 -4
- package/associations-client.js +3 -10
- package/attribution-types.d.ts +3 -3
- package/brand-most-sampled-types.d.ts +4 -4
- package/brand-types.d.ts +6 -6
- package/brands-client.d.ts +4 -4
- package/brands-client.js +9 -13
- package/browse-types.d.ts +8 -8
- package/by-colour-types.d.ts +18 -18
- package/by-spec-types.d.ts +14 -14
- package/catalog-discovery-types.d.ts +14 -14
- package/catalogue-client.d.ts +4 -4
- package/catalogue-client.js +38 -37
- package/catalogue-types.d.ts +4 -4
- package/citation-types.d.ts +4 -4
- package/client-browse.d.ts +4 -4
- package/client-browse.js +24 -25
- package/client-config.d.ts +2 -2
- package/client-exploration.d.ts +3 -3
- package/client-exploration.js +4 -6
- package/client-source-material-comments.d.ts +4 -4
- package/client-source-material-comments.js +4 -38
- package/client-vocabulary.d.ts +8 -8
- package/client-vocabulary.js +20 -30
- package/client.d.ts +11 -45
- package/client.js +143 -188
- package/codes-client.d.ts +2 -2
- package/codes-client.js +8 -8
- package/codes-types.d.ts +34 -34
- package/colour-aggregate-types.d.ts +24 -24
- package/colours-client.d.ts +2 -2
- package/colours-client.js +15 -15
- package/compare-types.d.ts +10 -10
- package/composition-client.d.ts +3 -3
- package/composition-client.js +8 -7
- package/composition-types.d.ts +12 -12
- package/coordinate-client.d.ts +2 -2
- package/coordinate-client.js +1 -13
- package/corpus-scope-types.d.ts +3 -3
- package/corpus-scope-types.js +1 -25
- package/correction-types.d.ts +10 -10
- package/demand-batch-types.d.ts +18 -18
- package/demand-types.d.ts +24 -24
- package/errors.d.ts +12 -12
- package/errors.js +53 -52
- package/exploration-types.d.ts +22 -22
- package/fan-deck-types.d.ts +6 -6
- package/http-transport.d.ts +13 -21
- package/http-transport.js +31 -28
- package/identify-types.d.ts +10 -10
- package/index.d.ts +0 -6
- package/index.js +0 -2
- package/match-rejection-types.d.ts +6 -6
- package/match-stream-types.d.ts +32 -32
- package/match-stream.d.ts +2 -2
- package/match-stream.js +55 -41
- package/match-types.d.ts +8 -8
- package/material-asset-types.d.ts +26 -26
- package/material-block-types.d.ts +6 -6
- package/material-query-plan-types.d.ts +26 -26
- package/material-resources-client.d.ts +5 -5
- package/material-resources-client.js +10 -20
- package/material-types.d.ts +12 -12
- package/ndjson.js +16 -8
- package/operations.d.ts +6 -6
- package/operations.js +9 -39
- package/package.json +1 -1
- package/palette-completion-types.d.ts +22 -22
- package/palette-search-types.d.ts +28 -28
- package/query-understanding-types.d.ts +38 -35
- package/render-assets-types.d.ts +8 -8
- package/resolve-client.d.ts +2 -2
- package/resolve-client.js +4 -6
- package/resolve-colour-types.d.ts +8 -8
- package/resolve-types.d.ts +10 -10
- package/run-types.d.ts +70 -70
- package/runs.d.ts +13 -26
- package/runs.js +77 -89
- package/samplize-catalogue-types.d.ts +18 -18
- package/samplize-colorvec.d.ts +20 -20
- package/samplize-colorvec.js +66 -42
- package/schema-resource-types.d.ts +38 -38
- package/schema-resource-types.js +5 -5
- package/search-card-types.d.ts +4 -4
- package/search-collapse-types.d.ts +4 -4
- package/search-mood-types.d.ts +2 -2
- package/search-refinement-types.d.ts +8 -8
- package/search-request-types.d.ts +5 -5
- package/search-response-receipt-types.d.ts +58 -42
- package/search-response-types.d.ts +2 -2
- package/search-result-validation.d.ts +3 -3
- package/search-result-validation.js +53 -36
- package/search-window-types.d.ts +2 -2
- package/slot-pool-types.d.ts +20 -20
- package/source-material-validation.d.ts +3 -3
- package/source-material-validation.js +35 -39
- package/spec-facet-types.d.ts +10 -10
- package/spec-types.d.ts +6 -6
- package/specifications.d.ts +9 -25
- package/specifications.js +15 -21
- package/sse.d.ts +2 -2
- package/sse.js +32 -16
- package/substitute-types.d.ts +22 -22
- package/suggest-types.d.ts +7 -7
- package/suggest-types.js +3 -3
- package/taxonomy-coverage-types.d.ts +8 -8
- package/types.d.ts +119 -119
- package/validation.d.ts +26 -26
- package/validation.js +97 -92
- package/webmcp.d.ts +2 -2
- package/webmcp.generated.js +94 -93
- package/project-types.d.ts +0 -79
- package/project-types.js +0 -9
- package/projects.d.ts +0 -13
- package/projects.js +0 -46
- package/run-events.d.ts +0 -106
- package/run-events.js +0 -32
- package/schedule-reference-types.d.ts +0 -46
- package/schedule-reference-types.js +0 -1
- package/schedule-references-client.d.ts +0 -14
- package/schedule-references-client.js +0 -26
- package/schedule-types.d.ts +0 -261
- package/schedule-types.js +0 -1
package/runs.js
CHANGED
|
@@ -6,67 +6,72 @@
|
|
|
6
6
|
* wrappers over exactly these calls.
|
|
7
7
|
*/
|
|
8
8
|
import { MaterialGraphError } from "./errors.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { TERMINAL_RUN_EVENT_TYPES, } from "./run-types.js";
|
|
9
|
+
import { findSdkOperation, operationPath } from "./operations.js";
|
|
10
|
+
import { TERMINAL_RUN_EVENT_TYPES } from "./run-types.js";
|
|
12
11
|
import { checkPostSourceMaterialCommentResult, checkSourceMaterialBatchDetail, checkSourceMaterialCommentThread, } from "./source-material-validation.js";
|
|
13
12
|
import { readSseFrames } from "./sse.js";
|
|
14
|
-
|
|
13
|
+
const runOperation = (operationId) => {
|
|
15
14
|
const match = findSdkOperation(operationId);
|
|
16
|
-
if (!match)
|
|
15
|
+
if (!match) {
|
|
17
16
|
throw MaterialGraphError.unexpected(`Unknown SDK operation: ${operationId}`);
|
|
17
|
+
}
|
|
18
18
|
return match;
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
20
|
/** Build a `Blob` from raw bytes, normalising to an ArrayBuffer-backed view. */
|
|
21
|
-
|
|
21
|
+
const bytesToBlob = (input) => {
|
|
22
22
|
const type = input.contentType ? { type: input.contentType } : {};
|
|
23
|
-
if (input.data instanceof ArrayBuffer)
|
|
23
|
+
if (input.data instanceof ArrayBuffer) {
|
|
24
24
|
return new Blob([input.data], type);
|
|
25
|
+
}
|
|
25
26
|
// A Uint8Array may be SharedArrayBuffer-backed; copy into a fresh view so the
|
|
26
27
|
// Blob part is unambiguously ArrayBuffer-backed (no cast needed).
|
|
27
28
|
const copy = new Uint8Array(input.data.byteLength);
|
|
28
29
|
copy.set(input.data);
|
|
29
30
|
return new Blob([copy], type);
|
|
30
|
-
}
|
|
31
|
+
};
|
|
31
32
|
/** Append one file to the multipart body, from either input form. */
|
|
32
|
-
|
|
33
|
+
const appendFile = (form, field, input) => {
|
|
33
34
|
if (input instanceof Blob) {
|
|
34
|
-
if (input instanceof File)
|
|
35
|
+
if (input instanceof File) {
|
|
35
36
|
form.append(field, input, input.name);
|
|
36
|
-
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
37
39
|
form.append(field, input);
|
|
40
|
+
}
|
|
38
41
|
return;
|
|
39
42
|
}
|
|
40
43
|
form.append(field, bytesToBlob(input), input.filename);
|
|
41
|
-
}
|
|
44
|
+
};
|
|
42
45
|
/**
|
|
43
46
|
* Upload one atomic source-material batch (`POST /api/v1/source-material`).
|
|
44
47
|
* Accepts the pile-of-files shape (`{ files }` → repeatable `files` field) or
|
|
45
48
|
* the legacy `{ brief, references }` shape (→ `brief` + repeatable `references`
|
|
46
49
|
* fields). Both wire to multipart the server accepts.
|
|
47
50
|
*/
|
|
48
|
-
export async
|
|
51
|
+
export const uploadSourceMaterial = async (transport, input, signal) => {
|
|
49
52
|
const form = new FormData();
|
|
50
53
|
if ("files" in input) {
|
|
51
|
-
for (const file of input.files)
|
|
54
|
+
for (const file of input.files) {
|
|
52
55
|
appendFile(form, "files", file);
|
|
56
|
+
}
|
|
53
57
|
}
|
|
54
58
|
else {
|
|
55
59
|
appendFile(form, "brief", input.brief);
|
|
56
|
-
for (const reference of input.references ?? [])
|
|
60
|
+
for (const reference of input.references ?? []) {
|
|
57
61
|
appendFile(form, "references", reference);
|
|
62
|
+
}
|
|
58
63
|
}
|
|
59
64
|
const url = transport.buildUrl(operationPath(runOperation("upload_source_material")));
|
|
60
65
|
// No Content-Type header: fetch sets multipart/form-data with the boundary.
|
|
61
66
|
const { parsed } = await transport.send({
|
|
62
|
-
method: "POST",
|
|
63
|
-
url,
|
|
64
|
-
headers: transport.authHeaders(),
|
|
65
67
|
body: form,
|
|
68
|
+
headers: transport.authHeaders(),
|
|
69
|
+
method: "POST",
|
|
66
70
|
signal,
|
|
71
|
+
url,
|
|
67
72
|
});
|
|
68
73
|
return parsed;
|
|
69
|
-
}
|
|
74
|
+
};
|
|
70
75
|
/**
|
|
71
76
|
* Read back one uploaded batch (`GET /api/v1/source-material/{batchId}`): every
|
|
72
77
|
* file with a fetchable `url`, and every analysis computed over its bytes
|
|
@@ -79,13 +84,13 @@ export async function uploadSourceMaterial(transport, input, signal) {
|
|
|
79
84
|
* the server's Zod contract so a malformed response fails here with a path into
|
|
80
85
|
* the payload rather than as an undefined three frames away in caller code.
|
|
81
86
|
*/
|
|
82
|
-
export async
|
|
87
|
+
export const getSourceMaterialBatch = async (transport, batchId, signal) => {
|
|
83
88
|
const body = await transport.requestJson(runOperation("get_source_material_batch"), {
|
|
84
89
|
pathParams: { batchId },
|
|
85
90
|
signal,
|
|
86
91
|
});
|
|
87
92
|
return checkSourceMaterialBatchDetail(body, batchId);
|
|
88
|
-
}
|
|
93
|
+
};
|
|
89
94
|
/**
|
|
90
95
|
* Read one file's comment thread
|
|
91
96
|
* (`GET /api/v1/source-material/{batchId}/sources/{sourceId}/comments`).
|
|
@@ -103,13 +108,13 @@ export async function getSourceMaterialBatch(transport, batchId, signal) {
|
|
|
103
108
|
* A file that is not in that batch, or a batch you do not own, raises the same
|
|
104
109
|
* 404 as a file that never existed.
|
|
105
110
|
*/
|
|
106
|
-
export async
|
|
111
|
+
export const listSourceMaterialComments = async (transport, batchId, sourceId, signal) => {
|
|
107
112
|
const body = await transport.requestJson(runOperation("list_source_material_comments"), {
|
|
108
113
|
pathParams: { batchId, sourceId },
|
|
109
114
|
signal,
|
|
110
115
|
});
|
|
111
116
|
return checkSourceMaterialCommentThread(body, sourceId);
|
|
112
|
-
}
|
|
117
|
+
};
|
|
113
118
|
/**
|
|
114
119
|
* Add one remark to a file's thread
|
|
115
120
|
* (`POST /api/v1/source-material/{batchId}/sources/{sourceId}/comments`).
|
|
@@ -125,7 +130,7 @@ export async function listSourceMaterialComments(transport, batchId, sourceId, s
|
|
|
125
130
|
* The result is discriminated on `kind`: switch on it rather than reaching for
|
|
126
131
|
* `replies`, which a `reply` does not have.
|
|
127
132
|
*/
|
|
128
|
-
export async
|
|
133
|
+
export const postSourceMaterialComment = async (transport, batchId, sourceId, input, signal) => {
|
|
129
134
|
const body = await transport.requestJson(runOperation("post_source_material_comment"), {
|
|
130
135
|
// Built key by key rather than spread: `parentCommentId` and
|
|
131
136
|
// `idempotencyKey` are forwarded only when PRESENT, so a caller that
|
|
@@ -145,20 +150,16 @@ export async function postSourceMaterialComment(transport, batchId, sourceId, in
|
|
|
145
150
|
signal,
|
|
146
151
|
});
|
|
147
152
|
return checkPostSourceMaterialCommentResult(body, sourceId);
|
|
148
|
-
}
|
|
153
|
+
};
|
|
149
154
|
/** List invocable agents, workflows, and tools (`GET /api/v1/capabilities`). */
|
|
150
|
-
export
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
+
export const capabilities = async (transport, signal) => await transport.requestJson(runOperation("list_public_capabilities"), {
|
|
156
|
+
signal,
|
|
157
|
+
});
|
|
155
158
|
/** Start an asynchronous capability Run (`POST /api/v1/runs`). */
|
|
156
|
-
export
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
});
|
|
161
|
-
}
|
|
159
|
+
export const createRun = async (transport, body, signal) => await transport.requestJson(runOperation("create_public_run"), {
|
|
160
|
+
body,
|
|
161
|
+
signal,
|
|
162
|
+
});
|
|
162
163
|
/**
|
|
163
164
|
* List your own Runs, newest first (`GET /api/v1/runs`).
|
|
164
165
|
*
|
|
@@ -172,42 +173,22 @@ export function createRun(transport, body, signal) {
|
|
|
172
173
|
* Page by following `nextCursor` until it is ABSENT — a full page is not the
|
|
173
174
|
* signal to stop, and an absent cursor is the only one.
|
|
174
175
|
*/
|
|
175
|
-
export
|
|
176
|
+
export const listRuns = async (transport, options = {}) => {
|
|
176
177
|
const query = {
|
|
177
178
|
...(options.status === undefined ? {} : { status: options.status }),
|
|
178
179
|
...(options.limit === undefined ? {} : { limit: options.limit }),
|
|
179
180
|
...(options.cursor === undefined ? {} : { cursor: options.cursor }),
|
|
180
181
|
};
|
|
181
|
-
return transport.requestJson(runOperation("list_public_runs"), {
|
|
182
|
+
return await transport.requestJson(runOperation("list_public_runs"), {
|
|
182
183
|
...(Object.keys(query).length > 0 ? { query } : {}),
|
|
183
184
|
...(options.signal ? { signal: options.signal } : {}),
|
|
184
185
|
});
|
|
185
|
-
}
|
|
186
|
+
};
|
|
186
187
|
/** Get a Run's current state (`GET /api/v1/runs/{runId}`). */
|
|
187
|
-
export
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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
|
-
}
|
|
188
|
+
export const getRun = async (transport, runId, signal) => await transport.requestJson(runOperation("get_public_run"), {
|
|
189
|
+
pathParams: { runId },
|
|
190
|
+
signal,
|
|
191
|
+
});
|
|
211
192
|
/**
|
|
212
193
|
* Normalise `resumeRun`'s overloaded third argument.
|
|
213
194
|
*
|
|
@@ -219,11 +200,12 @@ export function getRunSchedule(transport, runId, options = {}) {
|
|
|
219
200
|
* `{ signal }` with no `stepId` is a perfectly valid options object, and a
|
|
220
201
|
* key-presence test would misread it as a signal and silently drop the abort.
|
|
221
202
|
*/
|
|
222
|
-
|
|
223
|
-
if (value === undefined)
|
|
203
|
+
const resumeOptions = (value) => {
|
|
204
|
+
if (value === undefined) {
|
|
224
205
|
return {};
|
|
206
|
+
}
|
|
225
207
|
return value instanceof AbortSignal ? { signal: value } : value;
|
|
226
|
-
}
|
|
208
|
+
};
|
|
227
209
|
/**
|
|
228
210
|
* Resume a suspended Run (`POST /api/v1/runs/{runId}/resume`).
|
|
229
211
|
*
|
|
@@ -241,26 +223,25 @@ function resumeOptions(value) {
|
|
|
241
223
|
* `JSON.stringify` drops both — so the distinction here is construction
|
|
242
224
|
* intent, kept so the serialised body is provably unchanged for old callers.
|
|
243
225
|
*/
|
|
244
|
-
export
|
|
226
|
+
export const resumeRun = async (transport, runId, resumeData, signalOrOptions) => {
|
|
245
227
|
const { stepId, signal } = resumeOptions(signalOrOptions);
|
|
246
|
-
return transport.requestJson(runOperation("resume_public_run"), {
|
|
247
|
-
body: { resumeData, ...(stepId
|
|
228
|
+
return await transport.requestJson(runOperation("resume_public_run"), {
|
|
229
|
+
body: { resumeData, ...(stepId === undefined ? {} : { stepId }) },
|
|
248
230
|
pathParams: { runId },
|
|
249
231
|
signal,
|
|
250
232
|
});
|
|
251
|
-
}
|
|
233
|
+
};
|
|
252
234
|
/** Request durable Run cancellation (`POST /api/v1/runs/{runId}/cancel`). */
|
|
253
|
-
export
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
});
|
|
259
|
-
}
|
|
235
|
+
export const cancelRun = async (transport, runId, signal) => await transport.requestJson(runOperation("cancel_public_run"), {
|
|
236
|
+
body: {},
|
|
237
|
+
pathParams: { runId },
|
|
238
|
+
signal,
|
|
239
|
+
});
|
|
260
240
|
/** Decode one SSE `data:` frame into a {@link RunEvent}, or `null` when unusable. */
|
|
261
|
-
|
|
262
|
-
if (data.length === 0)
|
|
241
|
+
const decodeRunEvent = (data) => {
|
|
242
|
+
if (data.length === 0) {
|
|
263
243
|
return null;
|
|
244
|
+
}
|
|
264
245
|
let parsed;
|
|
265
246
|
try {
|
|
266
247
|
parsed = JSON.parse(data);
|
|
@@ -268,13 +249,15 @@ function decodeRunEvent(data) {
|
|
|
268
249
|
catch (cause) {
|
|
269
250
|
throw MaterialGraphError.unexpected(`MaterialGraph run-event stream sent an unparseable data frame: ${String(cause)}`);
|
|
270
251
|
}
|
|
271
|
-
if (typeof parsed !== "object" || parsed === null)
|
|
252
|
+
if (typeof parsed !== "object" || parsed === null) {
|
|
272
253
|
return null;
|
|
254
|
+
}
|
|
273
255
|
const record = parsed;
|
|
274
|
-
if (typeof record.sequence !== "number" || typeof record.type !== "string")
|
|
256
|
+
if (typeof record.sequence !== "number" || typeof record.type !== "string") {
|
|
275
257
|
return null;
|
|
258
|
+
}
|
|
276
259
|
return parsed;
|
|
277
|
-
}
|
|
260
|
+
};
|
|
278
261
|
/**
|
|
279
262
|
* Stream ordered Run events as an async iterator (`GET
|
|
280
263
|
* /api/v1/runs/{runId}/events`, SSE). Iterates until the stream ends or
|
|
@@ -293,8 +276,9 @@ export async function* streamRunEvents(transport, runId, options = {}) {
|
|
|
293
276
|
});
|
|
294
277
|
for await (const frame of readSseFrames(body, options.signal)) {
|
|
295
278
|
const event = decodeRunEvent(frame.data);
|
|
296
|
-
if (event)
|
|
279
|
+
if (event) {
|
|
297
280
|
yield event;
|
|
281
|
+
}
|
|
298
282
|
}
|
|
299
283
|
}
|
|
300
284
|
/**
|
|
@@ -312,30 +296,34 @@ export async function* streamRunEvents(transport, runId, options = {}) {
|
|
|
312
296
|
* failure (a real 4xx/5xx or transport error) still propagates, keeping the
|
|
313
297
|
* fail-fast surface for genuine upstream problems.
|
|
314
298
|
*/
|
|
315
|
-
export async
|
|
299
|
+
export const drainRunEvents = async (transport, runId, options) => {
|
|
316
300
|
const collected = [];
|
|
317
301
|
const controller = new AbortController();
|
|
318
|
-
const timer = setTimeout(() =>
|
|
302
|
+
const timer = setTimeout(() => {
|
|
303
|
+
controller.abort();
|
|
304
|
+
}, options.deadlineMs);
|
|
319
305
|
try {
|
|
320
306
|
for await (const event of streamRunEvents(transport, runId, {
|
|
321
307
|
after: options.after,
|
|
322
308
|
signal: controller.signal,
|
|
323
309
|
})) {
|
|
324
310
|
collected.push(event);
|
|
325
|
-
if (TERMINAL_RUN_EVENT_TYPES.has(event.type))
|
|
311
|
+
if (TERMINAL_RUN_EVENT_TYPES.has(event.type)) {
|
|
326
312
|
break;
|
|
313
|
+
}
|
|
327
314
|
}
|
|
328
315
|
}
|
|
329
316
|
catch (error) {
|
|
330
317
|
const causedByDeadline = controller.signal.aborted &&
|
|
331
318
|
error instanceof MaterialGraphError &&
|
|
332
319
|
error.kind === "aborted";
|
|
333
|
-
if (!causedByDeadline)
|
|
320
|
+
if (!causedByDeadline) {
|
|
334
321
|
throw error;
|
|
322
|
+
}
|
|
335
323
|
}
|
|
336
324
|
finally {
|
|
337
325
|
clearTimeout(timer);
|
|
338
326
|
controller.abort();
|
|
339
327
|
}
|
|
340
328
|
return collected;
|
|
341
|
-
}
|
|
329
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
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
|
|
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:
|
|
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
|
|
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
|
|
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
|
|
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
|
|
78
|
+
};
|
|
79
|
+
export type SamplizeLrvObservation = {
|
|
80
80
|
field: string;
|
|
81
81
|
value: number;
|
|
82
|
-
}
|
|
83
|
-
export
|
|
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
|
|
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
|
+
};
|
package/samplize-colorvec.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
24
|
+
};
|
|
25
|
+
export type SamplizeColorVecInput = {
|
|
26
26
|
hex?: string;
|
|
27
27
|
reference?: string;
|
|
28
|
-
palette?:
|
|
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
|
|
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
|
|
51
|
+
export declare const createSamplizeColorVecIndex: (cache: SamplizeColorVecCache) => {
|
|
52
52
|
search(input: SamplizeColorVecInput): {
|
|
53
|
-
|
|
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
|
-
|
|
68
|
+
sourceVersion: string;
|
|
69
69
|
};
|
|
70
70
|
};
|