@salesforce/lds-adapters-commerce-search 0.131.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/commerce-search.js +880 -0
  3. package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +66 -0
  4. package/dist/es/es2018/types/src/generated/adapters/getSuggestions.d.ts +29 -0
  5. package/dist/es/es2018/types/src/generated/adapters/productSearch.d.ts +34 -0
  6. package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +2 -0
  7. package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +5 -0
  8. package/dist/es/es2018/types/src/generated/resources/deleteCommerceManagementWebstoresSearchIndexesByIndexIdAndWebstoreId.d.ts +12 -0
  9. package/dist/es/es2018/types/src/generated/resources/getCommerceManagementWebstoresSearchAttributeSettingsFacetableFieldsByWebstoreId.d.ts +15 -0
  10. package/dist/es/es2018/types/src/generated/resources/getCommerceManagementWebstoresSearchAttributeSettingsSearchableFieldsByWebstoreId.d.ts +15 -0
  11. package/dist/es/es2018/types/src/generated/resources/getCommerceManagementWebstoresSearchIndexesByIndexIdAndWebstoreId.d.ts +16 -0
  12. package/dist/es/es2018/types/src/generated/resources/getCommerceManagementWebstoresSearchIndexesByWebstoreId.d.ts +15 -0
  13. package/dist/es/es2018/types/src/generated/resources/getCommerceManagementWebstoresSearchProductSettingsByWebstoreId.d.ts +18 -0
  14. package/dist/es/es2018/types/src/generated/resources/getCommerceWebstoresSearchSuggestionsByWebstoreId.d.ts +20 -0
  15. package/dist/es/es2018/types/src/generated/resources/patchCommerceManagementWebstoresSearchAttributeSettingsSearchableFieldsByWebstoreId.d.ts +12 -0
  16. package/dist/es/es2018/types/src/generated/resources/patchCommerceManagementWebstoresSearchProductSettingsByWebstoreId.d.ts +12 -0
  17. package/dist/es/es2018/types/src/generated/resources/postCommerceManagementWebstoresSearchIndexesByWebstoreId.d.ts +12 -0
  18. package/dist/es/es2018/types/src/generated/resources/postCommerceWebstoresSearchProductSearchByWebstoreId.d.ts +27 -0
  19. package/dist/es/es2018/types/src/generated/resources/putCommerceManagementWebstoresSearchAttributeSettingsFacetableFieldsByWebstoreId.d.ts +12 -0
  20. package/dist/es/es2018/types/src/generated/types/CommerceSearchIndexCollectionOutputRepresentation.d.ts +30 -0
  21. package/dist/es/es2018/types/src/generated/types/CommerceSearchIndexOutputRepresentation.d.ts +47 -0
  22. package/dist/es/es2018/types/src/generated/types/DistinctFacetValueRepresentation.d.ts +37 -0
  23. package/dist/es/es2018/types/src/generated/types/DistinctValueSearchFacetRepresentation.d.ts +32 -0
  24. package/dist/es/es2018/types/src/generated/types/FacetValueRepresentation.d.ts +34 -0
  25. package/dist/es/es2018/types/src/generated/types/FacetableAttributeInputRepresentation.d.ts +38 -0
  26. package/dist/es/es2018/types/src/generated/types/FacetableAttributeOutputRepresentation.d.ts +41 -0
  27. package/dist/es/es2018/types/src/generated/types/FacetableAttributesCollectionInputRepresentation.d.ts +29 -0
  28. package/dist/es/es2018/types/src/generated/types/FacetableAttributesCollectionOutputRepresentation.d.ts +30 -0
  29. package/dist/es/es2018/types/src/generated/types/ProductSearchInputRepresentation.d.ts +47 -0
  30. package/dist/es/es2018/types/src/generated/types/ProductSearchResultsRepresentation.d.ts +40 -0
  31. package/dist/es/es2018/types/src/generated/types/ProductSearchSuggestionsResultsRepresentation.d.ts +33 -0
  32. package/dist/es/es2018/types/src/generated/types/ProductSummaryCollectionRepresentation.d.ts +39 -0
  33. package/dist/es/es2018/types/src/generated/types/ProductSummaryRepresentation.d.ts +39 -0
  34. package/dist/es/es2018/types/src/generated/types/RefinementInputRepresentation.d.ts +32 -0
  35. package/dist/es/es2018/types/src/generated/types/SearchCategoryRepresentation.d.ts +32 -0
  36. package/dist/es/es2018/types/src/generated/types/SearchFacetRepresentation.d.ts +49 -0
  37. package/dist/es/es2018/types/src/generated/types/SearchProductSettingCollectionInputRepresentation.d.ts +29 -0
  38. package/dist/es/es2018/types/src/generated/types/SearchProductSettingCollectionOutputRepresentation.d.ts +30 -0
  39. package/dist/es/es2018/types/src/generated/types/SearchProductSettingInputRepresentation.d.ts +32 -0
  40. package/dist/es/es2018/types/src/generated/types/SearchProductSettingOutputRepresentation.d.ts +32 -0
  41. package/dist/es/es2018/types/src/generated/types/SearchableAttributeInputRepresentation.d.ts +35 -0
  42. package/dist/es/es2018/types/src/generated/types/SearchableAttributeOutputRepresentation.d.ts +35 -0
  43. package/dist/es/es2018/types/src/generated/types/SearchableAttributesCollectionInputRepresentation.d.ts +29 -0
  44. package/dist/es/es2018/types/src/generated/types/SearchableAttributesCollectionOutputRepresentation.d.ts +30 -0
  45. package/dist/es/es2018/types/src/generated/types/SuggestedCompletionRepresentation.d.ts +29 -0
  46. package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +39 -0
  47. package/package.json +54 -0
  48. package/sfdc/index.d.ts +1 -0
  49. package/sfdc/index.js +920 -0
  50. package/src/raml/api.raml +616 -0
  51. package/src/raml/luvio.raml +76 -0
