@brytdesigns/shopify-ajax-predictive-search-api 1.0.5 → 3.0.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/dist/effect/index.d.ts +312 -104
- package/dist/effect/index.js +11 -9
- package/dist/effect/index.js.map +1 -1
- package/dist/effect/schema.js +108 -135
- package/dist/effect/schema.js.map +1 -1
- package/dist/main/effect/index.js +11 -9
- package/dist/main/effect/index.js.map +1 -1
- package/dist/main/effect/schema.js +108 -135
- package/dist/main/effect/schema.js.map +1 -1
- package/dist/main/index.d.ts +397 -177
- package/dist/main/index.js +59 -36
- package/dist/main/index.js.map +1 -1
- package/package.json +14 -11
- package/dist/esm/index.js +0 -18275
- package/dist/esm/index.js.map +0 -1
package/dist/main/index.d.ts
CHANGED
|
@@ -1,32 +1,150 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v9.5.1
|
|
2
2
|
|
|
3
|
+
import * as Cause from 'effect/Cause';
|
|
4
|
+
import * as Context from 'effect/Context';
|
|
5
|
+
import * as Data from 'effect/Data';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import { HttpClient } from 'effect/http';
|
|
8
|
+
import * as Layer from 'effect/Layer';
|
|
9
|
+
import * as LogLevel from 'effect/LogLevel';
|
|
10
|
+
import * as Pipeable from 'effect/Pipeable';
|
|
3
11
|
import * as Schema from 'effect/Schema';
|
|
12
|
+
import * as Scope from 'effect/Scope';
|
|
4
13
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
declare const Input: Schema.Struct<{
|
|
15
|
+
readonly sections: Schema.optional<Schema.decodeTo<Schema.String, Schema.$Array<Schema.String>, never, never>>;
|
|
16
|
+
readonly sections_url: Schema.optional<Schema.String>;
|
|
17
|
+
}>;
|
|
18
|
+
export type UniqueKeys<T extends string> = T extends `${infer K},${infer Rest}` ? K | UniqueKeys<Rest> : T;
|
|
19
|
+
declare function makeResponseSchema<const T extends string>(input: T): Schema.$Record<Schema.Literals<UniqueKeys<T>[]>, Schema.NullOr<Schema.decodeTo<Schema.instanceOf<Element, Element>, Schema.String, never, never>>>;
|
|
20
|
+
declare const Origins: Context.Reference<readonly string[]>;
|
|
21
|
+
declare const layer$1: (origins: readonly string[]) => Layer.Layer<never>;
|
|
22
|
+
export interface IShopifyRoutes {
|
|
23
|
+
readonly account_addresses_url: string;
|
|
24
|
+
readonly account_login_url: string;
|
|
25
|
+
readonly account_logout_url: string;
|
|
26
|
+
readonly account_recover_url: string;
|
|
27
|
+
readonly account_register_url: string;
|
|
28
|
+
readonly account_url: string;
|
|
29
|
+
readonly all_products_collection_url: string;
|
|
30
|
+
readonly product_url: string;
|
|
31
|
+
readonly products_url: string;
|
|
32
|
+
readonly cart_add_url: string;
|
|
33
|
+
readonly cart_change_url: string;
|
|
34
|
+
readonly cart_clear_url: string;
|
|
35
|
+
readonly cart_update_url: string;
|
|
36
|
+
readonly cart_url: string;
|
|
37
|
+
readonly collections_url: string;
|
|
38
|
+
readonly predictive_search_url: string;
|
|
39
|
+
readonly product_recommendations_url: string;
|
|
40
|
+
readonly root_url: string;
|
|
41
|
+
readonly search_url: string;
|
|
42
|
+
readonly storefront_login_url: string;
|
|
43
|
+
}
|
|
44
|
+
export interface IStorefrontClientConfig {
|
|
45
|
+
readonly accessToken: string;
|
|
46
|
+
readonly shopName: string;
|
|
47
|
+
apiVersion: string;
|
|
48
|
+
}
|
|
49
|
+
declare const Defaults: IShopifyRoutes;
|
|
50
|
+
declare class ShopifyRoutes extends Data.Class<IShopifyRoutes> {
|
|
51
|
+
constructor();
|
|
52
|
+
}
|
|
53
|
+
declare const make: () => ShopifyRoutes;
|
|
54
|
+
declare const Routes: Context.Reference<IShopifyRoutes>;
|
|
55
|
+
declare const layer$2: (routes: IShopifyRoutes) => Layer.Layer<never>;
|
|
56
|
+
declare class StorefrontClientConfig extends Data.Class<IStorefrontClientConfig> {
|
|
57
|
+
constructor();
|
|
58
|
+
}
|
|
59
|
+
declare const make$1: () => StorefrontClientConfig;
|
|
60
|
+
declare const Origin: Context.Reference<string>;
|
|
61
|
+
declare const layer$3: (origin: string) => Layer.Layer<never>;
|
|
62
|
+
declare namespace Sections {
|
|
63
|
+
export { Input, makeResponseSchema };
|
|
64
|
+
}
|
|
65
|
+
declare namespace StorefrontOrigin {
|
|
66
|
+
export { Origin, layer$3 as layer$3 };
|
|
67
|
+
}
|
|
68
|
+
declare namespace AllowedRouteOrigins {
|
|
69
|
+
export { Origins, layer$1 as layer$1 };
|
|
70
|
+
}
|
|
71
|
+
declare namespace ShopifyRoutes$1 {
|
|
72
|
+
export { Defaults, Routes, ShopifyRoutes, layer$2 as layer$2, make };
|
|
73
|
+
}
|
|
74
|
+
declare namespace StorefrontClientConfig$1 {
|
|
75
|
+
export { StorefrontClientConfig, make$1 as make$1 };
|
|
76
|
+
}
|
|
77
|
+
declare namespace Window$1 {
|
|
78
|
+
export { AllowedRouteOrigins, ShopifyRoutes$1 as ShopifyRoutes$1, StorefrontClientConfig$1 as StorefrontClientConfig$1, StorefrontOrigin };
|
|
79
|
+
}
|
|
80
|
+
declare namespace Ajax {
|
|
81
|
+
export { Sections, Window$1 as Window$1 };
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Every route's input extends Shopify's `sections` pair, decoded.
|
|
85
|
+
*
|
|
86
|
+
* Constraining the descriptor on this is what lets {@link execute} read
|
|
87
|
+
* `decodedInput.sections` and {@link withSections} write it without a cast.
|
|
88
|
+
*/
|
|
89
|
+
export type AjaxInput = typeof Ajax.Sections.Input.Type;
|
|
90
|
+
/**
|
|
91
|
+
* The same input, encoded — which is what a descriptor actually carries.
|
|
92
|
+
*
|
|
93
|
+
* Worth stating plainly because the two differ in a way that bites:
|
|
94
|
+
* `sections` decodes from `ReadonlyArray<string>` to a comma-joined `string`,
|
|
95
|
+
* so the encoded side is the array. A descriptor holds encoded input, so
|
|
96
|
+
* {@link withSections} takes the array form.
|
|
97
|
+
*/
|
|
98
|
+
export type AjaxInputEncoded = typeof Ajax.Sections.Input.Encoded;
|
|
99
|
+
declare const METHODS_BY_URL: {
|
|
100
|
+
readonly products_url: "get";
|
|
101
|
+
readonly product_url: "get";
|
|
102
|
+
readonly predictive_search_url: "get";
|
|
103
|
+
readonly product_recommendations_url: "get";
|
|
104
|
+
readonly cart_add_url: "post";
|
|
105
|
+
readonly cart_update_url: "post";
|
|
106
|
+
readonly cart_url: "get";
|
|
107
|
+
readonly cart_change_url: "post";
|
|
108
|
+
readonly cart_clear_url: "post";
|
|
109
|
+
};
|
|
110
|
+
export type ValidAjaxRoutes = keyof typeof METHODS_BY_URL;
|
|
111
|
+
declare const TypeIdSymbol: unique symbol;
|
|
112
|
+
export type TypeId = typeof TypeIdSymbol;
|
|
113
|
+
/**
|
|
114
|
+
* A description of a Shopify Ajax request, before it is run.
|
|
115
|
+
*
|
|
116
|
+
* The reason this type exists at all: headers, sections and input are consumed
|
|
117
|
+
* *inside* the request effect, so there is nothing to modify once that effect
|
|
118
|
+
* has been constructed. `pipe(getCart(), withHeaders(...))` can only work if
|
|
119
|
+
* the thing in the pipe is a description rather than an `Effect`. {@link execute}
|
|
120
|
+
* is where the description becomes one.
|
|
121
|
+
*/
|
|
122
|
+
export interface AjaxRequest<A extends AjaxInput, I extends AjaxInputEncoded, RD, B, J, SD> extends Pipeable.Pipeable {
|
|
123
|
+
readonly [TypeIdSymbol]: TypeId;
|
|
124
|
+
readonly routeName: ValidAjaxRoutes;
|
|
125
|
+
readonly inputSchema: Schema.Codec<A, I, RD>;
|
|
126
|
+
readonly outputSchema: (sections?: string) => Schema.Codec<B, J, SD>;
|
|
127
|
+
readonly input: I;
|
|
128
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
129
|
+
}
|
|
130
|
+
type Input$1 = Schema.Codec.Encoded<typeof Input$1>;
|
|
131
|
+
declare const Input$1: Schema.Struct<{
|
|
132
|
+
readonly sections: Schema.optional<Schema.decodeTo<Schema.String, Schema.$Array<Schema.String>, never, never>>;
|
|
133
|
+
readonly sections_url: Schema.optional<Schema.String>;
|
|
134
|
+
readonly q: Schema.String;
|
|
135
|
+
readonly resources: Schema.optional<Schema.Struct<{
|
|
136
|
+
readonly limit: Schema.withDecodingDefaultType<Schema.Number, never>;
|
|
137
|
+
readonly limit_scope: Schema.withDecodingDefaultType<Schema.Literals<readonly [
|
|
16
138
|
"all",
|
|
17
139
|
"each"
|
|
18
|
-
]>,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
options: Schema.optional<Schema.Struct<{
|
|
22
|
-
unavailable_products: Schema.optionalWith<Schema.Literal<[
|
|
140
|
+
]>, never>;
|
|
141
|
+
readonly options: Schema.optional<Schema.Struct<{
|
|
142
|
+
readonly unavailable_products: Schema.withDecodingDefaultType<Schema.Literals<readonly [
|
|
23
143
|
"show",
|
|
24
144
|
"hide",
|
|
25
145
|
"last"
|
|
26
|
-
]>,
|
|
27
|
-
|
|
28
|
-
}>;
|
|
29
|
-
fields: Schema.optional<Schema.transform<Schema.Array$<Schema.Literal<[
|
|
146
|
+
]>, never>;
|
|
147
|
+
readonly fields: Schema.optional<Schema.decodeTo<Schema.String, Schema.$Array<Schema.Literals<readonly [
|
|
30
148
|
"author",
|
|
31
149
|
"body",
|
|
32
150
|
"product_type",
|
|
@@ -36,17 +154,38 @@ declare const Input: Schema.extend<Schema.Struct<{
|
|
|
36
154
|
"variants.sku",
|
|
37
155
|
"variants.title",
|
|
38
156
|
"vendor"
|
|
39
|
-
]>>,
|
|
157
|
+
]>>, never, never>>;
|
|
40
158
|
}>>;
|
|
41
159
|
}>>;
|
|
42
|
-
}
|
|
160
|
+
}>;
|
|
43
161
|
declare namespace get {
|
|
44
|
-
type Input = Input;
|
|
162
|
+
type Input = Input$1;
|
|
45
163
|
}
|
|
46
|
-
declare const get: (input?:
|
|
164
|
+
declare const get: (input?: {
|
|
165
|
+
readonly q: string;
|
|
166
|
+
readonly resources?: {
|
|
167
|
+
readonly limit?: number | undefined;
|
|
168
|
+
readonly limit_scope?: "all" | "each" | undefined;
|
|
169
|
+
readonly options?: {
|
|
170
|
+
readonly unavailable_products?: "show" | "hide" | "last" | undefined;
|
|
171
|
+
readonly fields?: readonly ("author" | "body" | "product_type" | "tag" | "title" | "variants.barcode" | "variants.sku" | "variants.title" | "vendor")[] | undefined;
|
|
172
|
+
} | undefined;
|
|
173
|
+
} | undefined;
|
|
47
174
|
readonly sections?: readonly string[] | undefined;
|
|
48
175
|
readonly sections_url?: string | undefined;
|
|
49
|
-
}
|
|
176
|
+
} | undefined) => AjaxRequest<{
|
|
177
|
+
readonly q: string;
|
|
178
|
+
readonly resources?: {
|
|
179
|
+
readonly limit: number;
|
|
180
|
+
readonly limit_scope: "all" | "each";
|
|
181
|
+
readonly options?: {
|
|
182
|
+
readonly unavailable_products: "show" | "hide" | "last";
|
|
183
|
+
readonly fields?: string | undefined;
|
|
184
|
+
} | undefined;
|
|
185
|
+
} | undefined;
|
|
186
|
+
readonly sections?: string | undefined;
|
|
187
|
+
readonly sections_url?: string | undefined;
|
|
188
|
+
}, {
|
|
50
189
|
readonly q: string;
|
|
51
190
|
readonly resources?: {
|
|
52
191
|
readonly limit?: number | undefined;
|
|
@@ -56,33 +195,125 @@ declare const get: (input?: ({
|
|
|
56
195
|
readonly fields?: readonly ("author" | "body" | "product_type" | "tag" | "title" | "variants.barcode" | "variants.sku" | "variants.title" | "vendor")[] | undefined;
|
|
57
196
|
} | undefined;
|
|
58
197
|
} | undefined;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
readonly
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
readonly
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
readonly
|
|
78
|
-
|
|
198
|
+
readonly sections?: readonly string[] | undefined;
|
|
199
|
+
readonly sections_url?: string | undefined;
|
|
200
|
+
}, never, {
|
|
201
|
+
readonly resources: {
|
|
202
|
+
readonly results: {
|
|
203
|
+
readonly queries: readonly {
|
|
204
|
+
readonly url: string;
|
|
205
|
+
readonly text: string;
|
|
206
|
+
readonly styled_text: string;
|
|
207
|
+
}[];
|
|
208
|
+
readonly products: readonly {
|
|
209
|
+
readonly available: boolean;
|
|
210
|
+
readonly body: string;
|
|
211
|
+
readonly compare_at_price_max: number;
|
|
212
|
+
readonly compare_at_price_min: number;
|
|
213
|
+
readonly handle: string;
|
|
214
|
+
readonly id: string | number;
|
|
215
|
+
readonly image: string | null;
|
|
216
|
+
readonly price: number;
|
|
217
|
+
readonly price_max: number;
|
|
218
|
+
readonly price_min: number;
|
|
219
|
+
readonly tags: readonly string[];
|
|
220
|
+
readonly title: string;
|
|
221
|
+
readonly type: string;
|
|
222
|
+
readonly url: string;
|
|
223
|
+
readonly variants: readonly {
|
|
224
|
+
readonly available: boolean;
|
|
225
|
+
readonly compare_at_price: number | null;
|
|
226
|
+
readonly id: string | number;
|
|
227
|
+
readonly image: string | null;
|
|
228
|
+
readonly price: number;
|
|
79
229
|
readonly title: string;
|
|
80
|
-
readonly vendor: string | null;
|
|
81
230
|
readonly url: string;
|
|
231
|
+
readonly featured_image: {
|
|
232
|
+
readonly aspect_ratio: number | null;
|
|
233
|
+
readonly alt: string | null;
|
|
234
|
+
readonly height: number | null;
|
|
235
|
+
readonly url: string | null;
|
|
236
|
+
readonly width: number | null;
|
|
237
|
+
};
|
|
238
|
+
}[];
|
|
239
|
+
readonly vendor: string | null;
|
|
240
|
+
readonly featured_image: {
|
|
241
|
+
readonly aspect_ratio: number | null;
|
|
242
|
+
readonly alt: string | null;
|
|
243
|
+
readonly height: number | null;
|
|
244
|
+
readonly url: string | null;
|
|
245
|
+
readonly width: number | null;
|
|
246
|
+
};
|
|
247
|
+
}[];
|
|
248
|
+
readonly collections: readonly {
|
|
249
|
+
readonly body: string;
|
|
250
|
+
readonly handle: string;
|
|
251
|
+
readonly id: string | number;
|
|
252
|
+
readonly featured_image: {
|
|
253
|
+
readonly aspect_ratio: number | null;
|
|
254
|
+
readonly alt: string | null;
|
|
255
|
+
readonly height: number | null;
|
|
256
|
+
readonly url: string | null;
|
|
257
|
+
readonly width: number | null;
|
|
258
|
+
};
|
|
259
|
+
readonly published_at: Date;
|
|
260
|
+
readonly title: string;
|
|
261
|
+
readonly url: string;
|
|
262
|
+
}[];
|
|
263
|
+
readonly pages: readonly {
|
|
264
|
+
readonly author: string;
|
|
265
|
+
readonly body: string;
|
|
266
|
+
readonly handle: string;
|
|
267
|
+
readonly id: string | number;
|
|
268
|
+
readonly published_at: Date;
|
|
269
|
+
readonly title: string;
|
|
270
|
+
readonly url: string;
|
|
271
|
+
}[];
|
|
272
|
+
readonly articles: readonly {
|
|
273
|
+
readonly author: string;
|
|
274
|
+
readonly body: string;
|
|
275
|
+
readonly handle: string;
|
|
276
|
+
readonly id: string | number;
|
|
277
|
+
readonly published_at: Date;
|
|
278
|
+
readonly summary_html: string;
|
|
279
|
+
readonly tags: readonly string[];
|
|
280
|
+
readonly title: string;
|
|
281
|
+
readonly url: string;
|
|
282
|
+
}[];
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
}, {
|
|
286
|
+
readonly resources: {
|
|
287
|
+
readonly results: {
|
|
288
|
+
readonly queries?: readonly {
|
|
289
|
+
readonly url: string;
|
|
290
|
+
readonly text: string;
|
|
291
|
+
readonly styled_text: string;
|
|
292
|
+
}[] | undefined;
|
|
293
|
+
readonly products?: readonly {
|
|
294
|
+
readonly body: string;
|
|
295
|
+
readonly title: string;
|
|
296
|
+
readonly vendor: string | null;
|
|
297
|
+
readonly url: string;
|
|
298
|
+
readonly image: string | null;
|
|
299
|
+
readonly available: boolean;
|
|
300
|
+
readonly id: string | number;
|
|
301
|
+
readonly price: string;
|
|
302
|
+
readonly featured_image: {
|
|
303
|
+
readonly aspect_ratio: number | null;
|
|
304
|
+
readonly alt: string | null;
|
|
305
|
+
readonly height: number | null;
|
|
306
|
+
readonly url: string | null;
|
|
307
|
+
readonly width: number | null;
|
|
308
|
+
};
|
|
309
|
+
readonly variants: readonly {
|
|
82
310
|
readonly available: boolean;
|
|
311
|
+
readonly compare_at_price: string | null;
|
|
83
312
|
readonly id: string | number;
|
|
84
313
|
readonly image: string | null;
|
|
85
|
-
readonly price:
|
|
314
|
+
readonly price: string;
|
|
315
|
+
readonly title: string;
|
|
316
|
+
readonly url: string;
|
|
86
317
|
readonly featured_image: {
|
|
87
318
|
readonly aspect_ratio: number | null;
|
|
88
319
|
readonly alt: string | null;
|
|
@@ -90,21 +321,120 @@ declare const get: (input?: ({
|
|
|
90
321
|
readonly url: string | null;
|
|
91
322
|
readonly width: number | null;
|
|
92
323
|
};
|
|
324
|
+
}[];
|
|
325
|
+
readonly compare_at_price_max: string;
|
|
326
|
+
readonly compare_at_price_min: string;
|
|
327
|
+
readonly handle: string;
|
|
328
|
+
readonly price_max: string;
|
|
329
|
+
readonly price_min: string;
|
|
330
|
+
readonly type: string;
|
|
331
|
+
readonly tags?: readonly string[] | undefined;
|
|
332
|
+
}[] | undefined;
|
|
333
|
+
readonly collections?: readonly {
|
|
334
|
+
readonly body: string;
|
|
335
|
+
readonly handle: string;
|
|
336
|
+
readonly id: string | number;
|
|
337
|
+
readonly featured_image: {
|
|
338
|
+
readonly aspect_ratio: number | null;
|
|
339
|
+
readonly alt: string | null;
|
|
340
|
+
readonly height: number | null;
|
|
341
|
+
readonly url: string | null;
|
|
342
|
+
readonly width: number | null;
|
|
343
|
+
};
|
|
344
|
+
readonly published_at: string;
|
|
345
|
+
readonly title: string;
|
|
346
|
+
readonly url: string;
|
|
347
|
+
}[] | undefined;
|
|
348
|
+
readonly pages?: readonly {
|
|
349
|
+
readonly author: string;
|
|
350
|
+
readonly body: string;
|
|
351
|
+
readonly handle: string;
|
|
352
|
+
readonly id: string | number;
|
|
353
|
+
readonly published_at: string;
|
|
354
|
+
readonly title: string;
|
|
355
|
+
readonly url: string;
|
|
356
|
+
}[] | undefined;
|
|
357
|
+
readonly articles?: readonly {
|
|
358
|
+
readonly author: string;
|
|
359
|
+
readonly body: string;
|
|
360
|
+
readonly title: string;
|
|
361
|
+
readonly url: string;
|
|
362
|
+
readonly id: string | number;
|
|
363
|
+
readonly handle: string;
|
|
364
|
+
readonly published_at: string;
|
|
365
|
+
readonly summary_html: string;
|
|
366
|
+
readonly tags?: readonly string[] | undefined;
|
|
367
|
+
}[] | undefined;
|
|
368
|
+
};
|
|
369
|
+
};
|
|
370
|
+
}, never>;
|
|
371
|
+
export declare namespace createPredictiveSearchApi {
|
|
372
|
+
type Options = {
|
|
373
|
+
debug?: boolean;
|
|
374
|
+
/**
|
|
375
|
+
* Replaces the HTTP layer.
|
|
376
|
+
*
|
|
377
|
+
* The default is `AjaxClient.layer`, which is `fetch`. Overriding it is
|
|
378
|
+
* the only way to exercise this client without a network - the
|
|
379
|
+
* alternative was spying on the `layer` export, which tests how the
|
|
380
|
+
* module is wired rather than what it sends.
|
|
381
|
+
*/
|
|
382
|
+
httpClient?: Layer.Layer<HttpClient.HttpClient>;
|
|
383
|
+
};
|
|
384
|
+
type RequestOptions = {
|
|
385
|
+
signal?: AbortSignal;
|
|
386
|
+
headers?: Record<string, string>;
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Creates a predictive search client.
|
|
391
|
+
*
|
|
392
|
+
* `get` resolves to the decoded results and **rejects** on failure. There is no
|
|
393
|
+
* `{ data, error }` envelope: a non-200 rejects with `AjaxResponseError`, and
|
|
394
|
+
* transport, encode and decode failures reject with Effect's own tagged errors.
|
|
395
|
+
*
|
|
396
|
+
* @param options - Optional settings.
|
|
397
|
+
* @param options.debug - Enables request logging. Default `false`.
|
|
398
|
+
*/
|
|
399
|
+
export declare const createPredictiveSearchApi: ({ debug, httpClient, }?: createPredictiveSearchApi.Options) => {
|
|
400
|
+
/**
|
|
401
|
+
* Runs a predictive search.
|
|
402
|
+
*
|
|
403
|
+
* @param input - The query, and which resources to search.
|
|
404
|
+
* @param options - An `AbortSignal` to cancel with, and custom headers.
|
|
405
|
+
* @returns A Promise resolving to the decoded results.
|
|
406
|
+
*/
|
|
407
|
+
get: (input?: get.Input, options?: createPredictiveSearchApi.RequestOptions) => Promise<{
|
|
408
|
+
readonly resources: {
|
|
409
|
+
readonly results: {
|
|
410
|
+
readonly queries: readonly {
|
|
411
|
+
readonly url: string;
|
|
412
|
+
readonly text: string;
|
|
413
|
+
readonly styled_text: string;
|
|
414
|
+
}[];
|
|
415
|
+
readonly products: readonly {
|
|
416
|
+
readonly available: boolean;
|
|
417
|
+
readonly body: string;
|
|
93
418
|
readonly compare_at_price_max: number;
|
|
94
419
|
readonly compare_at_price_min: number;
|
|
95
420
|
readonly handle: string;
|
|
421
|
+
readonly id: string | number;
|
|
422
|
+
readonly image: string | null;
|
|
423
|
+
readonly price: number;
|
|
96
424
|
readonly price_max: number;
|
|
97
425
|
readonly price_min: number;
|
|
98
426
|
readonly tags: readonly string[];
|
|
427
|
+
readonly title: string;
|
|
99
428
|
readonly type: string;
|
|
429
|
+
readonly url: string;
|
|
100
430
|
readonly variants: readonly {
|
|
101
|
-
readonly title: string;
|
|
102
|
-
readonly url: string;
|
|
103
431
|
readonly available: boolean;
|
|
104
432
|
readonly compare_at_price: number | null;
|
|
105
433
|
readonly id: string | number;
|
|
106
434
|
readonly image: string | null;
|
|
107
435
|
readonly price: number;
|
|
436
|
+
readonly title: string;
|
|
437
|
+
readonly url: string;
|
|
108
438
|
readonly featured_image: {
|
|
109
439
|
readonly aspect_ratio: number | null;
|
|
110
440
|
readonly alt: string | null;
|
|
@@ -113,11 +443,18 @@ declare const get: (input?: ({
|
|
|
113
443
|
readonly width: number | null;
|
|
114
444
|
};
|
|
115
445
|
}[];
|
|
446
|
+
readonly vendor: string | null;
|
|
447
|
+
readonly featured_image: {
|
|
448
|
+
readonly aspect_ratio: number | null;
|
|
449
|
+
readonly alt: string | null;
|
|
450
|
+
readonly height: number | null;
|
|
451
|
+
readonly url: string | null;
|
|
452
|
+
readonly width: number | null;
|
|
453
|
+
};
|
|
116
454
|
}[];
|
|
117
455
|
readonly collections: readonly {
|
|
118
456
|
readonly body: string;
|
|
119
|
-
readonly
|
|
120
|
-
readonly url: string;
|
|
457
|
+
readonly handle: string;
|
|
121
458
|
readonly id: string | number;
|
|
122
459
|
readonly featured_image: {
|
|
123
460
|
readonly aspect_ratio: number | null;
|
|
@@ -126,149 +463,32 @@ declare const get: (input?: ({
|
|
|
126
463
|
readonly url: string | null;
|
|
127
464
|
readonly width: number | null;
|
|
128
465
|
};
|
|
129
|
-
readonly handle: string;
|
|
130
466
|
readonly published_at: Date;
|
|
467
|
+
readonly title: string;
|
|
468
|
+
readonly url: string;
|
|
131
469
|
}[];
|
|
132
470
|
readonly pages: readonly {
|
|
133
471
|
readonly author: string;
|
|
134
472
|
readonly body: string;
|
|
135
|
-
readonly title: string;
|
|
136
|
-
readonly url: string;
|
|
137
|
-
readonly id: string | number;
|
|
138
473
|
readonly handle: string;
|
|
474
|
+
readonly id: string | number;
|
|
139
475
|
readonly published_at: Date;
|
|
476
|
+
readonly title: string;
|
|
477
|
+
readonly url: string;
|
|
140
478
|
}[];
|
|
141
479
|
readonly articles: readonly {
|
|
142
480
|
readonly author: string;
|
|
143
481
|
readonly body: string;
|
|
144
|
-
readonly title: string;
|
|
145
|
-
readonly url: string;
|
|
146
|
-
readonly id: string | number;
|
|
147
482
|
readonly handle: string;
|
|
148
|
-
readonly
|
|
483
|
+
readonly id: string | number;
|
|
149
484
|
readonly published_at: Date;
|
|
150
485
|
readonly summary_html: string;
|
|
486
|
+
readonly tags: readonly string[];
|
|
487
|
+
readonly title: string;
|
|
488
|
+
readonly url: string;
|
|
151
489
|
}[];
|
|
152
490
|
};
|
|
153
491
|
};
|
|
154
|
-
} | undefined;
|
|
155
|
-
readonly error?: {
|
|
156
|
-
status: number;
|
|
157
|
-
message: string;
|
|
158
|
-
description?: string;
|
|
159
|
-
} | undefined;
|
|
160
|
-
}, Error, import("@effect/platform/HttpClient").HttpClient>;
|
|
161
|
-
export declare namespace createPredictiveSearchApi {
|
|
162
|
-
type Options = {
|
|
163
|
-
debug?: boolean;
|
|
164
|
-
};
|
|
165
|
-
type RequestOptions = {
|
|
166
|
-
signal?: AbortSignal;
|
|
167
|
-
headers?: Record<string, string>;
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
export declare const createPredictiveSearchApi: ({ debug }: {
|
|
171
|
-
debug?: boolean | undefined;
|
|
172
|
-
}) => {
|
|
173
|
-
get: (input: get.Input, options?: createPredictiveSearchApi.RequestOptions) => Promise<{
|
|
174
|
-
readonly data?: undefined;
|
|
175
|
-
readonly error?: {
|
|
176
|
-
status: number;
|
|
177
|
-
message: string;
|
|
178
|
-
description?: string;
|
|
179
|
-
} | undefined;
|
|
180
|
-
} | {
|
|
181
|
-
readonly data?: {
|
|
182
|
-
readonly resources: {
|
|
183
|
-
readonly results: {
|
|
184
|
-
readonly queries: readonly {
|
|
185
|
-
readonly url: string;
|
|
186
|
-
readonly text: string;
|
|
187
|
-
readonly styled_text: string;
|
|
188
|
-
}[];
|
|
189
|
-
readonly products: readonly {
|
|
190
|
-
readonly body: string;
|
|
191
|
-
readonly title: string;
|
|
192
|
-
readonly vendor: string | null;
|
|
193
|
-
readonly url: string;
|
|
194
|
-
readonly available: boolean;
|
|
195
|
-
readonly id: string | number;
|
|
196
|
-
readonly image: string | null;
|
|
197
|
-
readonly price: number;
|
|
198
|
-
readonly featured_image: {
|
|
199
|
-
readonly aspect_ratio: number | null;
|
|
200
|
-
readonly alt: string | null;
|
|
201
|
-
readonly height: number | null;
|
|
202
|
-
readonly url: string | null;
|
|
203
|
-
readonly width: number | null;
|
|
204
|
-
};
|
|
205
|
-
readonly compare_at_price_max: number;
|
|
206
|
-
readonly compare_at_price_min: number;
|
|
207
|
-
readonly handle: string;
|
|
208
|
-
readonly price_max: number;
|
|
209
|
-
readonly price_min: number;
|
|
210
|
-
readonly tags: readonly string[];
|
|
211
|
-
readonly type: string;
|
|
212
|
-
readonly variants: readonly {
|
|
213
|
-
readonly title: string;
|
|
214
|
-
readonly url: string;
|
|
215
|
-
readonly available: boolean;
|
|
216
|
-
readonly compare_at_price: number | null;
|
|
217
|
-
readonly id: string | number;
|
|
218
|
-
readonly image: string | null;
|
|
219
|
-
readonly price: number;
|
|
220
|
-
readonly featured_image: {
|
|
221
|
-
readonly aspect_ratio: number | null;
|
|
222
|
-
readonly alt: string | null;
|
|
223
|
-
readonly height: number | null;
|
|
224
|
-
readonly url: string | null;
|
|
225
|
-
readonly width: number | null;
|
|
226
|
-
};
|
|
227
|
-
}[];
|
|
228
|
-
}[];
|
|
229
|
-
readonly collections: readonly {
|
|
230
|
-
readonly body: string;
|
|
231
|
-
readonly title: string;
|
|
232
|
-
readonly url: string;
|
|
233
|
-
readonly id: string | number;
|
|
234
|
-
readonly featured_image: {
|
|
235
|
-
readonly aspect_ratio: number | null;
|
|
236
|
-
readonly alt: string | null;
|
|
237
|
-
readonly height: number | null;
|
|
238
|
-
readonly url: string | null;
|
|
239
|
-
readonly width: number | null;
|
|
240
|
-
};
|
|
241
|
-
readonly handle: string;
|
|
242
|
-
readonly published_at: Date;
|
|
243
|
-
}[];
|
|
244
|
-
readonly pages: readonly {
|
|
245
|
-
readonly author: string;
|
|
246
|
-
readonly body: string;
|
|
247
|
-
readonly title: string;
|
|
248
|
-
readonly url: string;
|
|
249
|
-
readonly id: string | number;
|
|
250
|
-
readonly handle: string;
|
|
251
|
-
readonly published_at: Date;
|
|
252
|
-
}[];
|
|
253
|
-
readonly articles: readonly {
|
|
254
|
-
readonly author: string;
|
|
255
|
-
readonly body: string;
|
|
256
|
-
readonly title: string;
|
|
257
|
-
readonly url: string;
|
|
258
|
-
readonly id: string | number;
|
|
259
|
-
readonly handle: string;
|
|
260
|
-
readonly tags: readonly string[];
|
|
261
|
-
readonly published_at: Date;
|
|
262
|
-
readonly summary_html: string;
|
|
263
|
-
}[];
|
|
264
|
-
};
|
|
265
|
-
};
|
|
266
|
-
} | undefined;
|
|
267
|
-
readonly error?: {
|
|
268
|
-
status: number;
|
|
269
|
-
message: string;
|
|
270
|
-
description?: string;
|
|
271
|
-
} | undefined;
|
|
272
492
|
}>;
|
|
273
493
|
};
|
|
274
494
|
|