@seekora-ai/search-sdk 0.2.15 → 0.2.17
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/client.d.ts +4 -17
- package/dist/client.js +21 -136
- package/dist/generated/api.d.ts +1679 -11946
- package/dist/generated/api.js +1020 -2217
- package/dist/generated/base.d.ts +1 -1
- package/dist/generated/base.js +1 -1
- package/dist/generated/common.d.ts +1 -1
- package/dist/generated/common.js +1 -1
- package/dist/generated/configuration.d.ts +1 -1
- package/dist/generated/configuration.js +1 -1
- package/dist/generated/index.d.ts +1 -1
- package/dist/generated/index.js +1 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Seekora SDK Client
|
|
3
3
|
* High-level wrapper around generated OpenAPI client
|
|
4
4
|
*/
|
|
5
|
-
import type { DataTypesIndexConfig, DataTypesEventPayload, DataTypesFiltersResponse, DataTypesFacetValuesSearchResponse, DataTypesFiltersSchemaResponse, DataTypesFilterField, DataTypesFilterValue, DataTypesFilterStats, DataTypesFilterSchemaField
|
|
5
|
+
import type { DataTypesIndexConfig, DataTypesEventPayload, DataTypesFiltersResponse, DataTypesFacetValuesSearchResponse, DataTypesFiltersSchemaResponse, DataTypesFilterField, DataTypesFilterValue, DataTypesFilterStats, DataTypesFilterSchemaField } from './generated';
|
|
6
6
|
import { type SeekoraEnvironment } from './config';
|
|
7
7
|
import { Logger, type LogLevel, type LoggerConfig } from './logger';
|
|
8
8
|
import { type ContextCollectorConfig, type BrowserContext } from './context-collector';
|
|
@@ -322,13 +322,9 @@ export declare class SeekoraClient {
|
|
|
322
322
|
private config;
|
|
323
323
|
private searchApi;
|
|
324
324
|
private suggestionsApi;
|
|
325
|
-
private suggestionsConfigApi;
|
|
326
325
|
private analyticsApi;
|
|
327
|
-
private
|
|
328
|
-
private documentsApi;
|
|
329
|
-
private schemaApi;
|
|
326
|
+
private storeManagementApi;
|
|
330
327
|
private filtersApi;
|
|
331
|
-
private experimentsApi;
|
|
332
328
|
private storeId;
|
|
333
329
|
private readSecret;
|
|
334
330
|
private writeSecret?;
|
|
@@ -403,7 +399,7 @@ export declare class SeekoraClient {
|
|
|
403
399
|
}): Promise<any[] | QuerySuggestionsFullResponse>;
|
|
404
400
|
/**
|
|
405
401
|
* Get query suggestions configuration (store-specific).
|
|
406
|
-
* Uses GET /api/v1/stores/{storeId}/query-suggestions/config via
|
|
402
|
+
* Uses GET /api/v1/stores/{storeId}/query-suggestions/config via StoreManagementApi.
|
|
407
403
|
*/
|
|
408
404
|
getSuggestionsConfig(): Promise<any>;
|
|
409
405
|
/**
|
|
@@ -411,15 +407,6 @@ export declare class SeekoraClient {
|
|
|
411
407
|
* Returns store search configuration and onboarding status
|
|
412
408
|
*/
|
|
413
409
|
getConfig(): Promise<DataTypesIndexConfig>;
|
|
414
|
-
/**
|
|
415
|
-
* Get experiment assignments for the current user
|
|
416
|
-
*
|
|
417
|
-
* Returns variant assignments for all running experiments.
|
|
418
|
-
* Uses hash-based consistent assignment on the backend.
|
|
419
|
-
*
|
|
420
|
-
* @returns ExperimentAssignmentResponse with assignments array
|
|
421
|
-
*/
|
|
422
|
-
getExperimentAssignment(): Promise<DataTypesExperimentAssignmentResponse>;
|
|
423
410
|
/**
|
|
424
411
|
* Get store information
|
|
425
412
|
* Returns store metadata including name, status, and configuration details
|
|
@@ -446,7 +433,7 @@ export declare class SeekoraClient {
|
|
|
446
433
|
updateConfig(config: Partial<DataTypesIndexConfig>): Promise<DataTypesIndexConfig>;
|
|
447
434
|
/**
|
|
448
435
|
* Update query suggestions configuration (requires write secret).
|
|
449
|
-
* Uses PUT /api/v1/stores/{xStoreID}/query-suggestions/config via
|
|
436
|
+
* Uses PUT /api/v1/stores/{xStoreID}/query-suggestions/config via StoreManagementApi.
|
|
450
437
|
*/
|
|
451
438
|
updateQuerySuggestionsConfig(config: any): Promise<any>;
|
|
452
439
|
/**
|
package/dist/client.js
CHANGED
|
@@ -94,13 +94,9 @@ class SeekoraClient {
|
|
|
94
94
|
// Initialize API clients
|
|
95
95
|
this.searchApi = new generated_1.SearchApi(this.config);
|
|
96
96
|
this.suggestionsApi = new generated_1.QuerySuggestionsApi(this.config);
|
|
97
|
-
this.suggestionsConfigApi = new generated_1.SDKQuerySuggestionsConfigApi(this.config);
|
|
98
97
|
this.analyticsApi = new generated_1.AnalyticsEventsApi(this.config);
|
|
99
|
-
this.
|
|
100
|
-
this.documentsApi = new generated_1.SDKDocumentsApi(this.config);
|
|
101
|
-
this.schemaApi = new generated_1.SDKSchemaApi(this.config);
|
|
98
|
+
this.storeManagementApi = new generated_1.StoreManagementApi(this.config);
|
|
102
99
|
this.filtersApi = new generated_1.FiltersApi(this.config);
|
|
103
|
-
this.experimentsApi = new generated_1.SDKExperimentsApi(this.config);
|
|
104
100
|
this.logger.info('SeekoraClient initialized successfully');
|
|
105
101
|
}
|
|
106
102
|
/**
|
|
@@ -175,7 +171,7 @@ class SeekoraClient {
|
|
|
175
171
|
// Log API request start
|
|
176
172
|
this.logger.verbose('Sending search API request', {
|
|
177
173
|
endpoint: '/api/v1/search',
|
|
178
|
-
method: '
|
|
174
|
+
method: 'GET',
|
|
179
175
|
storeId: this.storeId
|
|
180
176
|
});
|
|
181
177
|
// Build headers with personalization support
|
|
@@ -193,9 +189,7 @@ class SeekoraClient {
|
|
|
193
189
|
if (this.sessionId) {
|
|
194
190
|
headers['x-session-id'] = this.sessionId;
|
|
195
191
|
}
|
|
196
|
-
const response = await this.searchApi.
|
|
197
|
-
headers
|
|
198
|
-
});
|
|
192
|
+
const response = await this.searchApi.v1SearchGet(this.storeId, this.readSecret, searchRequest.q, this.userId, this.anonId, this.sessionId, searchRequest.page, searchRequest.per_page, searchRequest.sort, searchRequest.filter, searchRequest.facet_by, searchRequest.max_facet_values, searchRequest.widget_mode, searchRequest.include_suggestions, searchRequest.suggestions_limit, Array.isArray(searchRequest.analytics_tags) ? searchRequest.analytics_tags.join(',') : searchRequest.analytics_tags, Array.isArray(searchRequest.stopword_sets) ? searchRequest.stopword_sets.join(',') : searchRequest.stopword_sets, Array.isArray(searchRequest.synonym_sets) ? searchRequest.synonym_sets.join(',') : searchRequest.synonym_sets, searchRequest.search_fields, searchRequest.return_fields, searchRequest.omit_fields, searchRequest.snippet_fields, searchRequest.full_snippet_fields, searchRequest.field_weights, searchRequest.group_field, searchRequest.group_size, searchRequest.snippet_prefix, searchRequest.snippet_suffix, searchRequest.snippet_token_limit, searchRequest.snippet_min_len, searchRequest.include_snippets, searchRequest.prefix_mode, searchRequest.infix_mode, searchRequest.typo_max, searchRequest.typo_min_len_1, searchRequest.typo_min_len_2, searchRequest.search_timeout_ms, searchRequest.require_all_terms, searchRequest.exact_match_boost, searchRequest.cache_results, searchRequest.apply_rules, searchRequest.preset_name, searchRequest.facet_search_text, { headers });
|
|
199
193
|
// Log API response received
|
|
200
194
|
this.logger.verbose('Search API response received', {
|
|
201
195
|
status: response.status,
|
|
@@ -355,72 +349,7 @@ class SeekoraClient {
|
|
|
355
349
|
headers['x-anon-id'] = this.anonId;
|
|
356
350
|
if (this.sessionId)
|
|
357
351
|
headers['x-session-id'] = this.sessionId;
|
|
358
|
-
// Use POST for:
|
|
359
|
-
// - Complex filtered_tabs (5+ tabs or very long JSON would exceed URL limits)
|
|
360
|
-
// - Explicit preference for POST (options.method === 'POST')
|
|
361
|
-
// Use GET for everything else (including simple filtered_tabs)
|
|
362
|
-
const hasComplexFilteredTabs = options?.filtered_tabs &&
|
|
363
|
-
options.filtered_tabs.length > 5;
|
|
364
|
-
const usePost = hasComplexFilteredTabs ||
|
|
365
|
-
options?.method === 'POST'; // Allow explicit POST preference
|
|
366
352
|
const defaults = this.clientConfig?.suggestionsDefaults;
|
|
367
|
-
const buildRequestBody = () => {
|
|
368
|
-
const body = {
|
|
369
|
-
query,
|
|
370
|
-
hitsPerPage: options?.hitsPerPage ?? defaults?.hitsPerPage ?? 5,
|
|
371
|
-
page: options?.page,
|
|
372
|
-
include_categories: options?.include_categories,
|
|
373
|
-
include_facets: options?.include_facets,
|
|
374
|
-
max_categories: options?.max_categories,
|
|
375
|
-
max_facets: options?.max_facets,
|
|
376
|
-
min_popularity: options?.min_popularity,
|
|
377
|
-
time_range: options?.time_range ?? defaults?.time_range,
|
|
378
|
-
disable_typo_tolerance: options?.disable_typo_tolerance,
|
|
379
|
-
include_dropdown_recommendations: options?.include_dropdown_recommendations ?? defaults?.include_dropdown_recommendations,
|
|
380
|
-
include_dropdown_product_list: options?.include_dropdown_product_list ?? defaults?.include_dropdown_product_list,
|
|
381
|
-
include_filtered_tabs: options?.include_filtered_tabs ?? defaults?.include_filtered_tabs,
|
|
382
|
-
filtered_tabs: options?.filtered_tabs,
|
|
383
|
-
};
|
|
384
|
-
if (options?.analytics_tags) {
|
|
385
|
-
body.analytics_tags = Array.isArray(options.analytics_tags)
|
|
386
|
-
? options.analytics_tags
|
|
387
|
-
: [options.analytics_tags];
|
|
388
|
-
}
|
|
389
|
-
if (options?.tags_match_mode)
|
|
390
|
-
body.tags_match_mode = options.tags_match_mode;
|
|
391
|
-
return body;
|
|
392
|
-
};
|
|
393
|
-
if (usePost) {
|
|
394
|
-
this.logger.verbose('Using POST endpoint (filtered_tabs or include_dropdown_recommendations)', {
|
|
395
|
-
endpoint: '/api/v1/suggestions/queries',
|
|
396
|
-
query,
|
|
397
|
-
});
|
|
398
|
-
const requestBody = buildRequestBody();
|
|
399
|
-
const response = await this.suggestionsApi.v1SuggestionsQueriesPost(this.storeId, this.readSecret, this.userId, this.anonId, this.sessionId, requestBody, { headers });
|
|
400
|
-
const responseData = response.data?.data || response.data;
|
|
401
|
-
const suggestions = responseData?.results?.[0]?.hits || responseData?.hits || [];
|
|
402
|
-
const extensions = responseData?.results?.[1]?.extensions ?? responseData?.results?.[0]?.extensions;
|
|
403
|
-
if (options?.returnFullResponse) {
|
|
404
|
-
this.logger.info('Query suggestions retrieved (POST, full response)', {
|
|
405
|
-
query,
|
|
406
|
-
count: suggestions.length,
|
|
407
|
-
status: response.status,
|
|
408
|
-
});
|
|
409
|
-
return {
|
|
410
|
-
suggestions,
|
|
411
|
-
results: responseData?.results,
|
|
412
|
-
extensions: extensions ?? undefined,
|
|
413
|
-
raw: responseData,
|
|
414
|
-
};
|
|
415
|
-
}
|
|
416
|
-
this.logger.info('Query suggestions retrieved (POST)', {
|
|
417
|
-
query,
|
|
418
|
-
count: suggestions.length,
|
|
419
|
-
status: response.status,
|
|
420
|
-
});
|
|
421
|
-
return suggestions;
|
|
422
|
-
}
|
|
423
|
-
// GET for simple requests and simple filtered_tabs (URL-encoded JSON)
|
|
424
353
|
this.logger.verbose('Using GET endpoint', {
|
|
425
354
|
endpoint: '/api/v1/suggestions/queries',
|
|
426
355
|
query,
|
|
@@ -435,8 +364,8 @@ class SeekoraClient {
|
|
|
435
364
|
: undefined;
|
|
436
365
|
const response = await this.suggestionsApi.v1SuggestionsQueriesGet(this.storeId, this.readSecret, this.userId, this.anonId, this.sessionId, query, // query parameter
|
|
437
366
|
undefined, // q parameter (alias for query)
|
|
438
|
-
options?.hitsPerPage
|
|
439
|
-
options?.max_categories, options?.max_facets, options?.min_popularity, options?.time_range, options?.disable_typo_tolerance, filteredTabsParam, // filtered_tabs as JSON string
|
|
367
|
+
options?.hitsPerPage ?? defaults?.hitsPerPage ?? 5, options?.page, analyticsTags, options?.tags_match_mode, options?.include_categories, options?.include_facets, options?.include_dropdown_recommendations ?? defaults?.include_dropdown_recommendations, options?.include_dropdown_product_list ?? defaults?.include_dropdown_product_list, options?.include_filtered_tabs ?? defaults?.include_filtered_tabs, undefined, // include_empty_query_recommendations
|
|
368
|
+
options?.max_categories, options?.max_facets, options?.min_popularity, (options?.time_range ?? defaults?.time_range), options?.disable_typo_tolerance, filteredTabsParam, // filtered_tabs as JSON string
|
|
440
369
|
undefined, // userId (using header instead)
|
|
441
370
|
undefined, // anonId (using header instead)
|
|
442
371
|
undefined, // sessionId (using header instead)
|
|
@@ -471,7 +400,7 @@ class SeekoraClient {
|
|
|
471
400
|
}
|
|
472
401
|
/**
|
|
473
402
|
* Get query suggestions configuration (store-specific).
|
|
474
|
-
* Uses GET /api/v1/stores/{storeId}/query-suggestions/config via
|
|
403
|
+
* Uses GET /api/v1/stores/{storeId}/query-suggestions/config via StoreManagementApi.
|
|
475
404
|
*/
|
|
476
405
|
async getSuggestionsConfig() {
|
|
477
406
|
this.logger.verbose('Getting suggestions configuration');
|
|
@@ -481,7 +410,7 @@ class SeekoraClient {
|
|
|
481
410
|
'x-storesecret': this.readSecret,
|
|
482
411
|
};
|
|
483
412
|
try {
|
|
484
|
-
const response = await this.
|
|
413
|
+
const response = await this.storeManagementApi.apiV1StoresQuerySuggestionsConfigGet(this.storeId, this.readSecret, { headers });
|
|
485
414
|
const data = response.data?.data;
|
|
486
415
|
const config = data?.metadata?.config ?? data?.config ?? data;
|
|
487
416
|
this.logger.info('Suggestions configuration retrieved', {
|
|
@@ -531,7 +460,7 @@ class SeekoraClient {
|
|
|
531
460
|
if (this.sessionId) {
|
|
532
461
|
headers['x-session-id'] = this.sessionId;
|
|
533
462
|
}
|
|
534
|
-
const response = await this.
|
|
463
|
+
const response = await this.storeManagementApi.apiV1StoresConfigGet(this.storeId, this.readSecret, { headers });
|
|
535
464
|
const config = response.data?.data;
|
|
536
465
|
this.logger.info('Store configuration retrieved', {
|
|
537
466
|
status: response.status,
|
|
@@ -544,37 +473,6 @@ class SeekoraClient {
|
|
|
544
473
|
throw this.handleError(error, 'getConfig');
|
|
545
474
|
}
|
|
546
475
|
}
|
|
547
|
-
/**
|
|
548
|
-
* Get experiment assignments for the current user
|
|
549
|
-
*
|
|
550
|
-
* Returns variant assignments for all running experiments.
|
|
551
|
-
* Uses hash-based consistent assignment on the backend.
|
|
552
|
-
*
|
|
553
|
-
* @returns ExperimentAssignmentResponse with assignments array
|
|
554
|
-
*/
|
|
555
|
-
async getExperimentAssignment() {
|
|
556
|
-
this.logger.verbose('Getting experiment assignments');
|
|
557
|
-
try {
|
|
558
|
-
const headers = {
|
|
559
|
-
'x-storeid': this.storeId,
|
|
560
|
-
'x-storesecret': this.readSecret,
|
|
561
|
-
};
|
|
562
|
-
if (this.userId)
|
|
563
|
-
headers['x-user-id'] = this.userId;
|
|
564
|
-
if (this.anonId)
|
|
565
|
-
headers['x-anon-id'] = this.anonId;
|
|
566
|
-
const response = await this.experimentsApi.v1ExperimentsAssignmentGet(this.storeId, this.readSecret, this.userId, this.anonId, { headers });
|
|
567
|
-
const data = response.data;
|
|
568
|
-
this.logger.info('Experiment assignments retrieved', {
|
|
569
|
-
count: data?.assignments?.length ?? 0,
|
|
570
|
-
});
|
|
571
|
-
return data;
|
|
572
|
-
}
|
|
573
|
-
catch (error) {
|
|
574
|
-
this.logger.error('Failed to get experiment assignments', { error: error.message });
|
|
575
|
-
throw this.handleError(error, 'getExperimentAssignment');
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
476
|
/**
|
|
579
477
|
* Get store information
|
|
580
478
|
* Returns store metadata including name, status, and configuration details
|
|
@@ -661,7 +559,7 @@ class SeekoraClient {
|
|
|
661
559
|
'x-storesecret': this.readSecret,
|
|
662
560
|
'x-store-write-secret': this.writeSecret,
|
|
663
561
|
};
|
|
664
|
-
const response = await this.
|
|
562
|
+
const response = await this.storeManagementApi.apiV1StoresConfigPut(this.storeId, this.writeSecret, config, { headers });
|
|
665
563
|
const updatedConfig = response.data?.data;
|
|
666
564
|
this.logger.info('Store configuration updated successfully', {
|
|
667
565
|
status: response.status,
|
|
@@ -676,7 +574,7 @@ class SeekoraClient {
|
|
|
676
574
|
}
|
|
677
575
|
/**
|
|
678
576
|
* Update query suggestions configuration (requires write secret).
|
|
679
|
-
* Uses PUT /api/v1/stores/{xStoreID}/query-suggestions/config via
|
|
577
|
+
* Uses PUT /api/v1/stores/{xStoreID}/query-suggestions/config via StoreManagementApi.
|
|
680
578
|
*/
|
|
681
579
|
async updateQuerySuggestionsConfig(config) {
|
|
682
580
|
this.logger.verbose('Updating query suggestions configuration', { configKeys: Object.keys(config) });
|
|
@@ -694,7 +592,7 @@ class SeekoraClient {
|
|
|
694
592
|
'Content-Type': 'application/json',
|
|
695
593
|
};
|
|
696
594
|
try {
|
|
697
|
-
const response = await this.
|
|
595
|
+
const response = await this.storeManagementApi.apiV1StoresQuerySuggestionsConfigPut(this.storeId, this.writeSecret, config, { headers });
|
|
698
596
|
const data = response.data?.data;
|
|
699
597
|
const updatedConfig = data?.metadata?.config ?? data?.config ?? data;
|
|
700
598
|
this.logger.info('Query suggestions configuration updated successfully', {
|
|
@@ -705,7 +603,7 @@ class SeekoraClient {
|
|
|
705
603
|
}
|
|
706
604
|
catch (apiError) {
|
|
707
605
|
this.logger.verbose('PUT via generated API failed, using direct HTTP', { message: apiError?.message });
|
|
708
|
-
const axiosInstance = this.
|
|
606
|
+
const axiosInstance = this.storeManagementApi.axios ?? this.suggestionsApi.axios ?? axios_1.default;
|
|
709
607
|
const baseUrl = this.config.basePath ?? 'https://api.seekora.com/api';
|
|
710
608
|
const response = await axiosInstance.put(`${baseUrl}/v1/stores/${this.storeId}/query-suggestions/config`, config, { headers });
|
|
711
609
|
const data = response.data?.data;
|
|
@@ -728,7 +626,7 @@ class SeekoraClient {
|
|
|
728
626
|
async getConfigSchema() {
|
|
729
627
|
this.logger.verbose('Getting configuration schema');
|
|
730
628
|
try {
|
|
731
|
-
const response = await this.
|
|
629
|
+
const response = await this.storeManagementApi.apiV1StoresConfigSchemaGet(this.storeId, this.readSecret, {
|
|
732
630
|
headers: {
|
|
733
631
|
'x-storeid': this.storeId,
|
|
734
632
|
'x-storesecret': this.readSecret,
|
|
@@ -769,7 +667,7 @@ class SeekoraClient {
|
|
|
769
667
|
id: document.id,
|
|
770
668
|
data: document.data,
|
|
771
669
|
};
|
|
772
|
-
const response = await this.
|
|
670
|
+
const response = await this.storeManagementApi.apiV1StoresDocumentsPost(this.storeId, this.writeSecret, request);
|
|
773
671
|
const responseData = response.data?.data;
|
|
774
672
|
this.logger.info('Document indexed successfully', {
|
|
775
673
|
id: responseData?.id || document.id,
|
|
@@ -813,7 +711,7 @@ class SeekoraClient {
|
|
|
813
711
|
data: doc.data,
|
|
814
712
|
})),
|
|
815
713
|
};
|
|
816
|
-
const response = await this.
|
|
714
|
+
const response = await this.storeManagementApi.apiV1StoresDocumentsBulkPost(this.storeId, this.writeSecret, request);
|
|
817
715
|
const responseData = response.data?.data;
|
|
818
716
|
this.logger.info('Bulk document indexing completed', {
|
|
819
717
|
successCount: responseData?.successCount || 0,
|
|
@@ -857,7 +755,7 @@ class SeekoraClient {
|
|
|
857
755
|
throw new Error('Write secret is required for deleteDocument');
|
|
858
756
|
}
|
|
859
757
|
try {
|
|
860
|
-
const response = await this.
|
|
758
|
+
const response = await this.storeManagementApi.apiV1StoresDocumentsDocumentIDDelete(this.storeId, this.writeSecret, documentId);
|
|
861
759
|
this.logger.info('Document deleted successfully', {
|
|
862
760
|
documentId,
|
|
863
761
|
status: response.status
|
|
@@ -935,7 +833,7 @@ class SeekoraClient {
|
|
|
935
833
|
default_sorting_field: request.defaultSortingField,
|
|
936
834
|
enable_nested_fields: request.enableNestedFields,
|
|
937
835
|
};
|
|
938
|
-
const response = await this.
|
|
836
|
+
const response = await this.storeManagementApi.apiV1StoresSchemaPost(this.storeId, this.writeSecret, apiRequest);
|
|
939
837
|
const responseData = response.data;
|
|
940
838
|
this.logger.info('Schema created/updated successfully', {
|
|
941
839
|
name: responseData.data?.name,
|
|
@@ -976,7 +874,7 @@ class SeekoraClient {
|
|
|
976
874
|
async getSchema() {
|
|
977
875
|
this.logger.verbose('Getting schema', { storeId: this.storeId });
|
|
978
876
|
try {
|
|
979
|
-
const response = await this.
|
|
877
|
+
const response = await this.storeManagementApi.apiV1StoresSchemaGet(this.storeId, this.readSecret);
|
|
980
878
|
const responseData = response.data;
|
|
981
879
|
this.logger.info('Schema retrieved successfully', {
|
|
982
880
|
name: responseData.data?.name,
|
|
@@ -1027,7 +925,7 @@ class SeekoraClient {
|
|
|
1027
925
|
throw new Error('Write secret is required for clearDocuments');
|
|
1028
926
|
}
|
|
1029
927
|
try {
|
|
1030
|
-
const response = await this.
|
|
928
|
+
const response = await this.storeManagementApi.apiV1StoresDocumentsDelete(this.storeId, this.writeSecret);
|
|
1031
929
|
const responseData = response.data;
|
|
1032
930
|
this.logger.info('Documents cleared successfully', {
|
|
1033
931
|
deletedCount: responseData.data?.deleted_count
|
|
@@ -1836,14 +1734,7 @@ class SeekoraClient {
|
|
|
1836
1734
|
async getFilters(options) {
|
|
1837
1735
|
this.logger.verbose('Getting filters', { options });
|
|
1838
1736
|
try {
|
|
1839
|
-
const
|
|
1840
|
-
q: options?.q,
|
|
1841
|
-
filter: options?.filter,
|
|
1842
|
-
facet_by: options?.facetBy,
|
|
1843
|
-
max_facet_values: options?.maxFacetValues,
|
|
1844
|
-
disjunctive_facets: options?.disjunctiveFacets,
|
|
1845
|
-
};
|
|
1846
|
-
const response = await this.filtersApi.v1FiltersPost(this.storeId, this.readSecret, req);
|
|
1737
|
+
const response = await this.filtersApi.v1FiltersGet(this.storeId, this.readSecret, options?.q, options?.filter, options?.facetBy, options?.maxFacetValues, options?.disjunctiveFacets?.join(','));
|
|
1847
1738
|
const wrapper = response.data;
|
|
1848
1739
|
const data = wrapper?.data || response.data;
|
|
1849
1740
|
this.logger.info('Filters retrieved successfully', {
|
|
@@ -1868,13 +1759,7 @@ class SeekoraClient {
|
|
|
1868
1759
|
async searchFacetValues(facetName, options) {
|
|
1869
1760
|
this.logger.verbose('Searching facet values', { facetName, options });
|
|
1870
1761
|
try {
|
|
1871
|
-
const
|
|
1872
|
-
facet_query: options.facetQuery,
|
|
1873
|
-
q: options?.q,
|
|
1874
|
-
filter: options?.filter,
|
|
1875
|
-
max_values: options?.maxValues,
|
|
1876
|
-
};
|
|
1877
|
-
const response = await this.filtersApi.v1FiltersFacetNameValuesPost(this.storeId, this.readSecret, facetName, req);
|
|
1762
|
+
const response = await this.filtersApi.v1FiltersFacetNameValuesGet(this.storeId, this.readSecret, facetName, options.facetQuery, options?.q, options?.filter, options?.maxValues);
|
|
1878
1763
|
const wrapper = response.data;
|
|
1879
1764
|
const data = wrapper?.data || response.data;
|
|
1880
1765
|
this.logger.info('Facet values retrieved', {
|