@salesforce/lds-adapters-commerce-search 1.345.0 → 1.347.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 (28) hide show
  1. package/dist/es/es2018/commerce-search.js +1149 -8
  2. package/dist/es/es2018/types/src/generated/adapters/createSearchBoostBuryRule.d.ts +24 -0
  3. package/dist/es/es2018/types/src/generated/adapters/deleteSearchBoostBuryRule.d.ts +15 -0
  4. package/dist/es/es2018/types/src/generated/adapters/getSearchBoostBuryRule.d.ts +29 -0
  5. package/dist/es/es2018/types/src/generated/adapters/getSearchBoostBuryRules.d.ts +27 -0
  6. package/dist/es/es2018/types/src/generated/adapters/updateSearchBoostBuryRule.d.ts +25 -0
  7. package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +5 -0
  8. package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +9 -1
  9. package/dist/es/es2018/types/src/generated/resources/deleteCommerceManagementWebstoresSearchBoostBuryRulesByRuleIdAndWebstoreId.d.ts +13 -0
  10. package/dist/es/es2018/types/src/generated/resources/getCommerceManagementWebstoresSearchBoostBuryRulesByRuleIdAndWebstoreId.d.ts +17 -0
  11. package/dist/es/es2018/types/src/generated/resources/getCommerceManagementWebstoresSearchBoostBuryRulesByWebstoreId.d.ts +15 -0
  12. package/dist/es/es2018/types/src/generated/resources/patchCommerceManagementWebstoresSearchBoostBuryRulesByRuleIdAndWebstoreId.d.ts +24 -0
  13. package/dist/es/es2018/types/src/generated/resources/postCommerceManagementWebstoresSearchBoostBuryRulesByWebstoreId.d.ts +23 -0
  14. package/dist/es/es2018/types/src/generated/types/BoostBuryConditionInputRepresentation.d.ts +34 -0
  15. package/dist/es/es2018/types/src/generated/types/BoostBuryConditionOutputRepresentation.d.ts +34 -0
  16. package/dist/es/es2018/types/src/generated/types/BoostBuryQueryContextConditionInputRepresentation.d.ts +34 -0
  17. package/dist/es/es2018/types/src/generated/types/BoostBuryQueryContextConditionOutputRepresentation.d.ts +34 -0
  18. package/dist/es/es2018/types/src/generated/types/BoostBuryQueryContextInputRepresentation.d.ts +29 -0
  19. package/dist/es/es2018/types/src/generated/types/BoostBuryQueryContextOutputRepresentation.d.ts +29 -0
  20. package/dist/es/es2018/types/src/generated/types/BoostBuryTargetExpressionInputRepresentation.d.ts +29 -0
  21. package/dist/es/es2018/types/src/generated/types/BoostBuryTargetExpressionOutputRepresentation.d.ts +29 -0
  22. package/dist/es/es2018/types/src/generated/types/SearchBoostBuryRuleInputRepresentation.d.ts +48 -0
  23. package/dist/es/es2018/types/src/generated/types/SearchBoostBuryRuleOutputRepresentation.d.ts +71 -0
  24. package/dist/es/es2018/types/src/generated/types/SearchBoostBuryRulesCollectionOutputRepresentation.d.ts +29 -0
  25. package/package.json +4 -4
  26. package/sfdc/index.js +1272 -60
  27. package/src/raml/api.raml +253 -0
  28. package/src/raml/luvio.raml +46 -0
@@ -4,7 +4,7 @@
4
4
  * For full license text, see the LICENSE.txt file
5
5
  */
6
6
 
7
- import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$2, typeCheckConfig as typeCheckConfig$2, StoreKeyMap, createResourceParams as createResourceParams$2 } from '@luvio/engine';
7
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$4, typeCheckConfig as typeCheckConfig$7, StoreKeyMap, createResourceParams as createResourceParams$7 } from '@luvio/engine';
8
8
 
9
9
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
10
  const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
@@ -136,6 +136,1147 @@ function createLink(ref) {
136
136
  };
137
137
  }
138
138
 
