@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.
- package/association-types.d.ts +38 -27
- package/associations-client.d.ts +4 -4
- package/associations-client.js +3 -10
- package/attribution-types.d.ts +4 -4
- package/brand-types.d.ts +14 -6
- package/brands-client.d.ts +7 -38
- package/brands-client.js +10 -40
- package/by-colour-types.d.ts +58 -31
- package/by-spec-types.d.ts +6 -73
- package/by-spec-types.js +7 -5
- package/catalog-discovery-types.d.ts +11 -26
- package/catalogue-client.d.ts +16 -35
- package/catalogue-client.js +32 -67
- package/catalogue-types.d.ts +44 -4
- package/categories-client.d.ts +63 -0
- package/categories-client.js +48 -0
- package/category-types.d.ts +114 -0
- package/citation-types.d.ts +4 -4
- package/client-config.d.ts +4 -6
- package/client-config.js +2 -4
- package/client-source-material-comments.d.ts +4 -4
- package/client-source-material-comments.js +4 -38
- package/client-vocabulary.d.ts +7 -9
- package/client-vocabulary.js +22 -30
- package/client.d.ts +110 -244
- package/client.js +217 -387
- package/codes-client.d.ts +2 -2
- package/codes-client.js +8 -8
- package/codes-types.d.ts +55 -34
- package/colour-aggregate-types.d.ts +24 -24
- package/colours-client.d.ts +6 -11
- package/colours-client.js +11 -19
- 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/demand-batch-types.d.ts +18 -18
- package/demand-types.d.ts +24 -24
- package/errors.d.ts +13 -13
- package/errors.js +54 -52
- package/http-transport.d.ts +13 -21
- package/http-transport.js +31 -28
- package/identify-types.d.ts +54 -44
- package/identify-types.js +5 -3
- package/index.d.ts +11 -27
- package/index.js +4 -6
- package/list-variant-facets-types.d.ts +60 -0
- package/list-variants-types.d.ts +142 -0
- package/list-variants-types.js +12 -0
- package/match-stream-types.d.ts +45 -32
- package/match-stream-types.js +2 -0
- package/match-stream.d.ts +2 -2
- package/match-stream.js +67 -49
- package/match-types.d.ts +32 -8
- package/material-asset-types.d.ts +89 -69
- package/material-block-types.d.ts +8 -6
- package/material-composition-client.d.ts +21 -0
- package/material-composition-client.js +13 -0
- package/material-composition-types.d.ts +403 -0
- package/material-query-plan-types.d.ts +61 -145
- package/material-resources-client.d.ts +12 -10
- package/material-resources-client.js +27 -22
- package/material-types.d.ts +16 -24
- package/ndjson.js +16 -8
- package/operations.d.ts +6 -6
- package/operations.js +29 -156
- package/package.json +5 -1
- package/palette-search-types.d.ts +87 -52
- package/query-understanding-types.d.ts +65 -40
- package/resolve-client.d.ts +8 -12
- package/resolve-client.js +9 -13
- package/resolve-colour-types.d.ts +8 -8
- package/resolve-types.d.ts +10 -10
- package/response-schemas.d.ts +20 -0
- package/response-schemas.generated.d.ts +5 -0
- package/response-schemas.generated.js +160 -0
- package/response-schemas.js +113 -0
- package/run-types.d.ts +64 -145
- package/runs.d.ts +9 -58
- package/runs.js +60 -149
- 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 +52 -39
- package/schema-resource-types.js +5 -5
- package/search-card-types.d.ts +26 -4
- package/search-index-plan-types.d.ts +70 -0
- package/search-refinement-types.d.ts +10 -40
- package/search-refinement-types.js +1 -0
- package/search-request-types.d.ts +121 -204
- package/search-response-receipt-types.d.ts +13 -253
- package/search-response-types.d.ts +2 -2
- package/search-result-validation.d.ts +3 -19
- package/search-result-validation.js +42 -183
- package/source-material-validation.d.ts +3 -3
- package/source-material-validation.js +35 -39
- package/spec-facet-types.d.ts +11 -16
- package/spec-types.d.ts +23 -16
- package/spec-types.js +8 -7
- package/specifications.d.ts +14 -72
- package/specifications.js +39 -89
- package/sse.d.ts +2 -2
- package/sse.js +32 -16
- package/substitute-types.d.ts +22 -22
- package/suggest-types.d.ts +11 -17
- package/suggest-types.js +3 -3
- package/taxonomy-coverage-types.d.ts +8 -8
- package/types.d.ts +202 -405
- package/validation.d.ts +26 -26
- package/validation.js +97 -92
- package/webmcp.d.ts +3 -3
- package/webmcp.generated.js +10 -93
- package/brand-most-sampled-types.d.ts +0 -33
- package/browse-types.d.ts +0 -236
- package/client-browse.d.ts +0 -78
- package/client-browse.js +0 -72
- package/client-exploration.d.ts +0 -9
- package/client-exploration.js +0 -7
- package/compare-types.d.ts +0 -89
- package/composition-client.d.ts +0 -33
- package/composition-client.js +0 -27
- package/composition-types.d.ts +0 -455
- package/composition-types.js +0 -10
- package/correction-types.d.ts +0 -88
- package/exploration-types.d.ts +0 -118
- package/exploration-types.js +0 -1
- package/fan-deck-types.d.ts +0 -42
- package/fan-deck-types.js +0 -9
- package/match-rejection-types.d.ts +0 -43
- package/match-rejection-types.js +0 -7
- package/palette-completion-types.d.ts +0 -115
- package/palette-completion-types.js +0 -1
- 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/render-assets-types.d.ts +0 -65
- package/render-assets-types.js +0 -1
- 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/search-collapse-types.d.ts +0 -69
- package/search-collapse-types.js +0 -1
- package/search-mood-types.d.ts +0 -6
- package/search-mood-types.js +0 -1
- package/search-window-types.d.ts +0 -25
- package/search-window-types.js +0 -1
- package/slot-pool-types.d.ts +0 -372
- package/slot-pool-types.js +0 -1
- /package/{brand-most-sampled-types.js → category-types.js} +0 -0
- /package/{browse-types.js → list-variant-facets-types.js} +0 -0
- /package/{compare-types.js → material-composition-types.js} +0 -0
- /package/{correction-types.js → search-index-plan-types.js} +0 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hand-mirrored wire types for the category tree surface
|
|
3
|
+
* (`GET /api/v1/categories` - `list_categories`, `GET /api/v1/categories/{id}` -
|
|
4
|
+
* `get_category`; MG-2226). Like the rest of the SDK these interfaces have NO
|
|
5
|
+
* runtime dependency on any `@materialgraph/*` package - they mirror the
|
|
6
|
+
* `listCategoriesInputSchema` / `listCategoriesResultSchema` /
|
|
7
|
+
* `getCategoryInputSchema` / `getCategoryResultSchema` Zod contracts the routes
|
|
8
|
+
* are built from.
|
|
9
|
+
*
|
|
10
|
+
* A category id is a TREE KEY (a product-type group or a product type, e.g.
|
|
11
|
+
* `"tile_surfaces"`), never a canonical `product_category` value (a termId such
|
|
12
|
+
* as `"wall_panel"`). The two vocabularies look alike and are not
|
|
13
|
+
* interchangeable, and a termId passed where an id belongs is refused, naming
|
|
14
|
+
* which it is. `get(id).productCategory` is where a category relates to its
|
|
15
|
+
* termIds; category filters elsewhere in the SDK take the id, never the termId.
|
|
16
|
+
*/
|
|
17
|
+
import type { OpenEnum } from "./types.js";
|
|
18
|
+
/** A category named by id, as in `ancestors` and `children`. */
|
|
19
|
+
export type CategoryRef = {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
};
|
|
23
|
+
export type CategoryKind = OpenEnum<"group" | "product_type">;
|
|
24
|
+
/**
|
|
25
|
+
* How one item matched a `query`: `exact` (the id or a name), `alias` (a
|
|
26
|
+
* phrase that names the category), `fuzzy` (a near spelling) or `vector`
|
|
27
|
+
* (similar meaning, from the served vocabulary embeddings). Earlier methods
|
|
28
|
+
* are surer; a page holds matches from one method only.
|
|
29
|
+
*/
|
|
30
|
+
export type CategoryMatch = {
|
|
31
|
+
/** The name, former name or phrase that matched. Null for `vector`, which compares meaning. */
|
|
32
|
+
matchedText: string | null;
|
|
33
|
+
method: OpenEnum<"exact" | "alias" | "fuzzy" | "vector">;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* One item on a `categories.list` page: what picks the next call. `get(id)`
|
|
37
|
+
* has the description, ancestors, children, names and concepts.
|
|
38
|
+
*/
|
|
39
|
+
export type CategoryItem = {
|
|
40
|
+
/** Whether `categories.list({ parentId: this.id })` lists anything. */
|
|
41
|
+
hasChildren: boolean;
|
|
42
|
+
/** A tree key, not a canonical `product_category` value. */
|
|
43
|
+
id: string;
|
|
44
|
+
/** Present only when the page answers a `query`. */
|
|
45
|
+
match?: CategoryMatch;
|
|
46
|
+
name: string;
|
|
47
|
+
/** The parent category's id, or null for a top-level category. */
|
|
48
|
+
parentId: string | null;
|
|
49
|
+
};
|
|
50
|
+
export type CategoriesPageInfo = {
|
|
51
|
+
/** Pass back as `cursor` with the same `query` and `parentId` for the next page. */
|
|
52
|
+
nextCursor: string | null;
|
|
53
|
+
returnedCount: number;
|
|
54
|
+
totalMatches: number;
|
|
55
|
+
};
|
|
56
|
+
export type CategoriesListInput = {
|
|
57
|
+
/** `pageInfo.nextCursor` from the previous page, with the same `query` and `parentId`. */
|
|
58
|
+
cursor?: string;
|
|
59
|
+
/** Items per page, 1 to 50. Default 20. */
|
|
60
|
+
limit?: number;
|
|
61
|
+
/** A category id. Alone, lists its children; with `query`, searches it and everything under it. */
|
|
62
|
+
parentId?: string;
|
|
63
|
+
/** A category name or description, e.g. `"wallpaper"` or `"beds"`. */
|
|
64
|
+
query?: string;
|
|
65
|
+
};
|
|
66
|
+
export type CategoriesListResult = {
|
|
67
|
+
items: CategoryItem[];
|
|
68
|
+
/** Present only when the query is refused as a category, and says why. */
|
|
69
|
+
notice?: string;
|
|
70
|
+
pageInfo: CategoriesPageInfo;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* One canonical taxonomy concept a category relates to. `termId` is the value
|
|
74
|
+
* a record's `product_category` attribute holds, not the category id. `match`
|
|
75
|
+
* is present only for product types: `exact` (the same thing), `close`,
|
|
76
|
+
* `broad` (the concept contains this type) or `narrow` (the concept is one
|
|
77
|
+
* kind within this type).
|
|
78
|
+
*/
|
|
79
|
+
export type CategoryConcept = {
|
|
80
|
+
label: string;
|
|
81
|
+
match?: OpenEnum<"exact" | "close" | "broad" | "narrow">;
|
|
82
|
+
termId: string;
|
|
83
|
+
uri: string;
|
|
84
|
+
};
|
|
85
|
+
export type CategoryProductCategory = {
|
|
86
|
+
concepts: CategoryConcept[];
|
|
87
|
+
/**
|
|
88
|
+
* The `product_category` value a record holds when the category alone
|
|
89
|
+
* decides it. Null for groups and for `conditional` or `unmapped` types.
|
|
90
|
+
*/
|
|
91
|
+
recordValue: string | null;
|
|
92
|
+
/**
|
|
93
|
+
* `mapped`: the category fixes its canonical concepts. `conditional`: each
|
|
94
|
+
* record's own data chooses between them. `unmapped`: no canonical concept
|
|
95
|
+
* fits yet.
|
|
96
|
+
*/
|
|
97
|
+
status: OpenEnum<"mapped" | "conditional" | "unmapped">;
|
|
98
|
+
};
|
|
99
|
+
export type CategoriesGetResult = {
|
|
100
|
+
/** Phrases that name this category in a `query`. */
|
|
101
|
+
aliases: string[];
|
|
102
|
+
/** The categories above this one, root first. Empty for a top-level category. */
|
|
103
|
+
ancestors: CategoryRef[];
|
|
104
|
+
/** The categories directly under this one, by name. */
|
|
105
|
+
children: CategoryRef[];
|
|
106
|
+
description: string | null;
|
|
107
|
+
/** Names this category carried before a rename; they still find it. */
|
|
108
|
+
formerNames: string[];
|
|
109
|
+
/** A tree key, not a canonical `product_category` value. */
|
|
110
|
+
id: string;
|
|
111
|
+
kind: CategoryKind;
|
|
112
|
+
name: string;
|
|
113
|
+
productCategory: CategoryProductCategory;
|
|
114
|
+
};
|
package/citation-types.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/** Small handle carried by a verdict cell. Resolve it only when evidence is opened. */
|
|
2
|
-
export
|
|
2
|
+
export type VerdictCitation = {
|
|
3
3
|
citationId: string;
|
|
4
4
|
sourceType: string;
|
|
5
5
|
count: number;
|
|
6
|
-
}
|
|
7
|
-
export
|
|
6
|
+
};
|
|
7
|
+
export type ResolvedVerdictCitation = {
|
|
8
8
|
citationId: string;
|
|
9
9
|
sourceType: string;
|
|
10
10
|
source: {
|
|
@@ -31,4 +31,4 @@ export interface ResolvedVerdictCitation {
|
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
|
-
}
|
|
34
|
+
};
|
package/client-config.d.ts
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Construction-time configuration for {@link MaterialGraphClient} and the
|
|
3
|
-
* published
|
|
2
|
+
* Construction-time configuration for {@link MaterialGraphClient} and the
|
|
3
|
+
* published constant callers read off it. Split out of `client.ts` so the
|
|
4
4
|
* client file carries lenses rather than setup.
|
|
5
5
|
*/
|
|
6
6
|
/** The hosted API origin the client talks to unless `baseUrl` overrides it. */
|
|
7
7
|
export declare const DEFAULT_BASE_URL = "https://beta.materialgraph.com";
|
|
8
|
-
|
|
9
|
-
export declare const MAX_BATCH_IDS = 100;
|
|
10
|
-
export interface MaterialGraphClientOptions {
|
|
8
|
+
export type MaterialGraphClientOptions = {
|
|
11
9
|
/** A `mg_read_*` API key, presented as `Authorization: Bearer <key>`. */
|
|
12
10
|
apiKey: string;
|
|
13
11
|
/** Override the API origin. Defaults to {@link DEFAULT_BASE_URL}. */
|
|
14
12
|
baseUrl?: string;
|
|
15
13
|
/** Inject a custom `fetch` (tests, proxies). Defaults to the global `fetch`. */
|
|
16
14
|
fetch?: typeof fetch;
|
|
17
|
-
}
|
|
15
|
+
};
|
package/client-config.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Construction-time configuration for {@link MaterialGraphClient} and the
|
|
3
|
-
* published
|
|
2
|
+
* Construction-time configuration for {@link MaterialGraphClient} and the
|
|
3
|
+
* published constant callers read off it. Split out of `client.ts` so the
|
|
4
4
|
* client file carries lenses rather than setup.
|
|
5
5
|
*/
|
|
6
6
|
/** The hosted API origin the client talks to unless `baseUrl` overrides it. */
|
|
7
7
|
export const DEFAULT_BASE_URL = "https://beta.materialgraph.com";
|
|
8
|
-
/** The server's per-call ceiling on batch material lookups, enforced client-side. */
|
|
9
|
-
export const MAX_BATCH_IDS = 100;
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
* namespace over a batch's files to rebuild what that read returns. Reach for
|
|
30
30
|
* `list` when you are watching a single file.
|
|
31
31
|
*/
|
|
32
|
-
import { HttpTransport } from "./http-transport.js";
|
|
32
|
+
import type { HttpTransport } from "./http-transport.js";
|
|
33
33
|
import type { PostSourceMaterialCommentInput, PostSourceMaterialCommentResult, SourceMaterialCommentThread } from "./run-types.js";
|
|
34
|
-
export
|
|
34
|
+
export type SourceMaterialCommentsNamespace = {
|
|
35
35
|
/**
|
|
36
36
|
* One file's thread, oldest root first, each root carrying its replies.
|
|
37
37
|
* `comments` is always an array; `truncated` says whether you are holding the
|
|
@@ -46,6 +46,6 @@ export interface SourceMaterialCommentsNamespace {
|
|
|
46
46
|
* permanent duplicate.
|
|
47
47
|
*/
|
|
48
48
|
post(batchId: string, sourceId: string, input: PostSourceMaterialCommentInput, signal?: AbortSignal): Promise<PostSourceMaterialCommentResult>;
|
|
49
|
-
}
|
|
49
|
+
};
|
|
50
50
|
/** Bind the comment operations to the client's shared transport. */
|
|
51
|
-
export declare
|
|
51
|
+
export declare const createSourceMaterialCommentsNamespace: (transport: HttpTransport) => SourceMaterialCommentsNamespace;
|
|
@@ -1,40 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The per-file comment surface, namespaced as `mg.sourceMaterialComments` — the
|
|
3
|
-
* argument people leave on one uploaded file (MG-1345).
|
|
4
|
-
*
|
|
5
|
-
* A namespace rather than two more flat methods on an already-large facade,
|
|
6
|
-
* following `mg.codes` and `mg.colours`: reading a thread and adding to it are
|
|
7
|
-
* one family, they share a `(batchId, sourceId)` referent, and neither makes
|
|
8
|
-
* sense without the other. The namespace holds no transport of its own — the
|
|
9
|
-
* client hands it the shared one, so auth, rate-limit accounting and error
|
|
10
|
-
* shaping stay in one place.
|
|
11
|
-
*
|
|
12
|
-
* TWO RULES A CONSUMER MUST NOT GET WRONG.
|
|
13
|
-
*
|
|
14
|
-
* **The author name is REPORTED, never verified.** Every comment carries
|
|
15
|
-
* `author.attribution: "reported"` — a name somebody typed — plus `recordedBy`,
|
|
16
|
-
* the authenticated principal that actually wrote the row. Render "recorded as
|
|
17
|
-
* from Ruth Fielding", never "Ruth Fielding said". The API takes a machine key,
|
|
18
|
-
* and the person whose argument a remark carries is usually not the person at
|
|
19
|
-
* the keyboard; presenting the one as the other is the failure this field
|
|
20
|
-
* exists to prevent.
|
|
21
|
-
*
|
|
22
|
-
* **A reply is not a root.** {@link SourceMaterialCommentsNamespace.post}
|
|
23
|
-
* returns a result discriminated on `kind`: switch on it rather than reaching
|
|
24
|
-
* for `replies`, which a `reply` does not have. Threads are one level deep and
|
|
25
|
-
* the database enforces it, so a reply can never grow replies of its own.
|
|
26
|
-
*
|
|
27
|
-
* ROUTING OUT OF THIS NAMESPACE. `mg.sourceMaterialBatch(batchId)` already
|
|
28
|
-
* inlines every file's thread, so opening a batch is ONE call — do not loop this
|
|
29
|
-
* namespace over a batch's files to rebuild what that read returns. Reach for
|
|
30
|
-
* `list` when you are watching a single file.
|
|
31
|
-
*/
|
|
32
|
-
import { HttpTransport } from "./http-transport.js";
|
|
33
1
|
import { listSourceMaterialComments, postSourceMaterialComment, } from "./runs.js";
|
|
34
2
|
/** Bind the comment operations to the client's shared transport. */
|
|
35
|
-
export
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
40
|
-
}
|
|
3
|
+
export const createSourceMaterialCommentsNamespace = (transport) => ({
|
|
4
|
+
list: async (batchId, sourceId, signal) => await listSourceMaterialComments(transport, batchId, sourceId, signal),
|
|
5
|
+
post: async (batchId, sourceId, input, signal) => await postSourceMaterialComment(transport, batchId, sourceId, input, signal),
|
|
6
|
+
});
|
package/client-vocabulary.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { HttpTransport } from "./http-transport.js";
|
|
2
|
-
import type {
|
|
3
|
-
export declare
|
|
4
|
-
export declare
|
|
5
|
-
export declare function suggestColour(transport: HttpTransport, q: string, options?: {
|
|
1
|
+
import type { HttpTransport } from "./http-transport.js";
|
|
2
|
+
import type { ListAttributesOptions, ListAttributesResult, ResolveColourOptions, ResolveColourResponse, SuggestColourResponse, SuggestOptions, SuggestResponse } from "./types.js";
|
|
3
|
+
export declare const resolveColour: (transport: HttpTransport, name: string, signal?: AbortSignal, options?: ResolveColourOptions) => Promise<ResolveColourResponse>;
|
|
4
|
+
export declare const suggestColour: (transport: HttpTransport, q: string, options?: {
|
|
6
5
|
limit?: number;
|
|
7
|
-
}, signal?: AbortSignal)
|
|
8
|
-
export declare
|
|
9
|
-
export declare
|
|
10
|
-
export declare function resolveAttributeValue(transport: HttpTransport, attributeId: string, query: string, options?: ResolveAttributeValueOptions, signal?: AbortSignal): Promise<ResolveAttributeValueResponse>;
|
|
6
|
+
}, signal?: AbortSignal) => Promise<SuggestColourResponse>;
|
|
7
|
+
export declare const suggest: (transport: HttpTransport, q: string, options?: SuggestOptions, signal?: AbortSignal) => Promise<SuggestResponse>;
|
|
8
|
+
export declare const listAttributes: (transport: HttpTransport, options?: ListAttributesOptions, signal?: AbortSignal) => Promise<ListAttributesResult>;
|
package/client-vocabulary.js
CHANGED
|
@@ -1,32 +1,24 @@
|
|
|
1
|
-
import { HttpTransport } from "./http-transport.js";
|
|
2
1
|
import { resolveOperation } from "./operations.js";
|
|
3
2
|
import { suggestQuery } from "./suggest-types.js";
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
export function resolveAttributeValue(transport, attributeId, query, options, signal) {
|
|
27
|
-
return transport.requestJson(resolveOperation("catalog_resolve_value"), {
|
|
28
|
-
query: { q: query, limit: options?.limit },
|
|
29
|
-
pathParams: { attributeId },
|
|
30
|
-
signal,
|
|
31
|
-
});
|
|
32
|
-
}
|
|
3
|
+
export const resolveColour = async (transport, name, signal, options) => await transport.requestJson(resolveOperation("resolve_colour_name"), { query: { corpusScope: options?.corpusScope, name }, signal });
|
|
4
|
+
export const suggestColour = async (transport, q, options, signal) => await transport.requestJson(resolveOperation("suggest_colour_names"), { query: { limit: options?.limit, q }, signal });
|
|
5
|
+
export const suggest = async (transport, q, options, signal) => await transport.requestJson(resolveOperation("search_suggest"), {
|
|
6
|
+
query: suggestQuery(q, options),
|
|
7
|
+
signal,
|
|
8
|
+
});
|
|
9
|
+
/**
|
|
10
|
+
* A comma list, or nothing at all for an empty one. `[].join(",")` is `""`, and
|
|
11
|
+
* an absent parameter is the one honest spelling of "no restriction".
|
|
12
|
+
*/
|
|
13
|
+
const commaList = (values) => values === undefined || values.length === 0 ? undefined : values.join(",");
|
|
14
|
+
export const listAttributes = async (transport, options, signal) => await transport.requestJson(resolveOperation("catalog_list_attributes"), {
|
|
15
|
+
query: {
|
|
16
|
+
blockIds: commaList(options?.blockIds),
|
|
17
|
+
categoryIds: commaList(options?.categoryIds),
|
|
18
|
+
cursor: options?.cursor,
|
|
19
|
+
filterableOnly: options?.filterableOnly,
|
|
20
|
+
limit: options?.limit,
|
|
21
|
+
query: options?.query,
|
|
22
|
+
},
|
|
23
|
+
signal,
|
|
24
|
+
});
|