@@ -0,0 +1,880 @@
1
+ /**
2
+ * Copyright (c) 2022, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ import { serializeStructuredKey, StoreKeyMap } from '@luvio/engine';
8
+
9
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
+ const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = Object;
11
+ const { isArray: ArrayIsArray$1 } = Array;
12
+ /**
13
+ * Validates an adapter config is well-formed.
14
+ * @param config The config to validate.
15
+ * @param adapter The adapter validation configuration.
16
+ * @param oneOf The keys the config must contain at least one of.
17
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
18
+ */
19
+ function validateConfig(config, adapter, oneOf) {
20
+ const { displayName } = adapter;
21
+ const { required, optional, unsupported } = adapter.parameters;
22
+ if (config === undefined ||
23
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
24
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
25
+ }
26
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
27
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
28
+ }
29
+ if (unsupported !== undefined &&
30
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
31
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
32
+ }
33
+ const supported = required.concat(optional);
34
+ if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
35
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
36
+ }
37
+ }
38
+ function untrustedIsObject(untrusted) {
39
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
40
+ }
41
+ function areRequiredParametersPresent(config, configPropertyNames) {
42
+ return configPropertyNames.parameters.required.every(req => req in config);
43
+ }
44
+ const snapshotRefreshOptions = {
45
+ overrides: {
46
+ headers: {
47
+ 'Cache-Control': 'no-cache',
48
+ },
49
+ }
50
+ };
51
+ const keyPrefix = 'Commerce';
52
+
53
+ const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
54
+ const { isArray: ArrayIsArray } = Array;
55
+ const { stringify: JSONStringify } = JSON;
56
+ function createLink(ref) {
57
+ return {
58
+ __ref: serializeStructuredKey(ref),
59
+ };
60
+ }
61
+
62
+ function validate$6(obj, path = 'SearchCategoryRepresentation') {
63
+ const v_error = (() => {
64
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
65
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
66
+ }
67
+ const obj_children = obj.children;
68
+ const path_children = path + '.children';
69
+ if (!ArrayIsArray(obj_children)) {
70
+ return new TypeError('Expected "array" but received "' + typeof obj_children + '" (at "' + path_children + '")');
71
+ }
72
+ for (let i = 0; i < obj_children.length; i++) {
73
+ const obj_children_item = obj_children[i];
74
+ const path_children_item = path_children + '[' + i + ']';
75
+ const referencepath_children_itemValidationError = validate$6(obj_children_item, path_children_item);
76
+ if (referencepath_children_itemValidationError !== null) {
77
+ let message = 'Object doesn\'t match SearchCategoryRepresentation (at "' + path_children_item + '")\n';
78
+ message += referencepath_children_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
79
+ return new TypeError(message);
80
+ }
81
+ }
82
+ const obj_productCount = obj.productCount;
83
+ const path_productCount = path + '.productCount';
84
+ if (typeof obj_productCount !== 'number' || (typeof obj_productCount === 'number' && Math.floor(obj_productCount) !== obj_productCount)) {
85
+ return new TypeError('Expected "integer" but received "' + typeof obj_productCount + '" (at "' + path_productCount + '")');
86
+ }
87
+ })();
88
+ return v_error === undefined ? null : v_error;
89
+ }
90
+ function deepFreeze$6(input) {
91
+ const input_children = input.children;
92
+ for (let i = 0; i < input_children.length; i++) {
93
+ const input_children_item = input_children[i];
94
+ deepFreeze$6(input_children_item);
95
+ }
96
+ ObjectFreeze(input_children);
97
+ ObjectFreeze(input);
98
+ }
99
+
100
+ var DiscriminatorValues$1;
101
+ (function (DiscriminatorValues) {
102
+ DiscriminatorValues["DistinctValue"] = "DistinctValue";
103
+ })(DiscriminatorValues$1 || (DiscriminatorValues$1 = {}));
104
+
105
+ var DiscriminatorValues;
106
+ (function (DiscriminatorValues) {
107
+ DiscriminatorValues["DistinctValue"] = "DistinctValue";
108
+ })(DiscriminatorValues || (DiscriminatorValues = {}));
109
+ function validate$5(obj, path = 'SearchFacetRepresentation') {
110
+ const v_error = (() => {
111
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
112
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
113
+ }
114
+ if (obj.attributeType !== undefined) {
115
+ const obj_attributeType = obj.attributeType;
116
+ const path_attributeType = path + '.attributeType';
117
+ if (typeof obj_attributeType !== 'string') {
118
+ return new TypeError('Expected "string" but received "' + typeof obj_attributeType + '" (at "' + path_attributeType + '")');
119
+ }
120
+ }
121
+ const obj_displayName = obj.displayName;
122
+ const path_displayName = path + '.displayName';
123
+ if (typeof obj_displayName !== 'string') {
124
+ return new TypeError('Expected "string" but received "' + typeof obj_displayName + '" (at "' + path_displayName + '")');
125
+ }
126
+ const obj_displayRank = obj.displayRank;
127
+ const path_displayRank = path + '.displayRank';
128
+ if (typeof obj_displayRank !== 'number' || (typeof obj_displayRank === 'number' && Math.floor(obj_displayRank) !== obj_displayRank)) {
129
+ return new TypeError('Expected "integer" but received "' + typeof obj_displayRank + '" (at "' + path_displayRank + '")');
130
+ }
131
+ const obj_displayType = obj.displayType;
132
+ const path_displayType = path + '.displayType';
133
+ if (typeof obj_displayType !== 'string') {
134
+ return new TypeError('Expected "string" but received "' + typeof obj_displayType + '" (at "' + path_displayType + '")');
135
+ }
136
+ if (obj.facetType !== undefined) {
137
+ const obj_facetType = obj.facetType;
138
+ const path_facetType = path + '.facetType';
139
+ if (typeof obj_facetType !== 'string') {
140
+ return new TypeError('Expected "string" but received "' + typeof obj_facetType + '" (at "' + path_facetType + '")');
141
+ }
142
+ }
143
+ const obj_nameOrId = obj.nameOrId;
144
+ const path_nameOrId = path + '.nameOrId';
145
+ if (typeof obj_nameOrId !== 'string') {
146
+ return new TypeError('Expected "string" but received "' + typeof obj_nameOrId + '" (at "' + path_nameOrId + '")');
147
+ }
148
+ })();
149
+ return v_error === undefined ? null : v_error;
150
+ }
151
+ function deepFreeze$5(input) {
152
+ ObjectFreeze(input);
153
+ }
154
+
155
+ function validate$4(obj, path = 'ProductSummaryRepresentation') {
156
+ const v_error = (() => {
157
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
158
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
159
+ }
160
+ const obj_fields = obj.fields;
161
+ const path_fields = path + '.fields';
162
+ if (typeof obj_fields !== 'object' || ArrayIsArray(obj_fields) || obj_fields === null) {
163
+ return new TypeError('Expected "object" but received "' + typeof obj_fields + '" (at "' + path_fields + '")');
164
+ }
165
+ const obj_fields_keys = ObjectKeys(obj_fields);
166
+ for (let i = 0; i < obj_fields_keys.length; i++) {
167
+ const key = obj_fields_keys[i];
168
+ const obj_fields_prop = obj_fields[key];
169
+ const path_fields_prop = path_fields + '["' + key + '"]';
170
+ let obj_fields_prop_union0 = null;
171
+ const obj_fields_prop_union0_error = (() => {
172
+ if (typeof obj_fields_prop !== 'string') {
173
+ return new TypeError('Expected "string" but received "' + typeof obj_fields_prop + '" (at "' + path_fields_prop + '")');
174
+ }
175
+ })();
176
+ if (obj_fields_prop_union0_error != null) {
177
+ obj_fields_prop_union0 = obj_fields_prop_union0_error.message;
178
+ }
179
+ let obj_fields_prop_union1 = null;
180
+ const obj_fields_prop_union1_error = (() => {
181
+ if (obj_fields_prop !== null) {
182
+ return new TypeError('Expected "null" but received "' + typeof obj_fields_prop + '" (at "' + path_fields_prop + '")');
183
+ }
184
+ })();
185
+ if (obj_fields_prop_union1_error != null) {
186
+ obj_fields_prop_union1 = obj_fields_prop_union1_error.message;
187
+ }
188
+ if (obj_fields_prop_union0 && obj_fields_prop_union1) {
189
+ let message = 'Object doesn\'t match union (at "' + path_fields_prop + '")';
190
+ message += '\n' + obj_fields_prop_union0.split('\n').map((line) => '\t' + line).join('\n');
191
+ message += '\n' + obj_fields_prop_union1.split('\n').map((line) => '\t' + line).join('\n');
192
+ return new TypeError(message);
193
+ }
194
+ }
195
+ const obj_id = obj.id;
196
+ const path_id = path + '.id';
197
+ if (typeof obj_id !== 'string') {
198
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
199
+ }
200
+ const obj_name = obj.name;
201
+ const path_name = path + '.name';
202
+ if (typeof obj_name !== 'string') {
203
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
204
+ }
205
+ })();
206
+ return v_error === undefined ? null : v_error;
207
+ }
208
+ function deepFreeze$4(input) {
209
+ const input_fields = input.fields;
210
+ const input_fields_keys = Object.keys(input_fields);
211
+ const input_fields_length = input_fields_keys.length;
212
+ for (let i = 0; i < input_fields_length; i++) {
213
+ input_fields_keys[i];
214
+ }
215
+ ObjectFreeze(input_fields);
216
+ ObjectFreeze(input);
217
+ }
218
+
219
+ function validate$3(obj, path = 'ProductSummaryCollectionRepresentation') {
220
+ const v_error = (() => {
221
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
222
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
223
+ }
224
+ const obj_currencyIsoCode = obj.currencyIsoCode;
225
+ const path_currencyIsoCode = path + '.currencyIsoCode';
226
+ if (typeof obj_currencyIsoCode !== 'string') {
227
+ return new TypeError('Expected "string" but received "' + typeof obj_currencyIsoCode + '" (at "' + path_currencyIsoCode + '")');
228
+ }
229
+ if (obj.pageSize !== undefined) {
230
+ const obj_pageSize = obj.pageSize;
231
+ const path_pageSize = path + '.pageSize';
232
+ if (typeof obj_pageSize !== 'number' || (typeof obj_pageSize === 'number' && Math.floor(obj_pageSize) !== obj_pageSize)) {
233
+ return new TypeError('Expected "integer" but received "' + typeof obj_pageSize + '" (at "' + path_pageSize + '")');
234
+ }
235
+ }
236
+ const obj_products = obj.products;
237
+ const path_products = path + '.products';
238
+ if (!ArrayIsArray(obj_products)) {
239
+ return new TypeError('Expected "array" but received "' + typeof obj_products + '" (at "' + path_products + '")');
240
+ }
241
+ for (let i = 0; i < obj_products.length; i++) {
242
+ const obj_products_item = obj_products[i];
243
+ const path_products_item = path_products + '[' + i + ']';
244
+ const referencepath_products_itemValidationError = validate$4(obj_products_item, path_products_item);
245
+ if (referencepath_products_itemValidationError !== null) {
246
+ let message = 'Object doesn\'t match ProductSummaryRepresentation (at "' + path_products_item + '")\n';
247
+ message += referencepath_products_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
248
+ return new TypeError(message);
249
+ }
250
+ }
251
+ const obj_total = obj.total;
252
+ const path_total = path + '.total';
253
+ if (typeof obj_total !== 'number' || (typeof obj_total === 'number' && Math.floor(obj_total) !== obj_total)) {
254
+ return new TypeError('Expected "integer" but received "' + typeof obj_total + '" (at "' + path_total + '")');
255
+ }
256
+ })();
257
+ return v_error === undefined ? null : v_error;
258
+ }
259
+ function deepFreeze$3(input) {
260
+ const input_products = input.products;
261
+ for (let i = 0; i < input_products.length; i++) {
262
+ const input_products_item = input_products[i];
263
+ deepFreeze$4(input_products_item);
264
+ }
265
+ ObjectFreeze(input_products);
266
+ ObjectFreeze(input);
267
+ }
268
+
269
+ const VERSION$1 = "605737e638033254bdffaf42f248c5b7";
270
+ function validate$2(obj, path = 'ProductSearchResultsRepresentation') {
271
+ const v_error = (() => {
272
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
273
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
274
+ }
275
+ const obj_categories = obj.categories;
276
+ const path_categories = path + '.categories';
277
+ const referencepath_categoriesValidationError = validate$6(obj_categories, path_categories);
278
+ if (referencepath_categoriesValidationError !== null) {
279
+ let message = 'Object doesn\'t match SearchCategoryRepresentation (at "' + path_categories + '")\n';
280
+ message += referencepath_categoriesValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
281
+ return new TypeError(message);
282
+ }
283
+ const obj_facets = obj.facets;
284
+ const path_facets = path + '.facets';
285
+ if (!ArrayIsArray(obj_facets)) {
286
+ return new TypeError('Expected "array" but received "' + typeof obj_facets + '" (at "' + path_facets + '")');
287
+ }
288
+ for (let i = 0; i < obj_facets.length; i++) {
289
+ const obj_facets_item = obj_facets[i];
290
+ const path_facets_item = path_facets + '[' + i + ']';
291
+ const referencepath_facets_itemValidationError = validate$5(obj_facets_item, path_facets_item);
292
+ if (referencepath_facets_itemValidationError !== null) {
293
+ let message = 'Object doesn\'t match SearchFacetRepresentation (at "' + path_facets_item + '")\n';
294
+ message += referencepath_facets_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
295
+ return new TypeError(message);
296
+ }
297
+ }
298
+ const obj_locale = obj.locale;
299
+ const path_locale = path + '.locale';
300
+ if (typeof obj_locale !== 'string') {
301
+ return new TypeError('Expected "string" but received "' + typeof obj_locale + '" (at "' + path_locale + '")');
302
+ }
303
+ const obj_productsPage = obj.productsPage;
304
+ const path_productsPage = path + '.productsPage';
305
+ const referencepath_productsPageValidationError = validate$3(obj_productsPage, path_productsPage);
306
+ if (referencepath_productsPageValidationError !== null) {
307
+ let message = 'Object doesn\'t match ProductSummaryCollectionRepresentation (at "' + path_productsPage + '")\n';
308
+ message += referencepath_productsPageValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
309
+ return new TypeError(message);
310
+ }
311
+ })();
312
+ return v_error === undefined ? null : v_error;
313
+ }
314
+ const RepresentationType$1 = 'ProductSearchResultsRepresentation';
315
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
316
+ return input;
317
+ }
318
+ const select$3 = function ProductSearchResultsRepresentationSelect() {
319
+ return {
320
+ kind: 'Fragment',
321
+ version: VERSION$1,
322
+ private: [],
323
+ opaque: true
324
+ };
325
+ };
326
+ function equals$1(existing, incoming) {
327
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
328
+ return false;
329
+ }
330
+ return true;
331
+ }
332
+ function deepFreeze$2(input) {
333
+ const input_categories = input.categories;
334
+ deepFreeze$6(input_categories);
335
+ const input_facets = input.facets;
336
+ for (let i = 0; i < input_facets.length; i++) {
337
+ const input_facets_item = input_facets[i];
338
+ deepFreeze$5(input_facets_item);
339
+ }
340
+ ObjectFreeze(input_facets);
341
+ const input_productsPage = input.productsPage;
342
+ deepFreeze$3(input_productsPage);
343
+ ObjectFreeze(input);
344
+ }
345
+ const ingest$1 = function ProductSearchResultsRepresentationIngest(input, path, luvio, store, timestamp) {
346
+ if (process.env.NODE_ENV !== 'production') {
347
+ const validateError = validate$2(input);
348
+ if (validateError !== null) {
349
+ throw validateError;
350
+ }
351
+ }
352
+ const key = path.fullPath;
353
+ const existingRecord = store.readEntry(key);
354
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
355
+ let incomingRecord = normalize$1(input, store.readEntry(key), {
356
+ fullPath: key,
357
+ parent: path.parent,
358
+ propertyName: path.propertyName,
359
+ ttl: ttlToUse
360
+ });
361
+ deepFreeze$2(input);
362
+ if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
363
+ luvio.storePublish(key, incomingRecord);
364
+ }
365
+ if (ttlToUse !== undefined) {
366
+ const storeMetadataParams = {
367
+ ttl: ttlToUse,
368
+ namespace: "Commerce",
369
+ version: VERSION$1,
370
+ representationName: RepresentationType$1,
371
+ };
372
+ luvio.publishStoreMetadata(key, storeMetadataParams);
373
+ }
374
+ return createLink(key);
375
+ };
376
+ function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
377
+ const rootKeySet = new StoreKeyMap();
378
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
379
+ const rootKey = fullPathFactory();
380
+ rootKeySet.set(rootKey, {
381
+ namespace: keyPrefix,
382
+ representationName: RepresentationType$1,
383
+ mergeable: false
384
+ });
385
+ return rootKeySet;
386
+ }
387
+
388
+ function select$2(luvio, params) {
389
+ return select$3();
390
+ }
391
+ function keyBuilder$3(luvio, params) {
392
+ return keyPrefix + '::ProductSearchResultsRepresentation:(' + 'effectiveAccountId:' + params.queryParams.effectiveAccountId + ',' + 'webstoreId:' + params.urlParams.webstoreId + ',' + 'categoryId:' + params.body.categoryId + '::' + 'fields:' + params.body.fields + '::' + 'page:' + params.body.page + '::' + 'pageSize:' + params.body.pageSize + '::' + 'refinements:' + params.body.refinements + '::' + 'searchTerm:' + params.body.searchTerm + '::' + 'sortOrderId:' + params.body.sortOrderId + ')';
393
+ }
394
+ function getResponseCacheKeys$1(luvio, resourceParams, response) {
395
+ return getTypeCacheKeys$1(luvio, response, () => keyBuilder$3(luvio, resourceParams));
396
+ }
397
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
398
+ const { body } = response;
399
+ const key = keyBuilder$3(luvio, resourceParams);
400
+ luvio.storeIngest(key, ingest$1, body);
401
+ const snapshot = luvio.storeLookup({
402
+ recordId: key,
403
+ node: select$2(),
404
+ variables: {},
405
+ }, snapshotRefresh);
406
+ if (process.env.NODE_ENV !== 'production') {
407
+ if (snapshot.state !== 'Fulfilled') {
408
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
409
+ }
410
+ }
411
+ return snapshot;
412
+ }
413
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
414
+ const key = keyBuilder$3(luvio, params);
415
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
416
+ luvio.storeIngestError(key, errorSnapshot);
417
+ return errorSnapshot;
418
+ }
419
+ function createResourceRequest$1(config) {
420
+ const headers = {};
421
+ return {
422
+ baseUri: '/services/data/v58.0',
423
+ basePath: '/commerce/webstores/' + config.urlParams.webstoreId + '/search/product-search',
424
+ method: 'post',
425
+ body: config.body,
426
+ urlParams: config.urlParams,
427
+ queryParams: config.queryParams,
428
+ headers,
429
+ priority: 'normal',
430
+ };
431
+ }
432
+
433
+ const productSearch_ConfigPropertyNames = {
434
+ displayName: 'productSearch',
435
+ parameters: {
436
+ required: ['webstoreId', 'categoryId', 'fields', 'page', 'pageSize', 'refinements', 'searchTerm', 'sortOrderId'],
437
+ optional: ['effectiveAccountId']
438
+ }
439
+ };
440
+ function createResourceParams$1(config) {
441
+ const resourceParams = {
442
+ urlParams: {
443
+ webstoreId: config.webstoreId
444
+ },
445
+ queryParams: {
446
+ effectiveAccountId: config.effectiveAccountId
447
+ },
448
+ body: {
449
+ categoryId: config.categoryId, fields: config.fields, page: config.page, pageSize: config.pageSize, refinements: config.refinements, searchTerm: config.searchTerm, sortOrderId: config.sortOrderId
450
+ }
451
+ };
452
+ return resourceParams;
453
+ }
454
+ function keyBuilder$2(luvio, config) {
455
+ const resourceParams = createResourceParams$1(config);
456
+ return keyBuilder$3(luvio, resourceParams);
457
+ }
458
+ function typeCheckConfig$1(untrustedConfig) {
459
+ const config = {};
460
+ const untrustedConfig_webstoreId = untrustedConfig.webstoreId;
461
+ if (typeof untrustedConfig_webstoreId === 'string') {
462
+ config.webstoreId = untrustedConfig_webstoreId;
463
+ }
464
+ const untrustedConfig_effectiveAccountId = untrustedConfig.effectiveAccountId;
465
+ if (typeof untrustedConfig_effectiveAccountId === 'string') {
466
+ config.effectiveAccountId = untrustedConfig_effectiveAccountId;
467
+ }
468
+ const untrustedConfig_categoryId = untrustedConfig.categoryId;
469
+ if (typeof untrustedConfig_categoryId === 'string') {
470
+ config.categoryId = untrustedConfig_categoryId;
471
+ }
472
+ const untrustedConfig_fields = untrustedConfig.fields;
473
+ if (ArrayIsArray$1(untrustedConfig_fields)) {
474
+ const untrustedConfig_fields_array = [];
475
+ for (let i = 0, arrayLength = untrustedConfig_fields.length; i < arrayLength; i++) {
476
+ const untrustedConfig_fields_item = untrustedConfig_fields[i];
477
+ if (typeof untrustedConfig_fields_item === 'string') {
478
+ untrustedConfig_fields_array.push(untrustedConfig_fields_item);
479
+ }
480
+ }
481
+ config.fields = untrustedConfig_fields_array;
482
+ }
483
+ const untrustedConfig_page = untrustedConfig.page;
484
+ if (typeof untrustedConfig_page === 'number' && Math.floor(untrustedConfig_page) === untrustedConfig_page) {
485
+ config.page = untrustedConfig_page;
486
+ }
487
+ const untrustedConfig_pageSize = untrustedConfig.pageSize;
488
+ if (typeof untrustedConfig_pageSize === 'number' && Math.floor(untrustedConfig_pageSize) === untrustedConfig_pageSize) {
489
+ config.pageSize = untrustedConfig_pageSize;
490
+ }
491
+ const untrustedConfig_refinements = untrustedConfig.refinements;
492
+ if (ArrayIsArray$1(untrustedConfig_refinements)) {
493
+ const untrustedConfig_refinements_array = [];
494
+ for (let i = 0, arrayLength = untrustedConfig_refinements.length; i < arrayLength; i++) {
495
+ const untrustedConfig_refinements_item = untrustedConfig_refinements[i];
496
+ if (untrustedIsObject(untrustedConfig_refinements_item)) {
497
+ const untrustedConfig_refinements_item_object = {};
498
+ if (untrustedConfig_refinements_item_object !== undefined && Object.keys(untrustedConfig_refinements_item_object).length >= 0) {
499
+ untrustedConfig_refinements_array.push(untrustedConfig_refinements_item_object);
500
+ }
501
+ }
502
+ }
503
+ config.refinements = untrustedConfig_refinements_array;
504
+ }
505
+ const untrustedConfig_searchTerm = untrustedConfig.searchTerm;
506
+ if (typeof untrustedConfig_searchTerm === 'string') {
507
+ config.searchTerm = untrustedConfig_searchTerm;
508
+ }
509
+ const untrustedConfig_sortOrderId = untrustedConfig.sortOrderId;
510
+ if (typeof untrustedConfig_sortOrderId === 'string') {
511
+ config.sortOrderId = untrustedConfig_sortOrderId;
512
+ }
513
+ return config;
514
+ }
515
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
516
+ if (!untrustedIsObject(untrustedConfig)) {
517
+ return null;
518
+ }
519
+ if (process.env.NODE_ENV !== 'production') {
520
+ validateConfig(untrustedConfig, configPropertyNames);
521
+ }
522
+ const config = typeCheckConfig$1(untrustedConfig);
523
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
524
+ return null;
525
+ }
526
+ return config;
527
+ }
528
+ function adapterFragment$1(luvio, config) {
529
+ createResourceParams$1(config);
530
+ return select$2();
531
+ }
532
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
533
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
534
+ config,
535
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
536
+ });
537
+ return luvio.storeBroadcast().then(() => snapshot);
538
+ }
539
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
540
+ const snapshot = ingestError$1(luvio, resourceParams, response, {
541
+ config,
542
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
543
+ });
544
+ return luvio.storeBroadcast().then(() => snapshot);
545
+ }
546
+ function buildNetworkSnapshot$1(luvio, config, options) {
547
+ const resourceParams = createResourceParams$1(config);
548
+ const request = createResourceRequest$1(resourceParams);
549
+ return luvio.dispatchResourceRequest(request, options)
550
+ .then((response) => {
551
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => getResponseCacheKeys$1(luvio, resourceParams, response.body));
552
+ }, (response) => {
553
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
554
+ });
555
+ }
556
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
557
+ const { luvio, config } = context;
558
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
559
+ const dispatchOptions = {
560
+ resourceRequestContext: {
561
+ requestCorrelator,
562
+ luvioRequestMethod: 'get',
563
+ },
564
+ eventObservers
565
+ };
566
+ if (networkPriority !== 'normal') {
567
+ dispatchOptions.overrides = {
568
+ priority: networkPriority
569
+ };
570
+ }
571
+ return buildNetworkSnapshot$1(luvio, config, dispatchOptions);
572
+ }
573
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
574
+ const { luvio, config } = context;
575
+ const selector = {
576
+ recordId: keyBuilder$2(luvio, config),
577
+ node: adapterFragment$1(luvio, config),
578
+ variables: {},
579
+ };
580
+ const cacheSnapshot = storeLookup(selector, {
581
+ config,
582
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
583
+ });
584
+ return cacheSnapshot;
585
+ }
586
+ const productSearchAdapterFactory = (luvio) => function Commerce__productSearch(untrustedConfig, requestContext) {
587
+ const config = validateAdapterConfig$1(untrustedConfig, productSearch_ConfigPropertyNames);
588
+ // Invalid or incomplete config
589
+ if (config === null) {
590
+ return null;
591
+ }
592
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
593
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
594
+ };
595
+
596
+ function validate$1(obj, path = 'SuggestedCompletionRepresentation') {
597
+ const v_error = (() => {
598
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
599
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
600
+ }
601
+ const obj_simpleString = obj.simpleString;
602
+ const path_simpleString = path + '.simpleString';
603
+ if (typeof obj_simpleString !== 'string') {
604
+ return new TypeError('Expected "string" but received "' + typeof obj_simpleString + '" (at "' + path_simpleString + '")');
605
+ }
606
+ })();
607
+ return v_error === undefined ? null : v_error;
608
+ }
609
+ function deepFreeze$1(input) {
610
+ ObjectFreeze(input);
611
+ }
612
+
613
+ const VERSION = "120685134083f097a5c3e15081721a8a";
614
+ function validate(obj, path = 'ProductSearchSuggestionsResultsRepresentation') {
615
+ const v_error = (() => {
616
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
617
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
618
+ }
619
+ const obj_completions = obj.completions;
620
+ const path_completions = path + '.completions';
621
+ if (!ArrayIsArray(obj_completions)) {
622
+ return new TypeError('Expected "array" but received "' + typeof obj_completions + '" (at "' + path_completions + '")');
623
+ }
624
+ for (let i = 0; i < obj_completions.length; i++) {
625
+ const obj_completions_item = obj_completions[i];
626
+ const path_completions_item = path_completions + '[' + i + ']';
627
+ const referencepath_completions_itemValidationError = validate$1(obj_completions_item, path_completions_item);
628
+ if (referencepath_completions_itemValidationError !== null) {
629
+ let message = 'Object doesn\'t match SuggestedCompletionRepresentation (at "' + path_completions_item + '")\n';
630
+ message += referencepath_completions_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
631
+ return new TypeError(message);
632
+ }
633
+ }
634
+ const obj_locale = obj.locale;
635
+ const path_locale = path + '.locale';
636
+ if (typeof obj_locale !== 'string') {
637
+ return new TypeError('Expected "string" but received "' + typeof obj_locale + '" (at "' + path_locale + '")');
638
+ }
639
+ })();
640
+ return v_error === undefined ? null : v_error;
641
+ }
642
+ const RepresentationType = 'ProductSearchSuggestionsResultsRepresentation';
643
+ function normalize(input, existing, path, luvio, store, timestamp) {
644
+ return input;
645
+ }
646
+ const select$1 = function ProductSearchSuggestionsResultsRepresentationSelect() {
647
+ return {
648
+ kind: 'Fragment',
649
+ version: VERSION,
650
+ private: [],
651
+ opaque: true
652
+ };
653
+ };
654
+ function equals(existing, incoming) {
655
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
656
+ return false;
657
+ }
658
+ return true;
659
+ }
660
+ function deepFreeze(input) {
661
+ const input_completions = input.completions;
662
+ for (let i = 0; i < input_completions.length; i++) {
663
+ const input_completions_item = input_completions[i];
664
+ deepFreeze$1(input_completions_item);
665
+ }
666
+ ObjectFreeze(input_completions);
667
+ ObjectFreeze(input);
668
+ }
669
+ const ingest = function ProductSearchSuggestionsResultsRepresentationIngest(input, path, luvio, store, timestamp) {
670
+ if (process.env.NODE_ENV !== 'production') {
671
+ const validateError = validate(input);
672
+ if (validateError !== null) {
673
+ throw validateError;
674
+ }
675
+ }
676
+ const key = path.fullPath;
677
+ const existingRecord = store.readEntry(key);
678
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
679
+ let incomingRecord = normalize(input, store.readEntry(key), {
680
+ fullPath: key,
681
+ parent: path.parent,
682
+ propertyName: path.propertyName,
683
+ ttl: ttlToUse
684
+ });
685
+ deepFreeze(input);
686
+ if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
687
+ luvio.storePublish(key, incomingRecord);
688
+ }
689
+ if (ttlToUse !== undefined) {
690
+ const storeMetadataParams = {
691
+ ttl: ttlToUse,
692
+ namespace: "Commerce",
693
+ version: VERSION,
694
+ representationName: RepresentationType,
695
+ };
696
+ luvio.publishStoreMetadata(key, storeMetadataParams);
697
+ }
698
+ return createLink(key);
699
+ };
700
+ function getTypeCacheKeys(luvio, input, fullPathFactory) {
701
+ const rootKeySet = new StoreKeyMap();
702
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
703
+ const rootKey = fullPathFactory();
704
+ rootKeySet.set(rootKey, {
705
+ namespace: keyPrefix,
706
+ representationName: RepresentationType,
707
+ mergeable: false
708
+ });
709
+ return rootKeySet;
710
+ }
711
+
712
+ function select(luvio, params) {
713
+ return select$1();
714
+ }
715
+ function keyBuilder$1(luvio, params) {
716
+ return keyPrefix + '::ProductSearchSuggestionsResultsRepresentation:(' + 'effectiveAccountId:' + params.queryParams.effectiveAccountId + ',' + 'limit:' + params.queryParams.limit + ',' + 'searchTerm:' + params.queryParams.searchTerm + ',' + 'webstoreId:' + params.urlParams.webstoreId + ')';
717
+ }
718
+ function getResponseCacheKeys(luvio, resourceParams, response) {
719
+ return getTypeCacheKeys(luvio, response, () => keyBuilder$1(luvio, resourceParams));
720
+ }
721
+ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
722
+ const { body } = response;
723
+ const key = keyBuilder$1(luvio, resourceParams);
724
+ luvio.storeIngest(key, ingest, body);
725
+ const snapshot = luvio.storeLookup({
726
+ recordId: key,
727
+ node: select(),
728
+ variables: {},
729
+ }, snapshotRefresh);
730
+ if (process.env.NODE_ENV !== 'production') {
731
+ if (snapshot.state !== 'Fulfilled') {
732
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
733
+ }
734
+ }
735
+ return snapshot;
736
+ }
737
+ function ingestError(luvio, params, error, snapshotRefresh) {
738
+ const key = keyBuilder$1(luvio, params);
739
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
740
+ luvio.storeIngestError(key, errorSnapshot);
741
+ return errorSnapshot;
742
+ }
743
+ function createResourceRequest(config) {
744
+ const headers = {};
745
+ return {
746
+ baseUri: '/services/data/v58.0',
747
+ basePath: '/commerce/webstores/' + config.urlParams.webstoreId + '/search/suggestions',
748
+ method: 'get',
749
+ body: null,
750
+ urlParams: config.urlParams,
751
+ queryParams: config.queryParams,
752
+ headers,
753
+ priority: 'normal',
754
+ };
755
+ }
756
+
757
+ const getSuggestions_ConfigPropertyNames = {
758
+ displayName: 'getSuggestions',
759
+ parameters: {
760
+ required: ['webstoreId'],
761
+ optional: ['effectiveAccountId', 'limit', 'searchTerm']
762
+ }
763
+ };
764
+ function createResourceParams(config) {
765
+ const resourceParams = {
766
+ urlParams: {
767
+ webstoreId: config.webstoreId
768
+ },
769
+ queryParams: {
770
+ effectiveAccountId: config.effectiveAccountId, limit: config.limit, searchTerm: config.searchTerm
771
+ }
772
+ };
773
+ return resourceParams;
774
+ }
775
+ function keyBuilder(luvio, config) {
776
+ const resourceParams = createResourceParams(config);
777
+ return keyBuilder$1(luvio, resourceParams);
778
+ }
779
+ function typeCheckConfig(untrustedConfig) {
780
+ const config = {};
781
+ const untrustedConfig_webstoreId = untrustedConfig.webstoreId;
782
+ if (typeof untrustedConfig_webstoreId === 'string') {
783
+ config.webstoreId = untrustedConfig_webstoreId;
784
+ }
785
+ const untrustedConfig_effectiveAccountId = untrustedConfig.effectiveAccountId;
786
+ if (typeof untrustedConfig_effectiveAccountId === 'string') {
787
+ config.effectiveAccountId = untrustedConfig_effectiveAccountId;
788
+ }
789
+ const untrustedConfig_limit = untrustedConfig.limit;
790
+ if (typeof untrustedConfig_limit === 'number' && Math.floor(untrustedConfig_limit) === untrustedConfig_limit) {
791
+ config.limit = untrustedConfig_limit;
792
+ }
793
+ const untrustedConfig_searchTerm = untrustedConfig.searchTerm;
794
+ if (typeof untrustedConfig_searchTerm === 'string') {
795
+ config.searchTerm = untrustedConfig_searchTerm;
796
+ }
797
+ return config;
798
+ }
799
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
800
+ if (!untrustedIsObject(untrustedConfig)) {
801
+ return null;
802
+ }
803
+ if (process.env.NODE_ENV !== 'production') {
804
+ validateConfig(untrustedConfig, configPropertyNames);
805
+ }
806
+ const config = typeCheckConfig(untrustedConfig);
807
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
808
+ return null;
809
+ }
810
+ return config;
811
+ }
812
+ function adapterFragment(luvio, config) {
813
+ createResourceParams(config);
814
+ return select();
815
+ }
816
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
817
+ const snapshot = ingestSuccess(luvio, resourceParams, response, {
818
+ config,
819
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
820
+ });
821
+ return luvio.storeBroadcast().then(() => snapshot);
822
+ }
823
+ function onFetchResponseError(luvio, config, resourceParams, response) {
824
+ const snapshot = ingestError(luvio, resourceParams, response, {
825
+ config,
826
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
827
+ });
828
+ return luvio.storeBroadcast().then(() => snapshot);
829
+ }
830
+ function buildNetworkSnapshot(luvio, config, options) {
831
+ const resourceParams = createResourceParams(config);
832
+ const request = createResourceRequest(resourceParams);
833
+ return luvio.dispatchResourceRequest(request, options)
834
+ .then((response) => {
835
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys(luvio, resourceParams, response.body));
836
+ }, (response) => {
837
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
838
+ });
839
+ }
840
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
841
+ const { luvio, config } = context;
842
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
843
+ const dispatchOptions = {
844
+ resourceRequestContext: {
845
+ requestCorrelator,
846
+ luvioRequestMethod: undefined,
847
+ },
848
+ eventObservers
849
+ };
850
+ if (networkPriority !== 'normal') {
851
+ dispatchOptions.overrides = {
852
+ priority: networkPriority
853
+ };
854
+ }
855
+ return buildNetworkSnapshot(luvio, config, dispatchOptions);
856
+ }
857
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
858
+ const { luvio, config } = context;
859
+ const selector = {
860
+ recordId: keyBuilder(luvio, config),
861
+ node: adapterFragment(luvio, config),
862
+ variables: {},
863
+ };
864
+ const cacheSnapshot = storeLookup(selector, {
865
+ config,
866
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
867
+ });
868
+ return cacheSnapshot;
869
+ }
870
+ const getSuggestionsAdapterFactory = (luvio) => function Commerce__getSuggestions(untrustedConfig, requestContext) {
871
+ const config = validateAdapterConfig(untrustedConfig, getSuggestions_ConfigPropertyNames);
872
+ // Invalid or incomplete config
873
+ if (config === null) {
874
+ return null;
875
+ }
876
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
877
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
878
+ };
879
+
880
+ export { getSuggestionsAdapterFactory, productSearchAdapterFactory };