139
+ function validate$g(obj, path = 'BoostBuryQueryContextConditionOutputRepresentation') {
140
+ const v_error = (() => {
141
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
142
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
143
+ }
144
+ const obj_locales = obj.locales;
145
+ const path_locales = path + '.locales';
146
+ if (!ArrayIsArray(obj_locales)) {
147
+ return new TypeError('Expected "array" but received "' + typeof obj_locales + '" (at "' + path_locales + '")');
148
+ }
149
+ for (let i = 0; i < obj_locales.length; i++) {
150
+ const obj_locales_item = obj_locales[i];
151
+ const path_locales_item = path_locales + '[' + i + ']';
152
+ if (typeof obj_locales_item !== 'string') {
153
+ return new TypeError('Expected "string" but received "' + typeof obj_locales_item + '" (at "' + path_locales_item + '")');
154
+ }
155
+ }
156
+ const obj_type = obj.type;
157
+ const path_type = path + '.type';
158
+ if (typeof obj_type !== 'string') {
159
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
160
+ }
161
+ const obj_values = obj.values;
162
+ const path_values = path + '.values';
163
+ if (!ArrayIsArray(obj_values)) {
164
+ return new TypeError('Expected "array" but received "' + typeof obj_values + '" (at "' + path_values + '")');
165
+ }
166
+ for (let i = 0; i < obj_values.length; i++) {
167
+ const obj_values_item = obj_values[i];
168
+ const path_values_item = path_values + '[' + i + ']';
169
+ if (typeof obj_values_item !== 'string') {
170
+ return new TypeError('Expected "string" but received "' + typeof obj_values_item + '" (at "' + path_values_item + '")');
171
+ }
172
+ }
173
+ })();
174
+ return v_error === undefined ? null : v_error;
175
+ }
176
+
177
+ const VERSION$5 = "a28891bfa8a2d07d1be34bbee8e37743";
178
+ function validate$f(obj, path = 'BoostBuryQueryContextOutputRepresentation') {
179
+ const v_error = (() => {
180
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
181
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
182
+ }
183
+ const obj_conditions = obj.conditions;
184
+ const path_conditions = path + '.conditions';
185
+ if (!ArrayIsArray(obj_conditions)) {
186
+ return new TypeError('Expected "array" but received "' + typeof obj_conditions + '" (at "' + path_conditions + '")');
187
+ }
188
+ for (let i = 0; i < obj_conditions.length; i++) {
189
+ const obj_conditions_item = obj_conditions[i];
190
+ const path_conditions_item = path_conditions + '[' + i + ']';
191
+ const referencepath_conditions_itemValidationError = validate$g(obj_conditions_item, path_conditions_item);
192
+ if (referencepath_conditions_itemValidationError !== null) {
193
+ let message = 'Object doesn\'t match BoostBuryQueryContextConditionOutputRepresentation (at "' + path_conditions_item + '")\n';
194
+ message += referencepath_conditions_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
195
+ return new TypeError(message);
196
+ }
197
+ }
198
+ })();
199
+ return v_error === undefined ? null : v_error;
200
+ }
201
+ const RepresentationType$5 = 'BoostBuryQueryContextOutputRepresentation';
202
+ function normalize$5(input, existing, path, luvio, store, timestamp) {
203
+ return input;
204
+ }
205
+ const select$b = function BoostBuryQueryContextOutputRepresentationSelect() {
206
+ return {
207
+ kind: 'Fragment',
208
+ version: VERSION$5,
209
+ private: [],
210
+ opaque: true
211
+ };
212
+ };
213
+ function equals$5(existing, incoming) {
214
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
215
+ return false;
216
+ }
217
+ return true;
218
+ }
219
+ const ingest$5 = function BoostBuryQueryContextOutputRepresentationIngest(input, path, luvio, store, timestamp) {
220
+ if (process.env.NODE_ENV !== 'production') {
221
+ const validateError = validate$f(input);
222
+ if (validateError !== null) {
223
+ throw validateError;
224
+ }
225
+ }
226
+ const key = path.fullPath;
227
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
228
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$5, "Commerce", VERSION$5, RepresentationType$5, equals$5);
229
+ return createLink(key);
230
+ };
231
+ function getTypeCacheKeys$5(rootKeySet, luvio, input, fullPathFactory) {
232
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
233
+ const rootKey = fullPathFactory();
234
+ rootKeySet.set(rootKey, {
235
+ namespace: keyPrefix,
236
+ representationName: RepresentationType$5,
237
+ mergeable: false
238
+ });
239
+ }
240
+
241
+ function validate$e(obj, path = 'BoostBuryConditionOutputRepresentation') {
242
+ const v_error = (() => {
243
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
244
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
245
+ }
246
+ const obj_attributeNameOrId = obj.attributeNameOrId;
247
+ const path_attributeNameOrId = path + '.attributeNameOrId';
248
+ if (typeof obj_attributeNameOrId !== 'string') {
249
+ return new TypeError('Expected "string" but received "' + typeof obj_attributeNameOrId + '" (at "' + path_attributeNameOrId + '")');
250
+ }
251
+ const obj_attributeType = obj.attributeType;
252
+ const path_attributeType = path + '.attributeType';
253
+ if (typeof obj_attributeType !== 'string') {
254
+ return new TypeError('Expected "string" but received "' + typeof obj_attributeType + '" (at "' + path_attributeType + '")');
255
+ }
256
+ const obj_values = obj.values;
257
+ const path_values = path + '.values';
258
+ if (!ArrayIsArray(obj_values)) {
259
+ return new TypeError('Expected "array" but received "' + typeof obj_values + '" (at "' + path_values + '")');
260
+ }
261
+ for (let i = 0; i < obj_values.length; i++) {
262
+ const obj_values_item = obj_values[i];
263
+ const path_values_item = path_values + '[' + i + ']';
264
+ if (typeof obj_values_item !== 'string') {
265
+ return new TypeError('Expected "string" but received "' + typeof obj_values_item + '" (at "' + path_values_item + '")');
266
+ }
267
+ }
268
+ })();
269
+ return v_error === undefined ? null : v_error;
270
+ }
271
+
272
+ const VERSION$4 = "da3a29347b6bcd49bcb7137ab6761da1";
273
+ function validate$d(obj, path = 'BoostBuryTargetExpressionOutputRepresentation') {
274
+ const v_error = (() => {
275
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
276
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
277
+ }
278
+ const obj_conditions = obj.conditions;
279
+ const path_conditions = path + '.conditions';
280
+ if (!ArrayIsArray(obj_conditions)) {
281
+ return new TypeError('Expected "array" but received "' + typeof obj_conditions + '" (at "' + path_conditions + '")');
282
+ }
283
+ for (let i = 0; i < obj_conditions.length; i++) {
284
+ const obj_conditions_item = obj_conditions[i];
285
+ const path_conditions_item = path_conditions + '[' + i + ']';
286
+ const referencepath_conditions_itemValidationError = validate$e(obj_conditions_item, path_conditions_item);
287
+ if (referencepath_conditions_itemValidationError !== null) {
288
+ let message = 'Object doesn\'t match BoostBuryConditionOutputRepresentation (at "' + path_conditions_item + '")\n';
289
+ message += referencepath_conditions_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
290
+ return new TypeError(message);
291
+ }
292
+ }
293
+ })();
294
+ return v_error === undefined ? null : v_error;
295
+ }
296
+ const RepresentationType$4 = 'BoostBuryTargetExpressionOutputRepresentation';
297
+ function normalize$4(input, existing, path, luvio, store, timestamp) {
298
+ return input;
299
+ }
300
+ const select$a = function BoostBuryTargetExpressionOutputRepresentationSelect() {
301
+ return {
302
+ kind: 'Fragment',
303
+ version: VERSION$4,
304
+ private: [],
305
+ opaque: true
306
+ };
307
+ };
308
+ function equals$4(existing, incoming) {
309
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
310
+ return false;
311
+ }
312
+ return true;
313
+ }
314
+ const ingest$4 = function BoostBuryTargetExpressionOutputRepresentationIngest(input, path, luvio, store, timestamp) {
315
+ if (process.env.NODE_ENV !== 'production') {
316
+ const validateError = validate$d(input);
317
+ if (validateError !== null) {
318
+ throw validateError;
319
+ }
320
+ }
321
+ const key = path.fullPath;
322
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
323
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$4, "Commerce", VERSION$4, RepresentationType$4, equals$4);
324
+ return createLink(key);
325
+ };
326
+ function getTypeCacheKeys$4(rootKeySet, luvio, input, fullPathFactory) {
327
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
328
+ const rootKey = fullPathFactory();
329
+ rootKeySet.set(rootKey, {
330
+ namespace: keyPrefix,
331
+ representationName: RepresentationType$4,
332
+ mergeable: false
333
+ });
334
+ }
335
+
336
+ const VERSION$3 = "a27b6f0bb6f725e2ad64d83e7eb4c352";
337
+ function validate$c(obj, path = 'SearchBoostBuryRuleOutputRepresentation') {
338
+ const v_error = (() => {
339
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
340
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
341
+ }
342
+ const obj_action = obj.action;
343
+ const path_action = path + '.action';
344
+ if (typeof obj_action !== 'string') {
345
+ return new TypeError('Expected "string" but received "' + typeof obj_action + '" (at "' + path_action + '")');
346
+ }
347
+ const obj_endDate = obj.endDate;
348
+ const path_endDate = path + '.endDate';
349
+ if (typeof obj_endDate !== 'string') {
350
+ return new TypeError('Expected "string" but received "' + typeof obj_endDate + '" (at "' + path_endDate + '")');
351
+ }
352
+ const obj_id = obj.id;
353
+ const path_id = path + '.id';
354
+ if (typeof obj_id !== 'string') {
355
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
356
+ }
357
+ const obj_level = obj.level;
358
+ const path_level = path + '.level';
359
+ if (typeof obj_level !== 'number' || (typeof obj_level === 'number' && Math.floor(obj_level) !== obj_level)) {
360
+ return new TypeError('Expected "integer" but received "' + typeof obj_level + '" (at "' + path_level + '")');
361
+ }
362
+ const obj_name = obj.name;
363
+ const path_name = path + '.name';
364
+ if (typeof obj_name !== 'string') {
365
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
366
+ }
367
+ const obj_queryContext = obj.queryContext;
368
+ const path_queryContext = path + '.queryContext';
369
+ if (typeof obj_queryContext !== 'object') {
370
+ return new TypeError('Expected "object" but received "' + typeof obj_queryContext + '" (at "' + path_queryContext + '")');
371
+ }
372
+ const obj_startDate = obj.startDate;
373
+ const path_startDate = path + '.startDate';
374
+ if (typeof obj_startDate !== 'string') {
375
+ return new TypeError('Expected "string" but received "' + typeof obj_startDate + '" (at "' + path_startDate + '")');
376
+ }
377
+ const obj_targetExpression = obj.targetExpression;
378
+ const path_targetExpression = path + '.targetExpression';
379
+ if (typeof obj_targetExpression !== 'object') {
380
+ return new TypeError('Expected "object" but received "' + typeof obj_targetExpression + '" (at "' + path_targetExpression + '")');
381
+ }
382
+ })();
383
+ return v_error === undefined ? null : v_error;
384
+ }
385
+ const RepresentationType$3 = 'SearchBoostBuryRuleOutputRepresentation';
386
+ function keyBuilder$9(luvio, config) {
387
+ return keyPrefix + '::' + RepresentationType$3 + ':' + config.id;
388
+ }
389
+ function keyBuilderFromType(luvio, object) {
390
+ const keyParams = {
391
+ id: object.id
392
+ };
393
+ return keyBuilder$9(luvio, keyParams);
394
+ }
395
+ function normalize$3(input, existing, path, luvio, store, timestamp) {
396
+ const input_queryContext = input.queryContext;
397
+ const input_queryContext_id = path.fullPath + '__queryContext';
398
+ input.queryContext = ingest$5(input_queryContext, {
399
+ fullPath: input_queryContext_id,
400
+ propertyName: 'queryContext',
401
+ parent: {
402
+ data: input,
403
+ key: path.fullPath,
404
+ existing: existing,
405
+ },
406
+ ttl: path.ttl
407
+ }, luvio, store, timestamp);
408
+ const input_targetExpression = input.targetExpression;
409
+ const input_targetExpression_id = path.fullPath + '__targetExpression';
410
+ input.targetExpression = ingest$4(input_targetExpression, {
411
+ fullPath: input_targetExpression_id,
412
+ propertyName: 'targetExpression',
413
+ parent: {
414
+ data: input,
415
+ key: path.fullPath,
416
+ existing: existing,
417
+ },
418
+ ttl: path.ttl
419
+ }, luvio, store, timestamp);
420
+ return input;
421
+ }
422
+ const select$9 = function SearchBoostBuryRuleOutputRepresentationSelect() {
423
+ return {
424
+ kind: 'Fragment',
425
+ version: VERSION$3,
426
+ private: [],
427
+ selections: [
428
+ {
429
+ name: 'action',
430
+ kind: 'Scalar'
431
+ },
432
+ {
433
+ name: 'endDate',
434
+ kind: 'Scalar'
435
+ },
436
+ {
437
+ name: 'id',
438
+ kind: 'Scalar'
439
+ },
440
+ {
441
+ name: 'level',
442
+ kind: 'Scalar'
443
+ },
444
+ {
445
+ name: 'name',
446
+ kind: 'Scalar'
447
+ },
448
+ {
449
+ name: 'queryContext',
450
+ kind: 'Link',
451
+ fragment: select$b()
452
+ },
453
+ {
454
+ name: 'startDate',
455
+ kind: 'Scalar'
456
+ },
457
+ {
458
+ name: 'targetExpression',
459
+ kind: 'Link',
460
+ fragment: select$a()
461
+ }
462
+ ]
463
+ };
464
+ };
465
+ function equals$3(existing, incoming) {
466
+ const existing_level = existing.level;
467
+ const incoming_level = incoming.level;
468
+ if (!(existing_level === incoming_level)) {
469
+ return false;
470
+ }
471
+ const existing_action = existing.action;
472
+ const incoming_action = incoming.action;
473
+ if (!(existing_action === incoming_action)) {
474
+ return false;
475
+ }
476
+ const existing_endDate = existing.endDate;
477
+ const incoming_endDate = incoming.endDate;
478
+ if (!(existing_endDate === incoming_endDate)) {
479
+ return false;
480
+ }
481
+ const existing_id = existing.id;
482
+ const incoming_id = incoming.id;
483
+ if (!(existing_id === incoming_id)) {
484
+ return false;
485
+ }
486
+ const existing_name = existing.name;
487
+ const incoming_name = incoming.name;
488
+ if (!(existing_name === incoming_name)) {
489
+ return false;
490
+ }
491
+ const existing_startDate = existing.startDate;
492
+ const incoming_startDate = incoming.startDate;
493
+ if (!(existing_startDate === incoming_startDate)) {
494
+ return false;
495
+ }
496
+ const existing_queryContext = existing.queryContext;
497
+ const incoming_queryContext = incoming.queryContext;
498
+ if (!(existing_queryContext.__ref === incoming_queryContext.__ref)) {
499
+ return false;
500
+ }
501
+ const existing_targetExpression = existing.targetExpression;
502
+ const incoming_targetExpression = incoming.targetExpression;
503
+ if (!(existing_targetExpression.__ref === incoming_targetExpression.__ref)) {
504
+ return false;
505
+ }
506
+ return true;
507
+ }
508
+ const ingest$3 = function SearchBoostBuryRuleOutputRepresentationIngest(input, path, luvio, store, timestamp) {
509
+ if (process.env.NODE_ENV !== 'production') {
510
+ const validateError = validate$c(input);
511
+ if (validateError !== null) {
512
+ throw validateError;
513
+ }
514
+ }
515
+ const key = keyBuilderFromType(luvio, input);
516
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
517
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "Commerce", VERSION$3, RepresentationType$3, equals$3);
518
+ return createLink(key);
519
+ };
520
+ function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
521
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
522
+ const rootKey = keyBuilderFromType(luvio, input);
523
+ rootKeySet.set(rootKey, {
524
+ namespace: keyPrefix,
525
+ representationName: RepresentationType$3,
526
+ mergeable: false
527
+ });
528
+ getTypeCacheKeys$5(rootKeySet, luvio, input.queryContext, () => rootKey + "__" + "queryContext");
529
+ getTypeCacheKeys$4(rootKeySet, luvio, input.targetExpression, () => rootKey + "__" + "targetExpression");
530
+ }
531
+
532
+ const VERSION$2 = "0fa833e9a0f029f33da2b453b1b3d98c";
533
+ function validate$b(obj, path = 'SearchBoostBuryRulesCollectionOutputRepresentation') {
534
+ const v_error = (() => {
535
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
536
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
537
+ }
538
+ const obj_boostBuryRules = obj.boostBuryRules;
539
+ const path_boostBuryRules = path + '.boostBuryRules';
540
+ if (!ArrayIsArray(obj_boostBuryRules)) {
541
+ return new TypeError('Expected "array" but received "' + typeof obj_boostBuryRules + '" (at "' + path_boostBuryRules + '")');
542
+ }
543
+ for (let i = 0; i < obj_boostBuryRules.length; i++) {
544
+ const obj_boostBuryRules_item = obj_boostBuryRules[i];
545
+ const path_boostBuryRules_item = path_boostBuryRules + '[' + i + ']';
546
+ const referencepath_boostBuryRules_itemValidationError = validate$c(obj_boostBuryRules_item, path_boostBuryRules_item);
547
+ if (referencepath_boostBuryRules_itemValidationError !== null) {
548
+ let message = 'Object doesn\'t match SearchBoostBuryRuleOutputRepresentation (at "' + path_boostBuryRules_item + '")\n';
549
+ message += referencepath_boostBuryRules_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
550
+ return new TypeError(message);
551
+ }
552
+ }
553
+ })();
554
+ return v_error === undefined ? null : v_error;
555
+ }
556
+ const RepresentationType$2 = 'SearchBoostBuryRulesCollectionOutputRepresentation';
557
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
558
+ return input;
559
+ }
560
+ const select$8 = function SearchBoostBuryRulesCollectionOutputRepresentationSelect() {
561
+ return {
562
+ kind: 'Fragment',
563
+ version: VERSION$2,
564
+ private: [],
565
+ opaque: true
566
+ };
567
+ };
568
+ function equals$2(existing, incoming) {
569
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
570
+ return false;
571
+ }
572
+ return true;
573
+ }
574
+ const ingest$2 = function SearchBoostBuryRulesCollectionOutputRepresentationIngest(input, path, luvio, store, timestamp) {
575
+ if (process.env.NODE_ENV !== 'production') {
576
+ const validateError = validate$b(input);
577
+ if (validateError !== null) {
578
+ throw validateError;
579
+ }
580
+ }
581
+ const key = path.fullPath;
582
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
583
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "Commerce", VERSION$2, RepresentationType$2, equals$2);
584
+ return createLink(key);
585
+ };
586
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
587
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
588
+ const rootKey = fullPathFactory();
589
+ rootKeySet.set(rootKey, {
590
+ namespace: keyPrefix,
591
+ representationName: RepresentationType$2,
592
+ mergeable: false
593
+ });
594
+ }
595
+
596
+ function select$7(luvio, params) {
597
+ return select$8();
598
+ }
599
+ function keyBuilder$8(luvio, params) {
600
+ return keyPrefix + '::SearchBoostBuryRulesCollectionOutputRepresentation:(' + 'webstoreId:' + params.urlParams.webstoreId + ')';
601
+ }
602
+ function getResponseCacheKeys$6(storeKeyMap, luvio, resourceParams, response) {
603
+ getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$8(luvio, resourceParams));
604
+ }
605
+ function ingestSuccess$5(luvio, resourceParams, response, snapshotRefresh) {
606
+ const { body } = response;
607
+ const key = keyBuilder$8(luvio, resourceParams);
608
+ luvio.storeIngest(key, ingest$2, body);
609
+ const snapshot = luvio.storeLookup({
610
+ recordId: key,
611
+ node: select$7(),
612
+ variables: {},
613
+ }, snapshotRefresh);
614
+ if (process.env.NODE_ENV !== 'production') {
615
+ if (snapshot.state !== 'Fulfilled') {
616
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
617
+ }
618
+ }
619
+ deepFreeze(snapshot.data);
620
+ return snapshot;
621
+ }
622
+ function ingestError$3(luvio, params, error, snapshotRefresh) {
623
+ const key = keyBuilder$8(luvio, params);
624
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
625
+ luvio.storeIngestError(key, errorSnapshot);
626
+ return errorSnapshot;
627
+ }
628
+ function createResourceRequest$6(config) {
629
+ const headers = {};
630
+ return {
631
+ baseUri: '/services/data/v64.0',
632
+ basePath: '/commerce/management/webstores/' + config.urlParams.webstoreId + '/search/boost-bury-rules',
633
+ method: 'get',
634
+ body: null,
635
+ urlParams: config.urlParams,
636
+ queryParams: {},
637
+ headers,
638
+ priority: 'normal',
639
+ };
640
+ }
641
+
642
+ const adapterName$6 = 'getSearchBoostBuryRules';
643
+ const getSearchBoostBuryRules_ConfigPropertyMetadata = [
644
+ generateParamConfigMetadata('webstoreId', true, 0 /* UrlParameter */, 0 /* String */),
645
+ ];
646
+ const getSearchBoostBuryRules_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$6, getSearchBoostBuryRules_ConfigPropertyMetadata);
647
+ const createResourceParams$6 = /*#__PURE__*/ createResourceParams$7(getSearchBoostBuryRules_ConfigPropertyMetadata);
648
+ function keyBuilder$7(luvio, config) {
649
+ const resourceParams = createResourceParams$6(config);
650
+ return keyBuilder$8(luvio, resourceParams);
651
+ }
652
+ function typeCheckConfig$6(untrustedConfig) {
653
+ const config = {};
654
+ typeCheckConfig$7(untrustedConfig, config, getSearchBoostBuryRules_ConfigPropertyMetadata);
655
+ return config;
656
+ }
657
+ function validateAdapterConfig$6(untrustedConfig, configPropertyNames) {
658
+ if (!untrustedIsObject(untrustedConfig)) {
659
+ return null;
660
+ }
661
+ if (process.env.NODE_ENV !== 'production') {
662
+ validateConfig(untrustedConfig, configPropertyNames);
663
+ }
664
+ const config = typeCheckConfig$6(untrustedConfig);
665
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
666
+ return null;
667
+ }
668
+ return config;
669
+ }
670
+ function adapterFragment$3(luvio, config) {
671
+ createResourceParams$6(config);
672
+ return select$7();
673
+ }
674
+ function onFetchResponseSuccess$3(luvio, config, resourceParams, response) {
675
+ const snapshot = ingestSuccess$5(luvio, resourceParams, response, {
676
+ config,
677
+ resolve: () => buildNetworkSnapshot$6(luvio, config, snapshotRefreshOptions)
678
+ });
679
+ return luvio.storeBroadcast().then(() => snapshot);
680
+ }
681
+ function onFetchResponseError$3(luvio, config, resourceParams, response) {
682
+ const snapshot = ingestError$3(luvio, resourceParams, response, {
683
+ config,
684
+ resolve: () => buildNetworkSnapshot$6(luvio, config, snapshotRefreshOptions)
685
+ });
686
+ return luvio.storeBroadcast().then(() => snapshot);
687
+ }
688
+ function buildNetworkSnapshot$6(luvio, config, options) {
689
+ const resourceParams = createResourceParams$6(config);
690
+ const request = createResourceRequest$6(resourceParams);
691
+ return luvio.dispatchResourceRequest(request, options)
692
+ .then((response) => {
693
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$3(luvio, config, resourceParams, response), () => {
694
+ const cache = new StoreKeyMap();
695
+ getResponseCacheKeys$6(cache, luvio, resourceParams, response.body);
696
+ return cache;
697
+ });
698
+ }, (response) => {
699
+ return luvio.handleErrorResponse(() => onFetchResponseError$3(luvio, config, resourceParams, response));
700
+ });
701
+ }
702
+ function buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext) {
703
+ return buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext, buildNetworkSnapshot$6, undefined, false);
704
+ }
705
+ function buildCachedSnapshotCachePolicy$3(context, storeLookup) {
706
+ const { luvio, config } = context;
707
+ const selector = {
708
+ recordId: keyBuilder$7(luvio, config),
709
+ node: adapterFragment$3(luvio, config),
710
+ variables: {},
711
+ };
712
+ const cacheSnapshot = storeLookup(selector, {
713
+ config,
714
+ resolve: () => buildNetworkSnapshot$6(luvio, config, snapshotRefreshOptions)
715
+ });
716
+ return cacheSnapshot;
717
+ }
718
+ const getSearchBoostBuryRulesAdapterFactory = (luvio) => function Commerce__getSearchBoostBuryRules(untrustedConfig, requestContext) {
719
+ const config = validateAdapterConfig$6(untrustedConfig, getSearchBoostBuryRules_ConfigPropertyNames);
720
+ // Invalid or incomplete config
721
+ if (config === null) {
722
+ return null;
723
+ }
724
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
725
+ buildCachedSnapshotCachePolicy$3, buildNetworkSnapshotCachePolicy$3);
726
+ };
727
+
728
+ function validate$a(obj, path = 'BoostBuryQueryContextConditionInputRepresentation') {
729
+ const v_error = (() => {
730
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
731
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
732
+ }
733
+ const obj_locales = obj.locales;
734
+ const path_locales = path + '.locales';
735
+ if (!ArrayIsArray(obj_locales)) {
736
+ return new TypeError('Expected "array" but received "' + typeof obj_locales + '" (at "' + path_locales + '")');
737
+ }
738
+ for (let i = 0; i < obj_locales.length; i++) {
739
+ const obj_locales_item = obj_locales[i];
740
+ const path_locales_item = path_locales + '[' + i + ']';
741
+ if (typeof obj_locales_item !== 'string') {
742
+ return new TypeError('Expected "string" but received "' + typeof obj_locales_item + '" (at "' + path_locales_item + '")');
743
+ }
744
+ }
745
+ const obj_type = obj.type;
746
+ const path_type = path + '.type';
747
+ if (typeof obj_type !== 'string') {
748
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
749
+ }
750
+ const obj_values = obj.values;
751
+ const path_values = path + '.values';
752
+ if (!ArrayIsArray(obj_values)) {
753
+ return new TypeError('Expected "array" but received "' + typeof obj_values + '" (at "' + path_values + '")');
754
+ }
755
+ for (let i = 0; i < obj_values.length; i++) {
756
+ const obj_values_item = obj_values[i];
757
+ const path_values_item = path_values + '[' + i + ']';
758
+ if (typeof obj_values_item !== 'string') {
759
+ return new TypeError('Expected "string" but received "' + typeof obj_values_item + '" (at "' + path_values_item + '")');
760
+ }
761
+ }
762
+ })();
763
+ return v_error === undefined ? null : v_error;
764
+ }
765
+
766
+ function validate$9(obj, path = 'BoostBuryQueryContextInputRepresentation') {
767
+ const v_error = (() => {
768
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
769
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
770
+ }
771
+ const obj_conditions = obj.conditions;
772
+ const path_conditions = path + '.conditions';
773
+ if (!ArrayIsArray(obj_conditions)) {
774
+ return new TypeError('Expected "array" but received "' + typeof obj_conditions + '" (at "' + path_conditions + '")');
775
+ }
776
+ for (let i = 0; i < obj_conditions.length; i++) {
777
+ const obj_conditions_item = obj_conditions[i];
778
+ const path_conditions_item = path_conditions + '[' + i + ']';
779
+ const referencepath_conditions_itemValidationError = validate$a(obj_conditions_item, path_conditions_item);
780
+ if (referencepath_conditions_itemValidationError !== null) {
781
+ let message = 'Object doesn\'t match BoostBuryQueryContextConditionInputRepresentation (at "' + path_conditions_item + '")\n';
782
+ message += referencepath_conditions_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
783
+ return new TypeError(message);
784
+ }
785
+ }
786
+ })();
787
+ return v_error === undefined ? null : v_error;
788
+ }
789
+
790
+ function validate$8(obj, path = 'BoostBuryConditionInputRepresentation') {
791
+ const v_error = (() => {
792
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
793
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
794
+ }
795
+ const obj_attributeNameOrId = obj.attributeNameOrId;
796
+ const path_attributeNameOrId = path + '.attributeNameOrId';
797
+ if (typeof obj_attributeNameOrId !== 'string') {
798
+ return new TypeError('Expected "string" but received "' + typeof obj_attributeNameOrId + '" (at "' + path_attributeNameOrId + '")');
799
+ }
800
+ const obj_attributeType = obj.attributeType;
801
+ const path_attributeType = path + '.attributeType';
802
+ if (typeof obj_attributeType !== 'string') {
803
+ return new TypeError('Expected "string" but received "' + typeof obj_attributeType + '" (at "' + path_attributeType + '")');
804
+ }
805
+ const obj_values = obj.values;
806
+ const path_values = path + '.values';
807
+ if (!ArrayIsArray(obj_values)) {
808
+ return new TypeError('Expected "array" but received "' + typeof obj_values + '" (at "' + path_values + '")');
809
+ }
810
+ for (let i = 0; i < obj_values.length; i++) {
811
+ const obj_values_item = obj_values[i];
812
+ const path_values_item = path_values + '[' + i + ']';
813
+ if (typeof obj_values_item !== 'string') {
814
+ return new TypeError('Expected "string" but received "' + typeof obj_values_item + '" (at "' + path_values_item + '")');
815
+ }
816
+ }
817
+ })();
818
+ return v_error === undefined ? null : v_error;
819
+ }
820
+
821
+ function validate$7(obj, path = 'BoostBuryTargetExpressionInputRepresentation') {
822
+ const v_error = (() => {
823
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
824
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
825
+ }
826
+ const obj_conditions = obj.conditions;
827
+ const path_conditions = path + '.conditions';
828
+ if (!ArrayIsArray(obj_conditions)) {
829
+ return new TypeError('Expected "array" but received "' + typeof obj_conditions + '" (at "' + path_conditions + '")');
830
+ }
831
+ for (let i = 0; i < obj_conditions.length; i++) {
832
+ const obj_conditions_item = obj_conditions[i];
833
+ const path_conditions_item = path_conditions + '[' + i + ']';
834
+ const referencepath_conditions_itemValidationError = validate$8(obj_conditions_item, path_conditions_item);
835
+ if (referencepath_conditions_itemValidationError !== null) {
836
+ let message = 'Object doesn\'t match BoostBuryConditionInputRepresentation (at "' + path_conditions_item + '")\n';
837
+ message += referencepath_conditions_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
838
+ return new TypeError(message);
839
+ }
840
+ }
841
+ })();
842
+ return v_error === undefined ? null : v_error;
843
+ }
844
+
845
+ function select$6(luvio, params) {
846
+ return select$9();
847
+ }
848
+ function getResponseCacheKeys$5(storeKeyMap, luvio, resourceParams, response) {
849
+ getTypeCacheKeys$3(storeKeyMap, luvio, response);
850
+ }
851
+ function ingestSuccess$4(luvio, resourceParams, response) {
852
+ const { body } = response;
853
+ const key = keyBuilderFromType(luvio, body);
854
+ luvio.storeIngest(key, ingest$3, body);
855
+ const snapshot = luvio.storeLookup({
856
+ recordId: key,
857
+ node: select$6(),
858
+ variables: {},
859
+ });
860
+ if (process.env.NODE_ENV !== 'production') {
861
+ if (snapshot.state !== 'Fulfilled') {
862
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
863
+ }
864
+ }
865
+ deepFreeze(snapshot.data);
866
+ return snapshot;
867
+ }
868
+ function createResourceRequest$5(config) {
869
+ const headers = {};
870
+ return {
871
+ baseUri: '/services/data/v64.0',
872
+ basePath: '/commerce/management/webstores/' + config.urlParams.webstoreId + '/search/boost-bury-rules',
873
+ method: 'post',
874
+ body: config.body,
875
+ urlParams: config.urlParams,
876
+ queryParams: {},
877
+ headers,
878
+ priority: 'normal',
879
+ };
880
+ }
881
+
882
+ const adapterName$5 = 'createSearchBoostBuryRule';
883
+ const createSearchBoostBuryRule_ConfigPropertyMetadata = [
884
+ generateParamConfigMetadata('webstoreId', true, 0 /* UrlParameter */, 0 /* String */),
885
+ generateParamConfigMetadata('action', true, 2 /* Body */, 0 /* String */),
886
+ generateParamConfigMetadata('endDate', true, 2 /* Body */, 0 /* String */),
887
+ generateParamConfigMetadata('level', true, 2 /* Body */, 3 /* Integer */),
888
+ generateParamConfigMetadata('name', true, 2 /* Body */, 0 /* String */),
889
+ generateParamConfigMetadata('queryContext', true, 2 /* Body */, 4 /* Unsupported */),
890
+ generateParamConfigMetadata('startDate', true, 2 /* Body */, 0 /* String */),
891
+ generateParamConfigMetadata('targetExpression', true, 2 /* Body */, 4 /* Unsupported */),
892
+ ];
893
+ const createSearchBoostBuryRule_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$5, createSearchBoostBuryRule_ConfigPropertyMetadata);
894
+ const createResourceParams$5 = /*#__PURE__*/ createResourceParams$7(createSearchBoostBuryRule_ConfigPropertyMetadata);
895
+ function typeCheckConfig$5(untrustedConfig) {
896
+ const config = {};
897
+ typeCheckConfig$7(untrustedConfig, config, createSearchBoostBuryRule_ConfigPropertyMetadata);
898
+ const untrustedConfig_queryContext = untrustedConfig.queryContext;
899
+ const referenceBoostBuryQueryContextInputRepresentationValidationError = validate$9(untrustedConfig_queryContext);
900
+ if (referenceBoostBuryQueryContextInputRepresentationValidationError === null) {
901
+ config.queryContext = untrustedConfig_queryContext;
902
+ }
903
+ const untrustedConfig_targetExpression = untrustedConfig.targetExpression;
904
+ const referenceBoostBuryTargetExpressionInputRepresentationValidationError = validate$7(untrustedConfig_targetExpression);
905
+ if (referenceBoostBuryTargetExpressionInputRepresentationValidationError === null) {
906
+ config.targetExpression = untrustedConfig_targetExpression;
907
+ }
908
+ return config;
909
+ }
910
+ function validateAdapterConfig$5(untrustedConfig, configPropertyNames) {
911
+ if (!untrustedIsObject(untrustedConfig)) {
912
+ return null;
913
+ }
914
+ if (process.env.NODE_ENV !== 'production') {
915
+ validateConfig(untrustedConfig, configPropertyNames);
916
+ }
917
+ const config = typeCheckConfig$5(untrustedConfig);
918
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
919
+ return null;
920
+ }
921
+ return config;
922
+ }
923
+ function buildNetworkSnapshot$5(luvio, config, options) {
924
+ const resourceParams = createResourceParams$5(config);
925
+ const request = createResourceRequest$5(resourceParams);
926
+ return luvio.dispatchResourceRequest(request, options)
927
+ .then((response) => {
928
+ return luvio.handleSuccessResponse(() => {
929
+ const snapshot = ingestSuccess$4(luvio, resourceParams, response);
930
+ return luvio.storeBroadcast().then(() => snapshot);
931
+ }, () => {
932
+ const cache = new StoreKeyMap();
933
+ getResponseCacheKeys$5(cache, luvio, resourceParams, response.body);
934
+ return cache;
935
+ });
936
+ }, (response) => {
937
+ deepFreeze(response);
938
+ throw response;
939
+ });
940
+ }
941
+ const createSearchBoostBuryRuleAdapterFactory = (luvio) => {
942
+ return function createSearchBoostBuryRule(untrustedConfig) {
943
+ const config = validateAdapterConfig$5(untrustedConfig, createSearchBoostBuryRule_ConfigPropertyNames);
944
+ // Invalid or incomplete config
945
+ if (config === null) {
946
+ throw new Error('Invalid config for "createSearchBoostBuryRule"');
947
+ }
948
+ return buildNetworkSnapshot$5(luvio, config);
949
+ };
950
+ };
951
+
952
+ function keyBuilder$6(luvio, params) {
953
+ return keyBuilder$9(luvio, {
954
+ id: params.urlParams.ruleId
955
+ });
956
+ }
957
+ function getResponseCacheKeys$4(cacheKeyMap, luvio, resourceParams) {
958
+ const key = keyBuilder$6(luvio, resourceParams);
959
+ cacheKeyMap.set(key, {
960
+ namespace: keyPrefix,
961
+ representationName: RepresentationType$3,
962
+ mergeable: false
963
+ });
964
+ }
965
+ function evictSuccess(luvio, resourceParams) {
966
+ const key = keyBuilder$6(luvio, resourceParams);
967
+ luvio.storeEvict(key);
968
+ }
969
+ function createResourceRequest$4(config) {
970
+ const headers = {};
971
+ return {
972
+ baseUri: '/services/data/v64.0',
973
+ basePath: '/commerce/management/webstores/' + config.urlParams.webstoreId + '/search/boost-bury-rules/' + config.urlParams.ruleId + '',
974
+ method: 'delete',
975
+ body: null,
976
+ urlParams: config.urlParams,
977
+ queryParams: {},
978
+ headers,
979
+ priority: 'normal',
980
+ };
981
+ }
982
+
983
+ const adapterName$4 = 'deleteSearchBoostBuryRule';
984
+ const deleteSearchBoostBuryRule_ConfigPropertyMetadata = [
985
+ generateParamConfigMetadata('ruleId', true, 0 /* UrlParameter */, 0 /* String */),
986
+ generateParamConfigMetadata('webstoreId', true, 0 /* UrlParameter */, 0 /* String */),
987
+ ];
988
+ const deleteSearchBoostBuryRule_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$4, deleteSearchBoostBuryRule_ConfigPropertyMetadata);
989
+ const createResourceParams$4 = /*#__PURE__*/ createResourceParams$7(deleteSearchBoostBuryRule_ConfigPropertyMetadata);
990
+ function typeCheckConfig$4(untrustedConfig) {
991
+ const config = {};
992
+ typeCheckConfig$7(untrustedConfig, config, deleteSearchBoostBuryRule_ConfigPropertyMetadata);
993
+ return config;
994
+ }
995
+ function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
996
+ if (!untrustedIsObject(untrustedConfig)) {
997
+ return null;
998
+ }
999
+ if (process.env.NODE_ENV !== 'production') {
1000
+ validateConfig(untrustedConfig, configPropertyNames);
1001
+ }
1002
+ const config = typeCheckConfig$4(untrustedConfig);
1003
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1004
+ return null;
1005
+ }
1006
+ return config;
1007
+ }
1008
+ function buildNetworkSnapshot$4(luvio, config, options) {
1009
+ const resourceParams = createResourceParams$4(config);
1010
+ const request = createResourceRequest$4(resourceParams);
1011
+ return luvio.dispatchResourceRequest(request, options)
1012
+ .then(() => {
1013
+ return luvio.handleSuccessResponse(() => {
1014
+ evictSuccess(luvio, resourceParams);
1015
+ return luvio.storeBroadcast();
1016
+ }, () => {
1017
+ const cache = new StoreKeyMap();
1018
+ getResponseCacheKeys$4(cache, luvio, resourceParams);
1019
+ return cache;
1020
+ });
1021
+ }, (response) => {
1022
+ deepFreeze(response);
1023
+ throw response;
1024
+ });
1025
+ }
1026
+ const deleteSearchBoostBuryRuleAdapterFactory = (luvio) => {
1027
+ return function CommercedeleteSearchBoostBuryRule(untrustedConfig) {
1028
+ const config = validateAdapterConfig$4(untrustedConfig, deleteSearchBoostBuryRule_ConfigPropertyNames);
1029
+ // Invalid or incomplete config
1030
+ if (config === null) {
1031
+ throw new Error(`Invalid config for "${adapterName$4}"`);
1032
+ }
1033
+ return buildNetworkSnapshot$4(luvio, config);
1034
+ };
1035
+ };
1036
+
1037
+ function select$5(luvio, params) {
1038
+ return select$9();
1039
+ }
1040
+ function keyBuilder$5(luvio, params) {
1041
+ return keyBuilder$9(luvio, {
1042
+ id: params.urlParams.ruleId
1043
+ });
1044
+ }
1045
+ function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
1046
+ getTypeCacheKeys$3(storeKeyMap, luvio, response);
1047
+ }
1048
+ function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
1049
+ const { body } = response;
1050
+ const key = keyBuilder$5(luvio, resourceParams);
1051
+ luvio.storeIngest(key, ingest$3, body);
1052
+ const snapshot = luvio.storeLookup({
1053
+ recordId: key,
1054
+ node: select$5(),
1055
+ variables: {},
1056
+ }, snapshotRefresh);
1057
+ if (process.env.NODE_ENV !== 'production') {
1058
+ if (snapshot.state !== 'Fulfilled') {
1059
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1060
+ }
1061
+ }
1062
+ deepFreeze(snapshot.data);
1063
+ return snapshot;
1064
+ }
1065
+ function ingestError$2(luvio, params, error, snapshotRefresh) {
1066
+ const key = keyBuilder$5(luvio, params);
1067
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1068
+ luvio.storeIngestError(key, errorSnapshot);
1069
+ return errorSnapshot;
1070
+ }
1071
+ function createResourceRequest$3(config) {
1072
+ const headers = {};
1073
+ return {
1074
+ baseUri: '/services/data/v64.0',
1075
+ basePath: '/commerce/management/webstores/' + config.urlParams.webstoreId + '/search/boost-bury-rules/' + config.urlParams.ruleId + '',
1076
+ method: 'get',
1077
+ body: null,
1078
+ urlParams: config.urlParams,
1079
+ queryParams: {},
1080
+ headers,
1081
+ priority: 'normal',
1082
+ };
1083
+ }
1084
+
1085
+ const adapterName$3 = 'getSearchBoostBuryRule';
1086
+ const getSearchBoostBuryRule_ConfigPropertyMetadata = [
1087
+ generateParamConfigMetadata('ruleId', true, 0 /* UrlParameter */, 0 /* String */),
1088
+ generateParamConfigMetadata('webstoreId', true, 0 /* UrlParameter */, 0 /* String */),
1089
+ ];
1090
+ const getSearchBoostBuryRule_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, getSearchBoostBuryRule_ConfigPropertyMetadata);
1091
+ const createResourceParams$3 = /*#__PURE__*/ createResourceParams$7(getSearchBoostBuryRule_ConfigPropertyMetadata);
1092
+ function keyBuilder$4(luvio, config) {
1093
+ const resourceParams = createResourceParams$3(config);
1094
+ return keyBuilder$5(luvio, resourceParams);
1095
+ }
1096
+ function typeCheckConfig$3(untrustedConfig) {
1097
+ const config = {};
1098
+ typeCheckConfig$7(untrustedConfig, config, getSearchBoostBuryRule_ConfigPropertyMetadata);
1099
+ return config;
1100
+ }
1101
+ function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
1102
+ if (!untrustedIsObject(untrustedConfig)) {
1103
+ return null;
1104
+ }
1105
+ if (process.env.NODE_ENV !== 'production') {
1106
+ validateConfig(untrustedConfig, configPropertyNames);
1107
+ }
1108
+ const config = typeCheckConfig$3(untrustedConfig);
1109
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1110
+ return null;
1111
+ }
1112
+ return config;
1113
+ }
1114
+ function adapterFragment$2(luvio, config) {
1115
+ createResourceParams$3(config);
1116
+ return select$5();
1117
+ }
1118
+ function onFetchResponseSuccess$2(luvio, config, resourceParams, response) {
1119
+ const snapshot = ingestSuccess$3(luvio, resourceParams, response, {
1120
+ config,
1121
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
1122
+ });
1123
+ return luvio.storeBroadcast().then(() => snapshot);
1124
+ }
1125
+ function onFetchResponseError$2(luvio, config, resourceParams, response) {
1126
+ const snapshot = ingestError$2(luvio, resourceParams, response, {
1127
+ config,
1128
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
1129
+ });
1130
+ return luvio.storeBroadcast().then(() => snapshot);
1131
+ }
1132
+ function buildNetworkSnapshot$3(luvio, config, options) {
1133
+ const resourceParams = createResourceParams$3(config);
1134
+ const request = createResourceRequest$3(resourceParams);
1135
+ return luvio.dispatchResourceRequest(request, options)
1136
+ .then((response) => {
1137
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$2(luvio, config, resourceParams, response), () => {
1138
+ const cache = new StoreKeyMap();
1139
+ getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
1140
+ return cache;
1141
+ });
1142
+ }, (response) => {
1143
+ return luvio.handleErrorResponse(() => onFetchResponseError$2(luvio, config, resourceParams, response));
1144
+ });
1145
+ }
1146
+ function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
1147
+ return buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext, buildNetworkSnapshot$3, undefined, false);
1148
+ }
1149
+ function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
1150
+ const { luvio, config } = context;
1151
+ const selector = {
1152
+ recordId: keyBuilder$4(luvio, config),
1153
+ node: adapterFragment$2(luvio, config),
1154
+ variables: {},
1155
+ };
1156
+ const cacheSnapshot = storeLookup(selector, {
1157
+ config,
1158
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
1159
+ });
1160
+ return cacheSnapshot;
1161
+ }
1162
+ const getSearchBoostBuryRuleAdapterFactory = (luvio) => function Commerce__getSearchBoostBuryRule(untrustedConfig, requestContext) {
1163
+ const config = validateAdapterConfig$3(untrustedConfig, getSearchBoostBuryRule_ConfigPropertyNames);
1164
+ // Invalid or incomplete config
1165
+ if (config === null) {
1166
+ return null;
1167
+ }
1168
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1169
+ buildCachedSnapshotCachePolicy$2, buildNetworkSnapshotCachePolicy$2);
1170
+ };
1171
+
1172
+ function select$4(luvio, params) {
1173
+ return select$9();
1174
+ }
1175
+ function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
1176
+ getTypeCacheKeys$3(storeKeyMap, luvio, response);
1177
+ }
1178
+ function ingestSuccess$2(luvio, resourceParams, response) {
1179
+ const { body } = response;
1180
+ const key = keyBuilderFromType(luvio, body);
1181
+ luvio.storeIngest(key, ingest$3, body);
1182
+ const snapshot = luvio.storeLookup({
1183
+ recordId: key,
1184
+ node: select$4(),
1185
+ variables: {},
1186
+ });
1187
+ if (process.env.NODE_ENV !== 'production') {
1188
+ if (snapshot.state !== 'Fulfilled') {
1189
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1190
+ }
1191
+ }
1192
+ deepFreeze(snapshot.data);
1193
+ return snapshot;
1194
+ }
1195
+ function createResourceRequest$2(config) {
1196
+ const headers = {};
1197
+ return {
1198
+ baseUri: '/services/data/v64.0',
1199
+ basePath: '/commerce/management/webstores/' + config.urlParams.webstoreId + '/search/boost-bury-rules/' + config.urlParams.ruleId + '',
1200
+ method: 'patch',
1201
+ body: config.body,
1202
+ urlParams: config.urlParams,
1203
+ queryParams: {},
1204
+ headers,
1205
+ priority: 'normal',
1206
+ };
1207
+ }
1208
+
1209
+ const adapterName$2 = 'updateSearchBoostBuryRule';
1210
+ const updateSearchBoostBuryRule_ConfigPropertyMetadata = [
1211
+ generateParamConfigMetadata('ruleId', true, 0 /* UrlParameter */, 0 /* String */),
1212
+ generateParamConfigMetadata('webstoreId', true, 0 /* UrlParameter */, 0 /* String */),
1213
+ generateParamConfigMetadata('action', true, 2 /* Body */, 0 /* String */),
1214
+ generateParamConfigMetadata('endDate', true, 2 /* Body */, 0 /* String */),
1215
+ generateParamConfigMetadata('level', true, 2 /* Body */, 3 /* Integer */),
1216
+ generateParamConfigMetadata('name', true, 2 /* Body */, 0 /* String */),
1217
+ generateParamConfigMetadata('queryContext', true, 2 /* Body */, 4 /* Unsupported */),
1218
+ generateParamConfigMetadata('startDate', true, 2 /* Body */, 0 /* String */),
1219
+ generateParamConfigMetadata('targetExpression', true, 2 /* Body */, 4 /* Unsupported */),
1220
+ ];
1221
+ const updateSearchBoostBuryRule_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, updateSearchBoostBuryRule_ConfigPropertyMetadata);
1222
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$7(updateSearchBoostBuryRule_ConfigPropertyMetadata);
1223
+ function typeCheckConfig$2(untrustedConfig) {
1224
+ const config = {};
1225
+ typeCheckConfig$7(untrustedConfig, config, updateSearchBoostBuryRule_ConfigPropertyMetadata);
1226
+ const untrustedConfig_queryContext = untrustedConfig.queryContext;
1227
+ const referenceBoostBuryQueryContextInputRepresentationValidationError = validate$9(untrustedConfig_queryContext);
1228
+ if (referenceBoostBuryQueryContextInputRepresentationValidationError === null) {
1229
+ config.queryContext = untrustedConfig_queryContext;
1230
+ }
1231
+ const untrustedConfig_targetExpression = untrustedConfig.targetExpression;
1232
+ const referenceBoostBuryTargetExpressionInputRepresentationValidationError = validate$7(untrustedConfig_targetExpression);
1233
+ if (referenceBoostBuryTargetExpressionInputRepresentationValidationError === null) {
1234
+ config.targetExpression = untrustedConfig_targetExpression;
1235
+ }
1236
+ return config;
1237
+ }
1238
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
1239
+ if (!untrustedIsObject(untrustedConfig)) {
1240
+ return null;
1241
+ }
1242
+ if (process.env.NODE_ENV !== 'production') {
1243
+ validateConfig(untrustedConfig, configPropertyNames);
1244
+ }
1245
+ const config = typeCheckConfig$2(untrustedConfig);
1246
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1247
+ return null;
1248
+ }
1249
+ return config;
1250
+ }
1251
+ function buildNetworkSnapshot$2(luvio, config, options) {
1252
+ const resourceParams = createResourceParams$2(config);
1253
+ const request = createResourceRequest$2(resourceParams);
1254
+ return luvio.dispatchResourceRequest(request, options)
1255
+ .then((response) => {
1256
+ return luvio.handleSuccessResponse(() => {
1257
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response);
1258
+ return luvio.storeBroadcast().then(() => snapshot);
1259
+ }, () => {
1260
+ const cache = new StoreKeyMap();
1261
+ getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
1262
+ return cache;
1263
+ });
1264
+ }, (response) => {
1265
+ deepFreeze(response);
1266
+ throw response;
1267
+ });
1268
+ }
1269
+ const updateSearchBoostBuryRuleAdapterFactory = (luvio) => {
1270
+ return function updateSearchBoostBuryRule(untrustedConfig) {
1271
+ const config = validateAdapterConfig$2(untrustedConfig, updateSearchBoostBuryRule_ConfigPropertyNames);
1272
+ // Invalid or incomplete config
1273
+ if (config === null) {
1274
+ throw new Error('Invalid config for "updateSearchBoostBuryRule"');
1275
+ }
1276
+ return buildNetworkSnapshot$2(luvio, config);
1277
+ };
1278
+ };
1279
+
139
1280
  function validate$6(obj, path = 'SearchCategoryRepresentation') {
140
1281
  const v_error = (() => {
141
1282
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
@@ -456,14 +1597,14 @@ const productSearch_ConfigPropertyMetadata = [
456
1597
  generateParamConfigMetadata('sortOrderId', true, 2 /* Body */, 0 /* String */),
457
1598
  ];
458
1599
  const productSearch_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, productSearch_ConfigPropertyMetadata);
459
- const createResourceParams$1 = /*#__PURE__*/ createResourceParams$2(productSearch_ConfigPropertyMetadata);
1600
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$7(productSearch_ConfigPropertyMetadata);
460
1601
  function keyBuilder$2(luvio, config) {
461
1602
  const resourceParams = createResourceParams$1(config);
462
1603
  return keyBuilder$3(luvio, resourceParams);
463
1604
  }
464
1605
  function typeCheckConfig$1(untrustedConfig) {
465
1606
  const config = {};
466
- typeCheckConfig$2(untrustedConfig, config, productSearch_ConfigPropertyMetadata);
1607
+ typeCheckConfig$7(untrustedConfig, config, productSearch_ConfigPropertyMetadata);
467
1608
  const untrustedConfig_refinements = untrustedConfig.refinements;
468
1609
  if (ArrayIsArray$1(untrustedConfig_refinements)) {
469
1610
  const untrustedConfig_refinements_array = [];
@@ -526,7 +1667,7 @@ function buildNetworkSnapshot$1(luvio, config, options) {
526
1667
  });
527
1668
  }
528
1669
  function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
529
- return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, 'get', false);
1670
+ return buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, 'get', false);
530
1671
  }
531
1672
  function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
532
1673
  const { luvio, config } = context;
@@ -688,14 +1829,14 @@ const getSuggestions_ConfigPropertyMetadata = [
688
1829
  generateParamConfigMetadata('searchTerm', false, 1 /* QueryParameter */, 0 /* String */),
689
1830
  ];
690
1831
  const getSuggestions_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getSuggestions_ConfigPropertyMetadata);
691
- const createResourceParams = /*#__PURE__*/ createResourceParams$2(getSuggestions_ConfigPropertyMetadata);
1832
+ const createResourceParams = /*#__PURE__*/ createResourceParams$7(getSuggestions_ConfigPropertyMetadata);
692
1833
  function keyBuilder(luvio, config) {
693
1834
  const resourceParams = createResourceParams(config);
694
1835
  return keyBuilder$1(luvio, resourceParams);
695
1836
  }
696
1837
  function typeCheckConfig(untrustedConfig) {
697
1838
  const config = {};
698
- typeCheckConfig$2(untrustedConfig, config, getSuggestions_ConfigPropertyMetadata);
1839
+ typeCheckConfig$7(untrustedConfig, config, getSuggestions_ConfigPropertyMetadata);
699
1840
  return config;
700
1841
  }
701
1842
  function validateAdapterConfig(untrustedConfig, configPropertyNames) {
@@ -744,7 +1885,7 @@ function buildNetworkSnapshot(luvio, config, options) {
744
1885
  });
745
1886
  }
746
1887
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
747
- return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
1888
+ return buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
748
1889
  }
749
1890
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
750
1891
  const { luvio, config } = context;
@@ -769,4 +1910,4 @@ const getSuggestionsAdapterFactory = (luvio) => function Commerce__getSuggestion
769
1910
  buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
770
1911
  };
771
1912
 
772
- export { getSuggestionsAdapterFactory, productSearchAdapterFactory };
1913
+ export { createSearchBoostBuryRuleAdapterFactory, deleteSearchBoostBuryRuleAdapterFactory, getSearchBoostBuryRuleAdapterFactory, getSearchBoostBuryRulesAdapterFactory, getSuggestionsAdapterFactory, productSearchAdapterFactory, updateSearchBoostBuryRuleAdapterFactory };