@salesforce/lds-adapters-commerce-search 0.1.0-dev1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +82 -0
- package/dist/es/es2018/commerce-search.js +1922 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/createSearchBoostBuryRule.d.ts +24 -0
- package/dist/es/es2018/types/src/generated/adapters/deleteSearchBoostBuryRule.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/adapters/getSearchBoostBuryRule.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/adapters/getSearchBoostBuryRules.d.ts +27 -0
- package/dist/es/es2018/types/src/generated/adapters/getSuggestions.d.ts +30 -0
- package/dist/es/es2018/types/src/generated/adapters/productSearch.d.ts +35 -0
- package/dist/es/es2018/types/src/generated/adapters/updateSearchBoostBuryRule.d.ts +25 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +7 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +13 -0
- package/dist/es/es2018/types/src/generated/resources/deleteCommerceManagementWebstoresSearchBoostBuryRulesByRuleIdAndWebstoreId.d.ts +13 -0
- package/dist/es/es2018/types/src/generated/resources/deleteCommerceManagementWebstoresSearchIndexesByIndexIdAndWebstoreId.d.ts +12 -0
- package/dist/es/es2018/types/src/generated/resources/getCommerceManagementWebstoresSearchAttributeSettingsFacetableFieldsByWebstoreId.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/resources/getCommerceManagementWebstoresSearchAttributeSettingsSearchableFieldsByWebstoreId.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/resources/getCommerceManagementWebstoresSearchBoostBuryRulesByRuleIdAndWebstoreId.d.ts +17 -0
- package/dist/es/es2018/types/src/generated/resources/getCommerceManagementWebstoresSearchBoostBuryRulesByWebstoreId.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/resources/getCommerceManagementWebstoresSearchIndexesByIndexIdAndWebstoreId.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/resources/getCommerceManagementWebstoresSearchIndexesByWebstoreId.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/resources/getCommerceManagementWebstoresSearchProductSettingsByWebstoreId.d.ts +18 -0
- package/dist/es/es2018/types/src/generated/resources/getCommerceWebstoresSearchSuggestionsByWebstoreId.d.ts +20 -0
- package/dist/es/es2018/types/src/generated/resources/patchCommerceManagementWebstoresSearchAttributeSettingsSearchableFieldsByWebstoreId.d.ts +12 -0
- package/dist/es/es2018/types/src/generated/resources/patchCommerceManagementWebstoresSearchBoostBuryRulesByRuleIdAndWebstoreId.d.ts +24 -0
- package/dist/es/es2018/types/src/generated/resources/patchCommerceManagementWebstoresSearchProductSettingsByWebstoreId.d.ts +12 -0
- package/dist/es/es2018/types/src/generated/resources/postCommerceManagementWebstoresSearchBoostBuryRulesByWebstoreId.d.ts +23 -0
- package/dist/es/es2018/types/src/generated/resources/postCommerceWebstoresSearchProductSearchByWebstoreId.d.ts +27 -0
- package/dist/es/es2018/types/src/generated/resources/putCommerceManagementWebstoresSearchAttributeSettingsFacetableFieldsByWebstoreId.d.ts +12 -0
- package/dist/es/es2018/types/src/generated/types/BoostBuryConditionInputRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/BoostBuryConditionOutputRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/BoostBuryQueryContextConditionInputRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/BoostBuryQueryContextConditionOutputRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/BoostBuryQueryContextInputRepresentation.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/BoostBuryQueryContextOutputRepresentation.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/BoostBuryTargetExpressionInputRepresentation.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/BoostBuryTargetExpressionOutputRepresentation.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/CommerceSearchIndexCollectionOutputRepresentation.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/CommerceSearchIndexOutputRepresentation.d.ts +46 -0
- package/dist/es/es2018/types/src/generated/types/DistinctFacetValueRepresentation.d.ts +36 -0
- package/dist/es/es2018/types/src/generated/types/DistinctValueSearchFacetRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/FacetValueRepresentation.d.ts +33 -0
- package/dist/es/es2018/types/src/generated/types/FacetableAttributeInputRepresentation.d.ts +37 -0
- package/dist/es/es2018/types/src/generated/types/FacetableAttributeOutputRepresentation.d.ts +40 -0
- package/dist/es/es2018/types/src/generated/types/FacetableAttributesCollectionInputRepresentation.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/types/FacetableAttributesCollectionOutputRepresentation.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/ProductSearchInputRepresentation.d.ts +46 -0
- package/dist/es/es2018/types/src/generated/types/ProductSearchResultsRepresentation.d.ts +39 -0
- package/dist/es/es2018/types/src/generated/types/ProductSearchSuggestionsResultsRepresentation.d.ts +32 -0
- package/dist/es/es2018/types/src/generated/types/ProductSummaryCollectionRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/ProductSummaryRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/RefinementInputRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/SearchBoostBuryRuleInputRepresentation.d.ts +48 -0
- package/dist/es/es2018/types/src/generated/types/SearchBoostBuryRuleOutputRepresentation.d.ts +71 -0
- package/dist/es/es2018/types/src/generated/types/SearchBoostBuryRulesCollectionOutputRepresentation.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/SearchCategoryRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/SearchFacetRepresentation.d.ts +48 -0
- package/dist/es/es2018/types/src/generated/types/SearchProductSettingCollectionInputRepresentation.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/types/SearchProductSettingCollectionOutputRepresentation.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/SearchProductSettingInputRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/SearchProductSettingOutputRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/SearchableAttributeInputRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/SearchableAttributeOutputRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/SearchableAttributesCollectionInputRepresentation.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/types/SearchableAttributesCollectionOutputRepresentation.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/SuggestedCompletionRepresentation.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
- package/dist/es/es2018/types/src/main.d.ts +6 -0
- package/dist/es/es2018/types/src/raml-artifacts/types/SearchBoostBuryRulesCollectionOutputRepresentation/notifyUpdateAvailableFactory.d.ts +2 -0
- package/dist/es/es2018/types/src/sfdc.d.ts +7 -0
- package/package.json +61 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +2049 -0
- package/src/raml/api.raml +870 -0
- package/src/raml/luvio.raml +122 -0
package/sfdc/index.js
ADDED
|
@@ -0,0 +1,2049 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* ATTENTION!
|
|
9
|
+
* THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
|
|
10
|
+
* If you would like to contribute to LDS, please follow the steps outlined in the git repo.
|
|
11
|
+
* Any changes made to this file in p4 will be automatically overwritten.
|
|
12
|
+
* *******************************************************************************************
|
|
13
|
+
*/
|
|
14
|
+
/* proxy-compat-disable */
|
|
15
|
+
import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
|
|
16
|
+
import { withDefaultLuvio } from 'force/ldsEngine';
|
|
17
|
+
import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$7, typeCheckConfig as typeCheckConfig$7, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$4 } from 'force/luvioEngine';
|
|
18
|
+
|
|
19
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
20
|
+
const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
|
|
21
|
+
const { stringify: JSONStringify$1 } = JSON;
|
|
22
|
+
const { isArray: ArrayIsArray$1 } = Array;
|
|
23
|
+
/**
|
|
24
|
+
* Validates an adapter config is well-formed.
|
|
25
|
+
* @param config The config to validate.
|
|
26
|
+
* @param adapter The adapter validation configuration.
|
|
27
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
28
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
29
|
+
*/
|
|
30
|
+
function validateConfig(config, adapter, oneOf) {
|
|
31
|
+
const { displayName } = adapter;
|
|
32
|
+
const { required, optional, unsupported } = adapter.parameters;
|
|
33
|
+
if (config === undefined ||
|
|
34
|
+
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
35
|
+
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
36
|
+
}
|
|
37
|
+
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
38
|
+
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
39
|
+
}
|
|
40
|
+
if (unsupported !== undefined &&
|
|
41
|
+
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
42
|
+
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
43
|
+
}
|
|
44
|
+
const supported = required.concat(optional);
|
|
45
|
+
if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
|
|
46
|
+
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function untrustedIsObject(untrusted) {
|
|
50
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
51
|
+
}
|
|
52
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
53
|
+
return configPropertyNames.parameters.required.every(req => req in config);
|
|
54
|
+
}
|
|
55
|
+
const snapshotRefreshOptions = {
|
|
56
|
+
overrides: {
|
|
57
|
+
headers: {
|
|
58
|
+
'Cache-Control': 'no-cache',
|
|
59
|
+
},
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* A deterministic JSON stringify implementation. Heavily adapted from https://github.com/epoberezkin/fast-json-stable-stringify.
|
|
64
|
+
* This is needed because insertion order for JSON.stringify(object) affects output:
|
|
65
|
+
* JSON.stringify({a: 1, b: 2})
|
|
66
|
+
* "{"a":1,"b":2}"
|
|
67
|
+
* JSON.stringify({b: 2, a: 1})
|
|
68
|
+
* "{"b":2,"a":1}"
|
|
69
|
+
* @param data Data to be JSON-stringified.
|
|
70
|
+
* @returns JSON.stringified value with consistent ordering of keys.
|
|
71
|
+
*/
|
|
72
|
+
function stableJSONStringify(node) {
|
|
73
|
+
// This is for Date values.
|
|
74
|
+
if (node && node.toJSON && typeof node.toJSON === 'function') {
|
|
75
|
+
// eslint-disable-next-line no-param-reassign
|
|
76
|
+
node = node.toJSON();
|
|
77
|
+
}
|
|
78
|
+
if (node === undefined) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (typeof node === 'number') {
|
|
82
|
+
return isFinite(node) ? '' + node : 'null';
|
|
83
|
+
}
|
|
84
|
+
if (typeof node !== 'object') {
|
|
85
|
+
return JSONStringify$1(node);
|
|
86
|
+
}
|
|
87
|
+
let i;
|
|
88
|
+
let out;
|
|
89
|
+
if (ArrayIsArray$1(node)) {
|
|
90
|
+
out = '[';
|
|
91
|
+
for (i = 0; i < node.length; i++) {
|
|
92
|
+
if (i) {
|
|
93
|
+
out += ',';
|
|
94
|
+
}
|
|
95
|
+
out += stableJSONStringify(node[i]) || 'null';
|
|
96
|
+
}
|
|
97
|
+
return out + ']';
|
|
98
|
+
}
|
|
99
|
+
if (node === null) {
|
|
100
|
+
return 'null';
|
|
101
|
+
}
|
|
102
|
+
const keys = ObjectKeys$1(node).sort();
|
|
103
|
+
out = '';
|
|
104
|
+
for (i = 0; i < keys.length; i++) {
|
|
105
|
+
const key = keys[i];
|
|
106
|
+
const value = stableJSONStringify(node[key]);
|
|
107
|
+
if (!value) {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
if (out) {
|
|
111
|
+
out += ',';
|
|
112
|
+
}
|
|
113
|
+
out += JSONStringify$1(key) + ':' + value;
|
|
114
|
+
}
|
|
115
|
+
return '{' + out + '}';
|
|
116
|
+
}
|
|
117
|
+
function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
|
|
118
|
+
return {
|
|
119
|
+
name,
|
|
120
|
+
required,
|
|
121
|
+
resourceType,
|
|
122
|
+
typeCheckShape,
|
|
123
|
+
isArrayShape,
|
|
124
|
+
coerceFn,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function buildAdapterValidationConfig(displayName, paramsMeta) {
|
|
128
|
+
const required = paramsMeta.filter(p => p.required).map(p => p.name);
|
|
129
|
+
const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
|
|
130
|
+
return {
|
|
131
|
+
displayName,
|
|
132
|
+
parameters: {
|
|
133
|
+
required,
|
|
134
|
+
optional,
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
const keyPrefix = 'Commerce';
|
|
139
|
+
|
|
140
|
+
const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
141
|
+
const { isArray: ArrayIsArray } = Array;
|
|
142
|
+
const { stringify: JSONStringify } = JSON;
|
|
143
|
+
function createLink(ref) {
|
|
144
|
+
return {
|
|
145
|
+
__ref: serializeStructuredKey(ref),
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function validate$g(obj, path = 'BoostBuryQueryContextConditionInputRepresentation') {
|
|
150
|
+
const v_error = (() => {
|
|
151
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
152
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
153
|
+
}
|
|
154
|
+
const obj_locales = obj.locales;
|
|
155
|
+
const path_locales = path + '.locales';
|
|
156
|
+
if (!ArrayIsArray(obj_locales)) {
|
|
157
|
+
return new TypeError('Expected "array" but received "' + typeof obj_locales + '" (at "' + path_locales + '")');
|
|
158
|
+
}
|
|
159
|
+
for (let i = 0; i < obj_locales.length; i++) {
|
|
160
|
+
const obj_locales_item = obj_locales[i];
|
|
161
|
+
const path_locales_item = path_locales + '[' + i + ']';
|
|
162
|
+
if (typeof obj_locales_item !== 'string') {
|
|
163
|
+
return new TypeError('Expected "string" but received "' + typeof obj_locales_item + '" (at "' + path_locales_item + '")');
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
const obj_type = obj.type;
|
|
167
|
+
const path_type = path + '.type';
|
|
168
|
+
if (typeof obj_type !== 'string') {
|
|
169
|
+
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
170
|
+
}
|
|
171
|
+
const obj_values = obj.values;
|
|
172
|
+
const path_values = path + '.values';
|
|
173
|
+
if (!ArrayIsArray(obj_values)) {
|
|
174
|
+
return new TypeError('Expected "array" but received "' + typeof obj_values + '" (at "' + path_values + '")');
|
|
175
|
+
}
|
|
176
|
+
for (let i = 0; i < obj_values.length; i++) {
|
|
177
|
+
const obj_values_item = obj_values[i];
|
|
178
|
+
const path_values_item = path_values + '[' + i + ']';
|
|
179
|
+
if (typeof obj_values_item !== 'string') {
|
|
180
|
+
return new TypeError('Expected "string" but received "' + typeof obj_values_item + '" (at "' + path_values_item + '")');
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
})();
|
|
184
|
+
return v_error === undefined ? null : v_error;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function validate$f(obj, path = 'BoostBuryQueryContextInputRepresentation') {
|
|
188
|
+
const v_error = (() => {
|
|
189
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
190
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
191
|
+
}
|
|
192
|
+
const obj_conditions = obj.conditions;
|
|
193
|
+
const path_conditions = path + '.conditions';
|
|
194
|
+
if (!ArrayIsArray(obj_conditions)) {
|
|
195
|
+
return new TypeError('Expected "array" but received "' + typeof obj_conditions + '" (at "' + path_conditions + '")');
|
|
196
|
+
}
|
|
197
|
+
for (let i = 0; i < obj_conditions.length; i++) {
|
|
198
|
+
const obj_conditions_item = obj_conditions[i];
|
|
199
|
+
const path_conditions_item = path_conditions + '[' + i + ']';
|
|
200
|
+
const referencepath_conditions_itemValidationError = validate$g(obj_conditions_item, path_conditions_item);
|
|
201
|
+
if (referencepath_conditions_itemValidationError !== null) {
|
|
202
|
+
let message = 'Object doesn\'t match BoostBuryQueryContextConditionInputRepresentation (at "' + path_conditions_item + '")\n';
|
|
203
|
+
message += referencepath_conditions_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
204
|
+
return new TypeError(message);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
})();
|
|
208
|
+
return v_error === undefined ? null : v_error;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function validate$e(obj, path = 'BoostBuryConditionInputRepresentation') {
|
|
212
|
+
const v_error = (() => {
|
|
213
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
214
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
215
|
+
}
|
|
216
|
+
const obj_attributeNameOrId = obj.attributeNameOrId;
|
|
217
|
+
const path_attributeNameOrId = path + '.attributeNameOrId';
|
|
218
|
+
if (typeof obj_attributeNameOrId !== 'string') {
|
|
219
|
+
return new TypeError('Expected "string" but received "' + typeof obj_attributeNameOrId + '" (at "' + path_attributeNameOrId + '")');
|
|
220
|
+
}
|
|
221
|
+
const obj_attributeType = obj.attributeType;
|
|
222
|
+
const path_attributeType = path + '.attributeType';
|
|
223
|
+
if (typeof obj_attributeType !== 'string') {
|
|
224
|
+
return new TypeError('Expected "string" but received "' + typeof obj_attributeType + '" (at "' + path_attributeType + '")');
|
|
225
|
+
}
|
|
226
|
+
const obj_values = obj.values;
|
|
227
|
+
const path_values = path + '.values';
|
|
228
|
+
if (!ArrayIsArray(obj_values)) {
|
|
229
|
+
return new TypeError('Expected "array" but received "' + typeof obj_values + '" (at "' + path_values + '")');
|
|
230
|
+
}
|
|
231
|
+
for (let i = 0; i < obj_values.length; i++) {
|
|
232
|
+
const obj_values_item = obj_values[i];
|
|
233
|
+
const path_values_item = path_values + '[' + i + ']';
|
|
234
|
+
if (typeof obj_values_item !== 'string') {
|
|
235
|
+
return new TypeError('Expected "string" but received "' + typeof obj_values_item + '" (at "' + path_values_item + '")');
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
})();
|
|
239
|
+
return v_error === undefined ? null : v_error;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function validate$d(obj, path = 'BoostBuryTargetExpressionInputRepresentation') {
|
|
243
|
+
const v_error = (() => {
|
|
244
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
245
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
246
|
+
}
|
|
247
|
+
const obj_conditions = obj.conditions;
|
|
248
|
+
const path_conditions = path + '.conditions';
|
|
249
|
+
if (!ArrayIsArray(obj_conditions)) {
|
|
250
|
+
return new TypeError('Expected "array" but received "' + typeof obj_conditions + '" (at "' + path_conditions + '")');
|
|
251
|
+
}
|
|
252
|
+
for (let i = 0; i < obj_conditions.length; i++) {
|
|
253
|
+
const obj_conditions_item = obj_conditions[i];
|
|
254
|
+
const path_conditions_item = path_conditions + '[' + i + ']';
|
|
255
|
+
const referencepath_conditions_itemValidationError = validate$e(obj_conditions_item, path_conditions_item);
|
|
256
|
+
if (referencepath_conditions_itemValidationError !== null) {
|
|
257
|
+
let message = 'Object doesn\'t match BoostBuryConditionInputRepresentation (at "' + path_conditions_item + '")\n';
|
|
258
|
+
message += referencepath_conditions_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
259
|
+
return new TypeError(message);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
})();
|
|
263
|
+
return v_error === undefined ? null : v_error;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function validate$c(obj, path = 'BoostBuryQueryContextConditionOutputRepresentation') {
|
|
267
|
+
const v_error = (() => {
|
|
268
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
269
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
270
|
+
}
|
|
271
|
+
const obj_locales = obj.locales;
|
|
272
|
+
const path_locales = path + '.locales';
|
|
273
|
+
if (!ArrayIsArray(obj_locales)) {
|
|
274
|
+
return new TypeError('Expected "array" but received "' + typeof obj_locales + '" (at "' + path_locales + '")');
|
|
275
|
+
}
|
|
276
|
+
for (let i = 0; i < obj_locales.length; i++) {
|
|
277
|
+
const obj_locales_item = obj_locales[i];
|
|
278
|
+
const path_locales_item = path_locales + '[' + i + ']';
|
|
279
|
+
if (typeof obj_locales_item !== 'string') {
|
|
280
|
+
return new TypeError('Expected "string" but received "' + typeof obj_locales_item + '" (at "' + path_locales_item + '")');
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
const obj_type = obj.type;
|
|
284
|
+
const path_type = path + '.type';
|
|
285
|
+
if (typeof obj_type !== 'string') {
|
|
286
|
+
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
287
|
+
}
|
|
288
|
+
const obj_values = obj.values;
|
|
289
|
+
const path_values = path + '.values';
|
|
290
|
+
if (!ArrayIsArray(obj_values)) {
|
|
291
|
+
return new TypeError('Expected "array" but received "' + typeof obj_values + '" (at "' + path_values + '")');
|
|
292
|
+
}
|
|
293
|
+
for (let i = 0; i < obj_values.length; i++) {
|
|
294
|
+
const obj_values_item = obj_values[i];
|
|
295
|
+
const path_values_item = path_values + '[' + i + ']';
|
|
296
|
+
if (typeof obj_values_item !== 'string') {
|
|
297
|
+
return new TypeError('Expected "string" but received "' + typeof obj_values_item + '" (at "' + path_values_item + '")');
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
})();
|
|
301
|
+
return v_error === undefined ? null : v_error;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const VERSION$5 = "a28891bfa8a2d07d1be34bbee8e37743";
|
|
305
|
+
function validate$b(obj, path = 'BoostBuryQueryContextOutputRepresentation') {
|
|
306
|
+
const v_error = (() => {
|
|
307
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
308
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
309
|
+
}
|
|
310
|
+
const obj_conditions = obj.conditions;
|
|
311
|
+
const path_conditions = path + '.conditions';
|
|
312
|
+
if (!ArrayIsArray(obj_conditions)) {
|
|
313
|
+
return new TypeError('Expected "array" but received "' + typeof obj_conditions + '" (at "' + path_conditions + '")');
|
|
314
|
+
}
|
|
315
|
+
for (let i = 0; i < obj_conditions.length; i++) {
|
|
316
|
+
const obj_conditions_item = obj_conditions[i];
|
|
317
|
+
const path_conditions_item = path_conditions + '[' + i + ']';
|
|
318
|
+
const referencepath_conditions_itemValidationError = validate$c(obj_conditions_item, path_conditions_item);
|
|
319
|
+
if (referencepath_conditions_itemValidationError !== null) {
|
|
320
|
+
let message = 'Object doesn\'t match BoostBuryQueryContextConditionOutputRepresentation (at "' + path_conditions_item + '")\n';
|
|
321
|
+
message += referencepath_conditions_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
322
|
+
return new TypeError(message);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
})();
|
|
326
|
+
return v_error === undefined ? null : v_error;
|
|
327
|
+
}
|
|
328
|
+
const RepresentationType$5 = 'BoostBuryQueryContextOutputRepresentation';
|
|
329
|
+
function normalize$5(input, existing, path, luvio, store, timestamp) {
|
|
330
|
+
return input;
|
|
331
|
+
}
|
|
332
|
+
const select$b = function BoostBuryQueryContextOutputRepresentationSelect() {
|
|
333
|
+
return {
|
|
334
|
+
kind: 'Fragment',
|
|
335
|
+
version: VERSION$5,
|
|
336
|
+
private: [],
|
|
337
|
+
opaque: true
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
function equals$5(existing, incoming) {
|
|
341
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
return true;
|
|
345
|
+
}
|
|
346
|
+
const ingest$5 = function BoostBuryQueryContextOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
347
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
348
|
+
const validateError = validate$b(input);
|
|
349
|
+
if (validateError !== null) {
|
|
350
|
+
throw validateError;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
const key = path.fullPath;
|
|
354
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
|
|
355
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$5, "Commerce", VERSION$5, RepresentationType$5, equals$5);
|
|
356
|
+
return createLink(key);
|
|
357
|
+
};
|
|
358
|
+
function getTypeCacheKeys$5(rootKeySet, luvio, input, fullPathFactory) {
|
|
359
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
360
|
+
const rootKey = fullPathFactory();
|
|
361
|
+
rootKeySet.set(rootKey, {
|
|
362
|
+
namespace: keyPrefix,
|
|
363
|
+
representationName: RepresentationType$5,
|
|
364
|
+
mergeable: false
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
function validate$a(obj, path = 'BoostBuryConditionOutputRepresentation') {
|
|
369
|
+
const v_error = (() => {
|
|
370
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
371
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
372
|
+
}
|
|
373
|
+
const obj_attributeNameOrId = obj.attributeNameOrId;
|
|
374
|
+
const path_attributeNameOrId = path + '.attributeNameOrId';
|
|
375
|
+
if (typeof obj_attributeNameOrId !== 'string') {
|
|
376
|
+
return new TypeError('Expected "string" but received "' + typeof obj_attributeNameOrId + '" (at "' + path_attributeNameOrId + '")');
|
|
377
|
+
}
|
|
378
|
+
const obj_attributeType = obj.attributeType;
|
|
379
|
+
const path_attributeType = path + '.attributeType';
|
|
380
|
+
if (typeof obj_attributeType !== 'string') {
|
|
381
|
+
return new TypeError('Expected "string" but received "' + typeof obj_attributeType + '" (at "' + path_attributeType + '")');
|
|
382
|
+
}
|
|
383
|
+
const obj_values = obj.values;
|
|
384
|
+
const path_values = path + '.values';
|
|
385
|
+
if (!ArrayIsArray(obj_values)) {
|
|
386
|
+
return new TypeError('Expected "array" but received "' + typeof obj_values + '" (at "' + path_values + '")');
|
|
387
|
+
}
|
|
388
|
+
for (let i = 0; i < obj_values.length; i++) {
|
|
389
|
+
const obj_values_item = obj_values[i];
|
|
390
|
+
const path_values_item = path_values + '[' + i + ']';
|
|
391
|
+
if (typeof obj_values_item !== 'string') {
|
|
392
|
+
return new TypeError('Expected "string" but received "' + typeof obj_values_item + '" (at "' + path_values_item + '")');
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
})();
|
|
396
|
+
return v_error === undefined ? null : v_error;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
const VERSION$4 = "da3a29347b6bcd49bcb7137ab6761da1";
|
|
400
|
+
function validate$9(obj, path = 'BoostBuryTargetExpressionOutputRepresentation') {
|
|
401
|
+
const v_error = (() => {
|
|
402
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
403
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
404
|
+
}
|
|
405
|
+
const obj_conditions = obj.conditions;
|
|
406
|
+
const path_conditions = path + '.conditions';
|
|
407
|
+
if (!ArrayIsArray(obj_conditions)) {
|
|
408
|
+
return new TypeError('Expected "array" but received "' + typeof obj_conditions + '" (at "' + path_conditions + '")');
|
|
409
|
+
}
|
|
410
|
+
for (let i = 0; i < obj_conditions.length; i++) {
|
|
411
|
+
const obj_conditions_item = obj_conditions[i];
|
|
412
|
+
const path_conditions_item = path_conditions + '[' + i + ']';
|
|
413
|
+
const referencepath_conditions_itemValidationError = validate$a(obj_conditions_item, path_conditions_item);
|
|
414
|
+
if (referencepath_conditions_itemValidationError !== null) {
|
|
415
|
+
let message = 'Object doesn\'t match BoostBuryConditionOutputRepresentation (at "' + path_conditions_item + '")\n';
|
|
416
|
+
message += referencepath_conditions_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
417
|
+
return new TypeError(message);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
})();
|
|
421
|
+
return v_error === undefined ? null : v_error;
|
|
422
|
+
}
|
|
423
|
+
const RepresentationType$4 = 'BoostBuryTargetExpressionOutputRepresentation';
|
|
424
|
+
function normalize$4(input, existing, path, luvio, store, timestamp) {
|
|
425
|
+
return input;
|
|
426
|
+
}
|
|
427
|
+
const select$a = function BoostBuryTargetExpressionOutputRepresentationSelect() {
|
|
428
|
+
return {
|
|
429
|
+
kind: 'Fragment',
|
|
430
|
+
version: VERSION$4,
|
|
431
|
+
private: [],
|
|
432
|
+
opaque: true
|
|
433
|
+
};
|
|
434
|
+
};
|
|
435
|
+
function equals$4(existing, incoming) {
|
|
436
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
437
|
+
return false;
|
|
438
|
+
}
|
|
439
|
+
return true;
|
|
440
|
+
}
|
|
441
|
+
const ingest$4 = function BoostBuryTargetExpressionOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
442
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
443
|
+
const validateError = validate$9(input);
|
|
444
|
+
if (validateError !== null) {
|
|
445
|
+
throw validateError;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
const key = path.fullPath;
|
|
449
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
|
|
450
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$4, "Commerce", VERSION$4, RepresentationType$4, equals$4);
|
|
451
|
+
return createLink(key);
|
|
452
|
+
};
|
|
453
|
+
function getTypeCacheKeys$4(rootKeySet, luvio, input, fullPathFactory) {
|
|
454
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
455
|
+
const rootKey = fullPathFactory();
|
|
456
|
+
rootKeySet.set(rootKey, {
|
|
457
|
+
namespace: keyPrefix,
|
|
458
|
+
representationName: RepresentationType$4,
|
|
459
|
+
mergeable: false
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
const VERSION$3 = "a27b6f0bb6f725e2ad64d83e7eb4c352";
|
|
464
|
+
function validate$8(obj, path = 'SearchBoostBuryRuleOutputRepresentation') {
|
|
465
|
+
const v_error = (() => {
|
|
466
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
467
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
468
|
+
}
|
|
469
|
+
const obj_action = obj.action;
|
|
470
|
+
const path_action = path + '.action';
|
|
471
|
+
if (typeof obj_action !== 'string') {
|
|
472
|
+
return new TypeError('Expected "string" but received "' + typeof obj_action + '" (at "' + path_action + '")');
|
|
473
|
+
}
|
|
474
|
+
const obj_endDate = obj.endDate;
|
|
475
|
+
const path_endDate = path + '.endDate';
|
|
476
|
+
if (typeof obj_endDate !== 'string') {
|
|
477
|
+
return new TypeError('Expected "string" but received "' + typeof obj_endDate + '" (at "' + path_endDate + '")');
|
|
478
|
+
}
|
|
479
|
+
const obj_id = obj.id;
|
|
480
|
+
const path_id = path + '.id';
|
|
481
|
+
if (typeof obj_id !== 'string') {
|
|
482
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
483
|
+
}
|
|
484
|
+
const obj_level = obj.level;
|
|
485
|
+
const path_level = path + '.level';
|
|
486
|
+
if (typeof obj_level !== 'number' || (typeof obj_level === 'number' && Math.floor(obj_level) !== obj_level)) {
|
|
487
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_level + '" (at "' + path_level + '")');
|
|
488
|
+
}
|
|
489
|
+
const obj_name = obj.name;
|
|
490
|
+
const path_name = path + '.name';
|
|
491
|
+
if (typeof obj_name !== 'string') {
|
|
492
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
493
|
+
}
|
|
494
|
+
const obj_queryContext = obj.queryContext;
|
|
495
|
+
const path_queryContext = path + '.queryContext';
|
|
496
|
+
if (typeof obj_queryContext !== 'object' || Array.isArray(obj_queryContext)) {
|
|
497
|
+
return new TypeError('Expected "object" but received "' + typeof obj_queryContext + '" (at "' + path_queryContext + '")');
|
|
498
|
+
}
|
|
499
|
+
const obj_startDate = obj.startDate;
|
|
500
|
+
const path_startDate = path + '.startDate';
|
|
501
|
+
if (typeof obj_startDate !== 'string') {
|
|
502
|
+
return new TypeError('Expected "string" but received "' + typeof obj_startDate + '" (at "' + path_startDate + '")');
|
|
503
|
+
}
|
|
504
|
+
const obj_targetExpression = obj.targetExpression;
|
|
505
|
+
const path_targetExpression = path + '.targetExpression';
|
|
506
|
+
if (typeof obj_targetExpression !== 'object' || Array.isArray(obj_targetExpression)) {
|
|
507
|
+
return new TypeError('Expected "object" but received "' + typeof obj_targetExpression + '" (at "' + path_targetExpression + '")');
|
|
508
|
+
}
|
|
509
|
+
})();
|
|
510
|
+
return v_error === undefined ? null : v_error;
|
|
511
|
+
}
|
|
512
|
+
const RepresentationType$3 = 'SearchBoostBuryRuleOutputRepresentation';
|
|
513
|
+
function keyBuilder$9(luvio, config) {
|
|
514
|
+
return keyPrefix + '::' + RepresentationType$3 + ':' + config.id;
|
|
515
|
+
}
|
|
516
|
+
function keyBuilderFromType(luvio, object) {
|
|
517
|
+
const keyParams = {
|
|
518
|
+
id: object.id
|
|
519
|
+
};
|
|
520
|
+
return keyBuilder$9(luvio, keyParams);
|
|
521
|
+
}
|
|
522
|
+
function normalize$3(input, existing, path, luvio, store, timestamp) {
|
|
523
|
+
const input_queryContext = input.queryContext;
|
|
524
|
+
const input_queryContext_id = path.fullPath + '__queryContext';
|
|
525
|
+
input.queryContext = ingest$5(input_queryContext, {
|
|
526
|
+
fullPath: input_queryContext_id,
|
|
527
|
+
propertyName: 'queryContext',
|
|
528
|
+
parent: {
|
|
529
|
+
data: input,
|
|
530
|
+
key: path.fullPath,
|
|
531
|
+
existing: existing,
|
|
532
|
+
},
|
|
533
|
+
ttl: path.ttl
|
|
534
|
+
}, luvio, store, timestamp);
|
|
535
|
+
const input_targetExpression = input.targetExpression;
|
|
536
|
+
const input_targetExpression_id = path.fullPath + '__targetExpression';
|
|
537
|
+
input.targetExpression = ingest$4(input_targetExpression, {
|
|
538
|
+
fullPath: input_targetExpression_id,
|
|
539
|
+
propertyName: 'targetExpression',
|
|
540
|
+
parent: {
|
|
541
|
+
data: input,
|
|
542
|
+
key: path.fullPath,
|
|
543
|
+
existing: existing,
|
|
544
|
+
},
|
|
545
|
+
ttl: path.ttl
|
|
546
|
+
}, luvio, store, timestamp);
|
|
547
|
+
return input;
|
|
548
|
+
}
|
|
549
|
+
const select$9 = function SearchBoostBuryRuleOutputRepresentationSelect() {
|
|
550
|
+
return {
|
|
551
|
+
kind: 'Fragment',
|
|
552
|
+
version: VERSION$3,
|
|
553
|
+
private: [],
|
|
554
|
+
selections: [
|
|
555
|
+
{
|
|
556
|
+
name: 'action',
|
|
557
|
+
kind: 'Scalar'
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
name: 'endDate',
|
|
561
|
+
kind: 'Scalar'
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
name: 'id',
|
|
565
|
+
kind: 'Scalar'
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
name: 'level',
|
|
569
|
+
kind: 'Scalar'
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
name: 'name',
|
|
573
|
+
kind: 'Scalar'
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
name: 'queryContext',
|
|
577
|
+
kind: 'Link',
|
|
578
|
+
fragment: select$b()
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
name: 'startDate',
|
|
582
|
+
kind: 'Scalar'
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
name: 'targetExpression',
|
|
586
|
+
kind: 'Link',
|
|
587
|
+
fragment: select$a()
|
|
588
|
+
}
|
|
589
|
+
]
|
|
590
|
+
};
|
|
591
|
+
};
|
|
592
|
+
function equals$3(existing, incoming) {
|
|
593
|
+
const existing_level = existing.level;
|
|
594
|
+
const incoming_level = incoming.level;
|
|
595
|
+
if (!(existing_level === incoming_level)) {
|
|
596
|
+
return false;
|
|
597
|
+
}
|
|
598
|
+
const existing_action = existing.action;
|
|
599
|
+
const incoming_action = incoming.action;
|
|
600
|
+
if (!(existing_action === incoming_action)) {
|
|
601
|
+
return false;
|
|
602
|
+
}
|
|
603
|
+
const existing_endDate = existing.endDate;
|
|
604
|
+
const incoming_endDate = incoming.endDate;
|
|
605
|
+
if (!(existing_endDate === incoming_endDate)) {
|
|
606
|
+
return false;
|
|
607
|
+
}
|
|
608
|
+
const existing_id = existing.id;
|
|
609
|
+
const incoming_id = incoming.id;
|
|
610
|
+
if (!(existing_id === incoming_id)) {
|
|
611
|
+
return false;
|
|
612
|
+
}
|
|
613
|
+
const existing_name = existing.name;
|
|
614
|
+
const incoming_name = incoming.name;
|
|
615
|
+
if (!(existing_name === incoming_name)) {
|
|
616
|
+
return false;
|
|
617
|
+
}
|
|
618
|
+
const existing_startDate = existing.startDate;
|
|
619
|
+
const incoming_startDate = incoming.startDate;
|
|
620
|
+
if (!(existing_startDate === incoming_startDate)) {
|
|
621
|
+
return false;
|
|
622
|
+
}
|
|
623
|
+
const existing_queryContext = existing.queryContext;
|
|
624
|
+
const incoming_queryContext = incoming.queryContext;
|
|
625
|
+
if (!(existing_queryContext.__ref === incoming_queryContext.__ref)) {
|
|
626
|
+
return false;
|
|
627
|
+
}
|
|
628
|
+
const existing_targetExpression = existing.targetExpression;
|
|
629
|
+
const incoming_targetExpression = incoming.targetExpression;
|
|
630
|
+
if (!(existing_targetExpression.__ref === incoming_targetExpression.__ref)) {
|
|
631
|
+
return false;
|
|
632
|
+
}
|
|
633
|
+
return true;
|
|
634
|
+
}
|
|
635
|
+
const ingest$3 = function SearchBoostBuryRuleOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
636
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
637
|
+
const validateError = validate$8(input);
|
|
638
|
+
if (validateError !== null) {
|
|
639
|
+
throw validateError;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
const key = keyBuilderFromType(luvio, input);
|
|
643
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
|
|
644
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "Commerce", VERSION$3, RepresentationType$3, equals$3);
|
|
645
|
+
return createLink(key);
|
|
646
|
+
};
|
|
647
|
+
function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
|
|
648
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
649
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
650
|
+
rootKeySet.set(rootKey, {
|
|
651
|
+
namespace: keyPrefix,
|
|
652
|
+
representationName: RepresentationType$3,
|
|
653
|
+
mergeable: false
|
|
654
|
+
});
|
|
655
|
+
getTypeCacheKeys$5(rootKeySet, luvio, input.queryContext, () => rootKey + "__" + "queryContext");
|
|
656
|
+
getTypeCacheKeys$4(rootKeySet, luvio, input.targetExpression, () => rootKey + "__" + "targetExpression");
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
function select$8(luvio, params) {
|
|
660
|
+
return select$9();
|
|
661
|
+
}
|
|
662
|
+
function getResponseCacheKeys$6(storeKeyMap, luvio, resourceParams, response) {
|
|
663
|
+
getTypeCacheKeys$3(storeKeyMap, luvio, response);
|
|
664
|
+
}
|
|
665
|
+
function ingestSuccess$5(luvio, resourceParams, response) {
|
|
666
|
+
const { body } = response;
|
|
667
|
+
const key = keyBuilderFromType(luvio, body);
|
|
668
|
+
luvio.storeIngest(key, ingest$3, body);
|
|
669
|
+
const snapshot = luvio.storeLookup({
|
|
670
|
+
recordId: key,
|
|
671
|
+
node: select$8(),
|
|
672
|
+
variables: {},
|
|
673
|
+
});
|
|
674
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
675
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
676
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
deepFreeze(snapshot.data);
|
|
680
|
+
return snapshot;
|
|
681
|
+
}
|
|
682
|
+
function createResourceRequest$6(config) {
|
|
683
|
+
const headers = {};
|
|
684
|
+
return {
|
|
685
|
+
baseUri: '/services/data/v66.0',
|
|
686
|
+
basePath: '/commerce/management/webstores/' + config.urlParams.webstoreId + '/search/boost-bury-rules',
|
|
687
|
+
method: 'post',
|
|
688
|
+
body: config.body,
|
|
689
|
+
urlParams: config.urlParams,
|
|
690
|
+
queryParams: {},
|
|
691
|
+
headers,
|
|
692
|
+
priority: 'normal',
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
const adapterName$6 = 'createSearchBoostBuryRule';
|
|
697
|
+
const createSearchBoostBuryRule_ConfigPropertyMetadata = [
|
|
698
|
+
generateParamConfigMetadata('webstoreId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
699
|
+
generateParamConfigMetadata('action', true, 2 /* Body */, 0 /* String */),
|
|
700
|
+
generateParamConfigMetadata('endDate', true, 2 /* Body */, 0 /* String */),
|
|
701
|
+
generateParamConfigMetadata('level', true, 2 /* Body */, 3 /* Integer */),
|
|
702
|
+
generateParamConfigMetadata('name', true, 2 /* Body */, 0 /* String */),
|
|
703
|
+
generateParamConfigMetadata('queryContext', true, 2 /* Body */, 4 /* Unsupported */),
|
|
704
|
+
generateParamConfigMetadata('startDate', true, 2 /* Body */, 0 /* String */),
|
|
705
|
+
generateParamConfigMetadata('targetExpression', true, 2 /* Body */, 4 /* Unsupported */),
|
|
706
|
+
];
|
|
707
|
+
const createSearchBoostBuryRule_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$6, createSearchBoostBuryRule_ConfigPropertyMetadata);
|
|
708
|
+
const createResourceParams$6 = /*#__PURE__*/ createResourceParams$7(createSearchBoostBuryRule_ConfigPropertyMetadata);
|
|
709
|
+
function typeCheckConfig$6(untrustedConfig) {
|
|
710
|
+
const config = {};
|
|
711
|
+
typeCheckConfig$7(untrustedConfig, config, createSearchBoostBuryRule_ConfigPropertyMetadata);
|
|
712
|
+
const untrustedConfig_queryContext = untrustedConfig.queryContext;
|
|
713
|
+
const referenceBoostBuryQueryContextInputRepresentationValidationError = validate$f(untrustedConfig_queryContext);
|
|
714
|
+
if (referenceBoostBuryQueryContextInputRepresentationValidationError === null) {
|
|
715
|
+
config.queryContext = untrustedConfig_queryContext;
|
|
716
|
+
}
|
|
717
|
+
const untrustedConfig_targetExpression = untrustedConfig.targetExpression;
|
|
718
|
+
const referenceBoostBuryTargetExpressionInputRepresentationValidationError = validate$d(untrustedConfig_targetExpression);
|
|
719
|
+
if (referenceBoostBuryTargetExpressionInputRepresentationValidationError === null) {
|
|
720
|
+
config.targetExpression = untrustedConfig_targetExpression;
|
|
721
|
+
}
|
|
722
|
+
return config;
|
|
723
|
+
}
|
|
724
|
+
function validateAdapterConfig$6(untrustedConfig, configPropertyNames) {
|
|
725
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
726
|
+
return null;
|
|
727
|
+
}
|
|
728
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
729
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
730
|
+
}
|
|
731
|
+
const config = typeCheckConfig$6(untrustedConfig);
|
|
732
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
733
|
+
return null;
|
|
734
|
+
}
|
|
735
|
+
return config;
|
|
736
|
+
}
|
|
737
|
+
function buildNetworkSnapshot$6(luvio, config, options) {
|
|
738
|
+
const resourceParams = createResourceParams$6(config);
|
|
739
|
+
const request = createResourceRequest$6(resourceParams);
|
|
740
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
741
|
+
.then((response) => {
|
|
742
|
+
return luvio.handleSuccessResponse(() => {
|
|
743
|
+
const snapshot = ingestSuccess$5(luvio, resourceParams, response);
|
|
744
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
745
|
+
}, () => {
|
|
746
|
+
const cache = new StoreKeyMap();
|
|
747
|
+
getResponseCacheKeys$6(cache, luvio, resourceParams, response.body);
|
|
748
|
+
return cache;
|
|
749
|
+
});
|
|
750
|
+
}, (response) => {
|
|
751
|
+
deepFreeze(response);
|
|
752
|
+
throw response;
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
const createSearchBoostBuryRuleAdapterFactory = (luvio) => {
|
|
756
|
+
return function createSearchBoostBuryRule(untrustedConfig) {
|
|
757
|
+
const config = validateAdapterConfig$6(untrustedConfig, createSearchBoostBuryRule_ConfigPropertyNames);
|
|
758
|
+
// Invalid or incomplete config
|
|
759
|
+
if (config === null) {
|
|
760
|
+
throw new Error('Invalid config for "createSearchBoostBuryRule"');
|
|
761
|
+
}
|
|
762
|
+
return buildNetworkSnapshot$6(luvio, config);
|
|
763
|
+
};
|
|
764
|
+
};
|
|
765
|
+
|
|
766
|
+
function keyBuilder$8(luvio, params) {
|
|
767
|
+
return keyBuilder$9(luvio, {
|
|
768
|
+
id: params.urlParams.ruleId
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
function getResponseCacheKeys$5(cacheKeyMap, luvio, resourceParams) {
|
|
772
|
+
const key = keyBuilder$8(luvio, resourceParams);
|
|
773
|
+
cacheKeyMap.set(key, {
|
|
774
|
+
namespace: keyPrefix,
|
|
775
|
+
representationName: RepresentationType$3,
|
|
776
|
+
mergeable: false
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
function evictSuccess(luvio, resourceParams) {
|
|
780
|
+
const key = keyBuilder$8(luvio, resourceParams);
|
|
781
|
+
luvio.storeEvict(key);
|
|
782
|
+
}
|
|
783
|
+
function createResourceRequest$5(config) {
|
|
784
|
+
const headers = {};
|
|
785
|
+
return {
|
|
786
|
+
baseUri: '/services/data/v66.0',
|
|
787
|
+
basePath: '/commerce/management/webstores/' + config.urlParams.webstoreId + '/search/boost-bury-rules/' + config.urlParams.ruleId + '',
|
|
788
|
+
method: 'delete',
|
|
789
|
+
body: null,
|
|
790
|
+
urlParams: config.urlParams,
|
|
791
|
+
queryParams: {},
|
|
792
|
+
headers,
|
|
793
|
+
priority: 'normal',
|
|
794
|
+
};
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
const adapterName$5 = 'deleteSearchBoostBuryRule';
|
|
798
|
+
const deleteSearchBoostBuryRule_ConfigPropertyMetadata = [
|
|
799
|
+
generateParamConfigMetadata('ruleId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
800
|
+
generateParamConfigMetadata('webstoreId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
801
|
+
];
|
|
802
|
+
const deleteSearchBoostBuryRule_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$5, deleteSearchBoostBuryRule_ConfigPropertyMetadata);
|
|
803
|
+
const createResourceParams$5 = /*#__PURE__*/ createResourceParams$7(deleteSearchBoostBuryRule_ConfigPropertyMetadata);
|
|
804
|
+
function typeCheckConfig$5(untrustedConfig) {
|
|
805
|
+
const config = {};
|
|
806
|
+
typeCheckConfig$7(untrustedConfig, config, deleteSearchBoostBuryRule_ConfigPropertyMetadata);
|
|
807
|
+
return config;
|
|
808
|
+
}
|
|
809
|
+
function validateAdapterConfig$5(untrustedConfig, configPropertyNames) {
|
|
810
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
811
|
+
return null;
|
|
812
|
+
}
|
|
813
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
814
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
815
|
+
}
|
|
816
|
+
const config = typeCheckConfig$5(untrustedConfig);
|
|
817
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
818
|
+
return null;
|
|
819
|
+
}
|
|
820
|
+
return config;
|
|
821
|
+
}
|
|
822
|
+
function buildNetworkSnapshot$5(luvio, config, options) {
|
|
823
|
+
const resourceParams = createResourceParams$5(config);
|
|
824
|
+
const request = createResourceRequest$5(resourceParams);
|
|
825
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
826
|
+
.then(() => {
|
|
827
|
+
return luvio.handleSuccessResponse(() => {
|
|
828
|
+
evictSuccess(luvio, resourceParams);
|
|
829
|
+
return luvio.storeBroadcast();
|
|
830
|
+
}, () => {
|
|
831
|
+
const cache = new StoreKeyMap();
|
|
832
|
+
getResponseCacheKeys$5(cache, luvio, resourceParams);
|
|
833
|
+
return cache;
|
|
834
|
+
});
|
|
835
|
+
}, (response) => {
|
|
836
|
+
deepFreeze(response);
|
|
837
|
+
throw response;
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
const deleteSearchBoostBuryRuleAdapterFactory = (luvio) => {
|
|
841
|
+
return function CommercedeleteSearchBoostBuryRule(untrustedConfig) {
|
|
842
|
+
const config = validateAdapterConfig$5(untrustedConfig, deleteSearchBoostBuryRule_ConfigPropertyNames);
|
|
843
|
+
// Invalid or incomplete config
|
|
844
|
+
if (config === null) {
|
|
845
|
+
throw new Error(`Invalid config for "${adapterName$5}"`);
|
|
846
|
+
}
|
|
847
|
+
return buildNetworkSnapshot$5(luvio, config);
|
|
848
|
+
};
|
|
849
|
+
};
|
|
850
|
+
|
|
851
|
+
function select$7(luvio, params) {
|
|
852
|
+
return select$9();
|
|
853
|
+
}
|
|
854
|
+
function keyBuilder$7(luvio, params) {
|
|
855
|
+
return keyBuilder$9(luvio, {
|
|
856
|
+
id: params.urlParams.ruleId
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
function getResponseCacheKeys$4(storeKeyMap, luvio, resourceParams, response) {
|
|
860
|
+
getTypeCacheKeys$3(storeKeyMap, luvio, response);
|
|
861
|
+
}
|
|
862
|
+
function ingestSuccess$4(luvio, resourceParams, response, snapshotRefresh) {
|
|
863
|
+
const { body } = response;
|
|
864
|
+
const key = keyBuilder$7(luvio, resourceParams);
|
|
865
|
+
luvio.storeIngest(key, ingest$3, body);
|
|
866
|
+
const snapshot = luvio.storeLookup({
|
|
867
|
+
recordId: key,
|
|
868
|
+
node: select$7(),
|
|
869
|
+
variables: {},
|
|
870
|
+
}, snapshotRefresh);
|
|
871
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
872
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
873
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
deepFreeze(snapshot.data);
|
|
877
|
+
return snapshot;
|
|
878
|
+
}
|
|
879
|
+
function ingestError$3(luvio, params, error, snapshotRefresh) {
|
|
880
|
+
const key = keyBuilder$7(luvio, params);
|
|
881
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
882
|
+
luvio.storeIngestError(key, errorSnapshot);
|
|
883
|
+
return errorSnapshot;
|
|
884
|
+
}
|
|
885
|
+
function createResourceRequest$4(config) {
|
|
886
|
+
const headers = {};
|
|
887
|
+
return {
|
|
888
|
+
baseUri: '/services/data/v66.0',
|
|
889
|
+
basePath: '/commerce/management/webstores/' + config.urlParams.webstoreId + '/search/boost-bury-rules/' + config.urlParams.ruleId + '',
|
|
890
|
+
method: 'get',
|
|
891
|
+
body: null,
|
|
892
|
+
urlParams: config.urlParams,
|
|
893
|
+
queryParams: {},
|
|
894
|
+
headers,
|
|
895
|
+
priority: 'normal',
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
function createResourceRequestFromRepresentation(representation) {
|
|
899
|
+
const config = {
|
|
900
|
+
urlParams: {},
|
|
901
|
+
};
|
|
902
|
+
config.urlParams.ruleId = representation.id;
|
|
903
|
+
return createResourceRequest$4(config);
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
const adapterName$4 = 'getSearchBoostBuryRule';
|
|
907
|
+
const getSearchBoostBuryRule_ConfigPropertyMetadata = [
|
|
908
|
+
generateParamConfigMetadata('ruleId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
909
|
+
generateParamConfigMetadata('webstoreId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
910
|
+
];
|
|
911
|
+
const getSearchBoostBuryRule_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$4, getSearchBoostBuryRule_ConfigPropertyMetadata);
|
|
912
|
+
const createResourceParams$4 = /*#__PURE__*/ createResourceParams$7(getSearchBoostBuryRule_ConfigPropertyMetadata);
|
|
913
|
+
function keyBuilder$6(luvio, config) {
|
|
914
|
+
const resourceParams = createResourceParams$4(config);
|
|
915
|
+
return keyBuilder$7(luvio, resourceParams);
|
|
916
|
+
}
|
|
917
|
+
function typeCheckConfig$4(untrustedConfig) {
|
|
918
|
+
const config = {};
|
|
919
|
+
typeCheckConfig$7(untrustedConfig, config, getSearchBoostBuryRule_ConfigPropertyMetadata);
|
|
920
|
+
return config;
|
|
921
|
+
}
|
|
922
|
+
function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
|
|
923
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
924
|
+
return null;
|
|
925
|
+
}
|
|
926
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
927
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
928
|
+
}
|
|
929
|
+
const config = typeCheckConfig$4(untrustedConfig);
|
|
930
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
931
|
+
return null;
|
|
932
|
+
}
|
|
933
|
+
return config;
|
|
934
|
+
}
|
|
935
|
+
function adapterFragment$3(luvio, config) {
|
|
936
|
+
createResourceParams$4(config);
|
|
937
|
+
return select$7();
|
|
938
|
+
}
|
|
939
|
+
function onFetchResponseSuccess$3(luvio, config, resourceParams, response) {
|
|
940
|
+
const snapshot = ingestSuccess$4(luvio, resourceParams, response, {
|
|
941
|
+
config,
|
|
942
|
+
resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
|
|
943
|
+
});
|
|
944
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
945
|
+
}
|
|
946
|
+
function onFetchResponseError$3(luvio, config, resourceParams, response) {
|
|
947
|
+
const snapshot = ingestError$3(luvio, resourceParams, response, {
|
|
948
|
+
config,
|
|
949
|
+
resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
|
|
950
|
+
});
|
|
951
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
952
|
+
}
|
|
953
|
+
function buildNetworkSnapshot$4(luvio, config, options) {
|
|
954
|
+
const resourceParams = createResourceParams$4(config);
|
|
955
|
+
const request = createResourceRequest$4(resourceParams);
|
|
956
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
957
|
+
.then((response) => {
|
|
958
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$3(luvio, config, resourceParams, response), () => {
|
|
959
|
+
const cache = new StoreKeyMap();
|
|
960
|
+
getResponseCacheKeys$4(cache, luvio, resourceParams, response.body);
|
|
961
|
+
return cache;
|
|
962
|
+
});
|
|
963
|
+
}, (response) => {
|
|
964
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$3(luvio, config, resourceParams, response));
|
|
965
|
+
});
|
|
966
|
+
}
|
|
967
|
+
function buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext) {
|
|
968
|
+
return buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext, buildNetworkSnapshot$4, undefined, false);
|
|
969
|
+
}
|
|
970
|
+
function buildCachedSnapshotCachePolicy$3(context, storeLookup) {
|
|
971
|
+
const { luvio, config } = context;
|
|
972
|
+
const selector = {
|
|
973
|
+
recordId: keyBuilder$6(luvio, config),
|
|
974
|
+
node: adapterFragment$3(luvio, config),
|
|
975
|
+
variables: {},
|
|
976
|
+
};
|
|
977
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
978
|
+
config,
|
|
979
|
+
resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
|
|
980
|
+
});
|
|
981
|
+
return cacheSnapshot;
|
|
982
|
+
}
|
|
983
|
+
const getSearchBoostBuryRuleAdapterFactory = (luvio) => function Commerce__getSearchBoostBuryRule(untrustedConfig, requestContext) {
|
|
984
|
+
const config = validateAdapterConfig$4(untrustedConfig, getSearchBoostBuryRule_ConfigPropertyNames);
|
|
985
|
+
// Invalid or incomplete config
|
|
986
|
+
if (config === null) {
|
|
987
|
+
return null;
|
|
988
|
+
}
|
|
989
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
990
|
+
buildCachedSnapshotCachePolicy$3, buildNetworkSnapshotCachePolicy$3);
|
|
991
|
+
};
|
|
992
|
+
const notifyChangeFactory = (luvio, options) => {
|
|
993
|
+
return function getCommerceManagementWebstoresSearchBoostBuryRulesByRuleIdAndWebstoreIdNotifyChange(configs) {
|
|
994
|
+
const keys = configs.map(c => keyBuilder$9(luvio, c));
|
|
995
|
+
luvio.getNotifyChangeStoreEntries(keys).then(entries => {
|
|
996
|
+
for (let i = 0, len = entries.length; i < len; i++) {
|
|
997
|
+
const { key, record: val } = entries[i];
|
|
998
|
+
const refreshRequest = createResourceRequestFromRepresentation(val);
|
|
999
|
+
luvio.dispatchResourceRequest(refreshRequest, options)
|
|
1000
|
+
.then((response) => {
|
|
1001
|
+
return luvio.handleSuccessResponse(() => {
|
|
1002
|
+
const { body } = response;
|
|
1003
|
+
luvio.storeIngest(key, ingest$3, body);
|
|
1004
|
+
return luvio.storeBroadcast();
|
|
1005
|
+
}, () => {
|
|
1006
|
+
const cache = new StoreKeyMap();
|
|
1007
|
+
getTypeCacheKeys$3(cache, luvio, response.body);
|
|
1008
|
+
return cache;
|
|
1009
|
+
});
|
|
1010
|
+
}, (error) => {
|
|
1011
|
+
return luvio.handleErrorResponse(() => {
|
|
1012
|
+
const errorSnapshot = luvio.errorSnapshot(error);
|
|
1013
|
+
luvio.storeIngestError(key, errorSnapshot, undefined);
|
|
1014
|
+
return luvio.storeBroadcast().then(() => errorSnapshot);
|
|
1015
|
+
});
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
});
|
|
1019
|
+
};
|
|
1020
|
+
};
|
|
1021
|
+
|
|
1022
|
+
const VERSION$2 = "0fa833e9a0f029f33da2b453b1b3d98c";
|
|
1023
|
+
function validate$7(obj, path = 'SearchBoostBuryRulesCollectionOutputRepresentation') {
|
|
1024
|
+
const v_error = (() => {
|
|
1025
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1026
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1027
|
+
}
|
|
1028
|
+
const obj_boostBuryRules = obj.boostBuryRules;
|
|
1029
|
+
const path_boostBuryRules = path + '.boostBuryRules';
|
|
1030
|
+
if (!ArrayIsArray(obj_boostBuryRules)) {
|
|
1031
|
+
return new TypeError('Expected "array" but received "' + typeof obj_boostBuryRules + '" (at "' + path_boostBuryRules + '")');
|
|
1032
|
+
}
|
|
1033
|
+
for (let i = 0; i < obj_boostBuryRules.length; i++) {
|
|
1034
|
+
const obj_boostBuryRules_item = obj_boostBuryRules[i];
|
|
1035
|
+
const path_boostBuryRules_item = path_boostBuryRules + '[' + i + ']';
|
|
1036
|
+
const referencepath_boostBuryRules_itemValidationError = validate$8(obj_boostBuryRules_item, path_boostBuryRules_item);
|
|
1037
|
+
if (referencepath_boostBuryRules_itemValidationError !== null) {
|
|
1038
|
+
let message = 'Object doesn\'t match SearchBoostBuryRuleOutputRepresentation (at "' + path_boostBuryRules_item + '")\n';
|
|
1039
|
+
message += referencepath_boostBuryRules_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1040
|
+
return new TypeError(message);
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
})();
|
|
1044
|
+
return v_error === undefined ? null : v_error;
|
|
1045
|
+
}
|
|
1046
|
+
const RepresentationType$2 = 'SearchBoostBuryRulesCollectionOutputRepresentation';
|
|
1047
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
1048
|
+
return input;
|
|
1049
|
+
}
|
|
1050
|
+
const select$6 = function SearchBoostBuryRulesCollectionOutputRepresentationSelect() {
|
|
1051
|
+
return {
|
|
1052
|
+
kind: 'Fragment',
|
|
1053
|
+
version: VERSION$2,
|
|
1054
|
+
private: [],
|
|
1055
|
+
opaque: true
|
|
1056
|
+
};
|
|
1057
|
+
};
|
|
1058
|
+
function equals$2(existing, incoming) {
|
|
1059
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
1060
|
+
return false;
|
|
1061
|
+
}
|
|
1062
|
+
return true;
|
|
1063
|
+
}
|
|
1064
|
+
const ingest$2 = function SearchBoostBuryRulesCollectionOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1065
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1066
|
+
const validateError = validate$7(input);
|
|
1067
|
+
if (validateError !== null) {
|
|
1068
|
+
throw validateError;
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
const key = path.fullPath;
|
|
1072
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
|
|
1073
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "Commerce", VERSION$2, RepresentationType$2, equals$2);
|
|
1074
|
+
return createLink(key);
|
|
1075
|
+
};
|
|
1076
|
+
function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
|
|
1077
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1078
|
+
const rootKey = fullPathFactory();
|
|
1079
|
+
rootKeySet.set(rootKey, {
|
|
1080
|
+
namespace: keyPrefix,
|
|
1081
|
+
representationName: RepresentationType$2,
|
|
1082
|
+
mergeable: false
|
|
1083
|
+
});
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
function select$5(luvio, params) {
|
|
1087
|
+
return select$6();
|
|
1088
|
+
}
|
|
1089
|
+
function keyBuilder$5(luvio, params) {
|
|
1090
|
+
return keyPrefix + '::SearchBoostBuryRulesCollectionOutputRepresentation:(' + 'webstoreId:' + params.urlParams.webstoreId + ')';
|
|
1091
|
+
}
|
|
1092
|
+
function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
|
|
1093
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$5(luvio, resourceParams));
|
|
1094
|
+
}
|
|
1095
|
+
function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
|
|
1096
|
+
const { body } = response;
|
|
1097
|
+
const key = keyBuilder$5(luvio, resourceParams);
|
|
1098
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
1099
|
+
const snapshot = luvio.storeLookup({
|
|
1100
|
+
recordId: key,
|
|
1101
|
+
node: select$5(),
|
|
1102
|
+
variables: {},
|
|
1103
|
+
}, snapshotRefresh);
|
|
1104
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1105
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1106
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
deepFreeze(snapshot.data);
|
|
1110
|
+
return snapshot;
|
|
1111
|
+
}
|
|
1112
|
+
function ingestError$2(luvio, params, error, snapshotRefresh) {
|
|
1113
|
+
const key = keyBuilder$5(luvio, params);
|
|
1114
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1115
|
+
luvio.storeIngestError(key, errorSnapshot);
|
|
1116
|
+
return errorSnapshot;
|
|
1117
|
+
}
|
|
1118
|
+
function createResourceRequest$3(config) {
|
|
1119
|
+
const headers = {};
|
|
1120
|
+
return {
|
|
1121
|
+
baseUri: '/services/data/v66.0',
|
|
1122
|
+
basePath: '/commerce/management/webstores/' + config.urlParams.webstoreId + '/search/boost-bury-rules',
|
|
1123
|
+
method: 'get',
|
|
1124
|
+
body: null,
|
|
1125
|
+
urlParams: config.urlParams,
|
|
1126
|
+
queryParams: {},
|
|
1127
|
+
headers,
|
|
1128
|
+
priority: 'normal',
|
|
1129
|
+
};
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
const adapterName$3 = 'getSearchBoostBuryRules';
|
|
1133
|
+
const getSearchBoostBuryRules_ConfigPropertyMetadata = [
|
|
1134
|
+
generateParamConfigMetadata('webstoreId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1135
|
+
];
|
|
1136
|
+
const getSearchBoostBuryRules_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, getSearchBoostBuryRules_ConfigPropertyMetadata);
|
|
1137
|
+
const createResourceParams$3 = /*#__PURE__*/ createResourceParams$7(getSearchBoostBuryRules_ConfigPropertyMetadata);
|
|
1138
|
+
function keyBuilder$4(luvio, config) {
|
|
1139
|
+
const resourceParams = createResourceParams$3(config);
|
|
1140
|
+
return keyBuilder$5(luvio, resourceParams);
|
|
1141
|
+
}
|
|
1142
|
+
function typeCheckConfig$3(untrustedConfig) {
|
|
1143
|
+
const config = {};
|
|
1144
|
+
typeCheckConfig$7(untrustedConfig, config, getSearchBoostBuryRules_ConfigPropertyMetadata);
|
|
1145
|
+
return config;
|
|
1146
|
+
}
|
|
1147
|
+
function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
|
|
1148
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1149
|
+
return null;
|
|
1150
|
+
}
|
|
1151
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1152
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1153
|
+
}
|
|
1154
|
+
const config = typeCheckConfig$3(untrustedConfig);
|
|
1155
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1156
|
+
return null;
|
|
1157
|
+
}
|
|
1158
|
+
return config;
|
|
1159
|
+
}
|
|
1160
|
+
function adapterFragment$2(luvio, config) {
|
|
1161
|
+
createResourceParams$3(config);
|
|
1162
|
+
return select$5();
|
|
1163
|
+
}
|
|
1164
|
+
function onFetchResponseSuccess$2(luvio, config, resourceParams, response) {
|
|
1165
|
+
const snapshot = ingestSuccess$3(luvio, resourceParams, response, {
|
|
1166
|
+
config,
|
|
1167
|
+
resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
|
|
1168
|
+
});
|
|
1169
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1170
|
+
}
|
|
1171
|
+
function onFetchResponseError$2(luvio, config, resourceParams, response) {
|
|
1172
|
+
const snapshot = ingestError$2(luvio, resourceParams, response, {
|
|
1173
|
+
config,
|
|
1174
|
+
resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
|
|
1175
|
+
});
|
|
1176
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1177
|
+
}
|
|
1178
|
+
function buildNetworkSnapshot$3(luvio, config, options) {
|
|
1179
|
+
const resourceParams = createResourceParams$3(config);
|
|
1180
|
+
const request = createResourceRequest$3(resourceParams);
|
|
1181
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1182
|
+
.then((response) => {
|
|
1183
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$2(luvio, config, resourceParams, response), () => {
|
|
1184
|
+
const cache = new StoreKeyMap();
|
|
1185
|
+
getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
|
|
1186
|
+
return cache;
|
|
1187
|
+
});
|
|
1188
|
+
}, (response) => {
|
|
1189
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$2(luvio, config, resourceParams, response));
|
|
1190
|
+
});
|
|
1191
|
+
}
|
|
1192
|
+
function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
|
|
1193
|
+
return buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext, buildNetworkSnapshot$3, undefined, false);
|
|
1194
|
+
}
|
|
1195
|
+
function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
|
|
1196
|
+
const { luvio, config } = context;
|
|
1197
|
+
const selector = {
|
|
1198
|
+
recordId: keyBuilder$4(luvio, config),
|
|
1199
|
+
node: adapterFragment$2(luvio, config),
|
|
1200
|
+
variables: {},
|
|
1201
|
+
};
|
|
1202
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1203
|
+
config,
|
|
1204
|
+
resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
|
|
1205
|
+
});
|
|
1206
|
+
return cacheSnapshot;
|
|
1207
|
+
}
|
|
1208
|
+
const getSearchBoostBuryRulesAdapterFactory = (luvio) => function Commerce__getSearchBoostBuryRules(untrustedConfig, requestContext) {
|
|
1209
|
+
const config = validateAdapterConfig$3(untrustedConfig, getSearchBoostBuryRules_ConfigPropertyNames);
|
|
1210
|
+
// Invalid or incomplete config
|
|
1211
|
+
if (config === null) {
|
|
1212
|
+
return null;
|
|
1213
|
+
}
|
|
1214
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1215
|
+
buildCachedSnapshotCachePolicy$2, buildNetworkSnapshotCachePolicy$2);
|
|
1216
|
+
};
|
|
1217
|
+
|
|
1218
|
+
function validate$6(obj, path = 'SuggestedCompletionRepresentation') {
|
|
1219
|
+
const v_error = (() => {
|
|
1220
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1221
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1222
|
+
}
|
|
1223
|
+
const obj_simpleString = obj.simpleString;
|
|
1224
|
+
const path_simpleString = path + '.simpleString';
|
|
1225
|
+
if (typeof obj_simpleString !== 'string') {
|
|
1226
|
+
return new TypeError('Expected "string" but received "' + typeof obj_simpleString + '" (at "' + path_simpleString + '")');
|
|
1227
|
+
}
|
|
1228
|
+
})();
|
|
1229
|
+
return v_error === undefined ? null : v_error;
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
const VERSION$1 = "120685134083f097a5c3e15081721a8a";
|
|
1233
|
+
function validate$5(obj, path = 'ProductSearchSuggestionsResultsRepresentation') {
|
|
1234
|
+
const v_error = (() => {
|
|
1235
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1236
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1237
|
+
}
|
|
1238
|
+
const obj_completions = obj.completions;
|
|
1239
|
+
const path_completions = path + '.completions';
|
|
1240
|
+
if (!ArrayIsArray(obj_completions)) {
|
|
1241
|
+
return new TypeError('Expected "array" but received "' + typeof obj_completions + '" (at "' + path_completions + '")');
|
|
1242
|
+
}
|
|
1243
|
+
for (let i = 0; i < obj_completions.length; i++) {
|
|
1244
|
+
const obj_completions_item = obj_completions[i];
|
|
1245
|
+
const path_completions_item = path_completions + '[' + i + ']';
|
|
1246
|
+
const referencepath_completions_itemValidationError = validate$6(obj_completions_item, path_completions_item);
|
|
1247
|
+
if (referencepath_completions_itemValidationError !== null) {
|
|
1248
|
+
let message = 'Object doesn\'t match SuggestedCompletionRepresentation (at "' + path_completions_item + '")\n';
|
|
1249
|
+
message += referencepath_completions_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1250
|
+
return new TypeError(message);
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
const obj_locale = obj.locale;
|
|
1254
|
+
const path_locale = path + '.locale';
|
|
1255
|
+
if (typeof obj_locale !== 'string') {
|
|
1256
|
+
return new TypeError('Expected "string" but received "' + typeof obj_locale + '" (at "' + path_locale + '")');
|
|
1257
|
+
}
|
|
1258
|
+
})();
|
|
1259
|
+
return v_error === undefined ? null : v_error;
|
|
1260
|
+
}
|
|
1261
|
+
const RepresentationType$1 = 'ProductSearchSuggestionsResultsRepresentation';
|
|
1262
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
1263
|
+
return input;
|
|
1264
|
+
}
|
|
1265
|
+
const select$4 = function ProductSearchSuggestionsResultsRepresentationSelect() {
|
|
1266
|
+
return {
|
|
1267
|
+
kind: 'Fragment',
|
|
1268
|
+
version: VERSION$1,
|
|
1269
|
+
private: [],
|
|
1270
|
+
opaque: true
|
|
1271
|
+
};
|
|
1272
|
+
};
|
|
1273
|
+
function equals$1(existing, incoming) {
|
|
1274
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
1275
|
+
return false;
|
|
1276
|
+
}
|
|
1277
|
+
return true;
|
|
1278
|
+
}
|
|
1279
|
+
const ingest$1 = function ProductSearchSuggestionsResultsRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1280
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1281
|
+
const validateError = validate$5(input);
|
|
1282
|
+
if (validateError !== null) {
|
|
1283
|
+
throw validateError;
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
const key = path.fullPath;
|
|
1287
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
|
|
1288
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "Commerce", VERSION$1, RepresentationType$1, equals$1);
|
|
1289
|
+
return createLink(key);
|
|
1290
|
+
};
|
|
1291
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
1292
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1293
|
+
const rootKey = fullPathFactory();
|
|
1294
|
+
rootKeySet.set(rootKey, {
|
|
1295
|
+
namespace: keyPrefix,
|
|
1296
|
+
representationName: RepresentationType$1,
|
|
1297
|
+
mergeable: false
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
function select$3(luvio, params) {
|
|
1302
|
+
return select$4();
|
|
1303
|
+
}
|
|
1304
|
+
function keyBuilder$3(luvio, params) {
|
|
1305
|
+
return keyPrefix + '::ProductSearchSuggestionsResultsRepresentation:(' + 'effectiveAccountId:' + params.queryParams.effectiveAccountId + ',' + 'limit:' + params.queryParams.limit + ',' + 'searchTerm:' + params.queryParams.searchTerm + ',' + 'webstoreId:' + params.urlParams.webstoreId + ')';
|
|
1306
|
+
}
|
|
1307
|
+
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
1308
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$3(luvio, resourceParams));
|
|
1309
|
+
}
|
|
1310
|
+
function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
|
|
1311
|
+
const { body } = response;
|
|
1312
|
+
const key = keyBuilder$3(luvio, resourceParams);
|
|
1313
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
1314
|
+
const snapshot = luvio.storeLookup({
|
|
1315
|
+
recordId: key,
|
|
1316
|
+
node: select$3(),
|
|
1317
|
+
variables: {},
|
|
1318
|
+
}, snapshotRefresh);
|
|
1319
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1320
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1321
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
deepFreeze(snapshot.data);
|
|
1325
|
+
return snapshot;
|
|
1326
|
+
}
|
|
1327
|
+
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
1328
|
+
const key = keyBuilder$3(luvio, params);
|
|
1329
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1330
|
+
luvio.storeIngestError(key, errorSnapshot);
|
|
1331
|
+
return errorSnapshot;
|
|
1332
|
+
}
|
|
1333
|
+
function createResourceRequest$2(config) {
|
|
1334
|
+
const headers = {};
|
|
1335
|
+
return {
|
|
1336
|
+
baseUri: '/services/data/v66.0',
|
|
1337
|
+
basePath: '/commerce/webstores/' + config.urlParams.webstoreId + '/search/suggestions',
|
|
1338
|
+
method: 'get',
|
|
1339
|
+
body: null,
|
|
1340
|
+
urlParams: config.urlParams,
|
|
1341
|
+
queryParams: config.queryParams,
|
|
1342
|
+
headers,
|
|
1343
|
+
priority: 'normal',
|
|
1344
|
+
};
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
const adapterName$2 = 'getSuggestions';
|
|
1348
|
+
const getSuggestions_ConfigPropertyMetadata = [
|
|
1349
|
+
generateParamConfigMetadata('webstoreId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1350
|
+
generateParamConfigMetadata('effectiveAccountId', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1351
|
+
generateParamConfigMetadata('limit', false, 1 /* QueryParameter */, 3 /* Integer */),
|
|
1352
|
+
generateParamConfigMetadata('searchTerm', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1353
|
+
];
|
|
1354
|
+
const getSuggestions_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getSuggestions_ConfigPropertyMetadata);
|
|
1355
|
+
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$7(getSuggestions_ConfigPropertyMetadata);
|
|
1356
|
+
function keyBuilder$2(luvio, config) {
|
|
1357
|
+
const resourceParams = createResourceParams$2(config);
|
|
1358
|
+
return keyBuilder$3(luvio, resourceParams);
|
|
1359
|
+
}
|
|
1360
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
1361
|
+
const config = {};
|
|
1362
|
+
typeCheckConfig$7(untrustedConfig, config, getSuggestions_ConfigPropertyMetadata);
|
|
1363
|
+
return config;
|
|
1364
|
+
}
|
|
1365
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
1366
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1367
|
+
return null;
|
|
1368
|
+
}
|
|
1369
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1370
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1371
|
+
}
|
|
1372
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
1373
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1374
|
+
return null;
|
|
1375
|
+
}
|
|
1376
|
+
return config;
|
|
1377
|
+
}
|
|
1378
|
+
function adapterFragment$1(luvio, config) {
|
|
1379
|
+
createResourceParams$2(config);
|
|
1380
|
+
return select$3();
|
|
1381
|
+
}
|
|
1382
|
+
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
1383
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
|
|
1384
|
+
config,
|
|
1385
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1386
|
+
});
|
|
1387
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1388
|
+
}
|
|
1389
|
+
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
1390
|
+
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
1391
|
+
config,
|
|
1392
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1393
|
+
});
|
|
1394
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1395
|
+
}
|
|
1396
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
1397
|
+
const resourceParams = createResourceParams$2(config);
|
|
1398
|
+
const request = createResourceRequest$2(resourceParams);
|
|
1399
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1400
|
+
.then((response) => {
|
|
1401
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
|
|
1402
|
+
const cache = new StoreKeyMap();
|
|
1403
|
+
getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
|
|
1404
|
+
return cache;
|
|
1405
|
+
});
|
|
1406
|
+
}, (response) => {
|
|
1407
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
1408
|
+
});
|
|
1409
|
+
}
|
|
1410
|
+
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
1411
|
+
return buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
|
|
1412
|
+
}
|
|
1413
|
+
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
1414
|
+
const { luvio, config } = context;
|
|
1415
|
+
const selector = {
|
|
1416
|
+
recordId: keyBuilder$2(luvio, config),
|
|
1417
|
+
node: adapterFragment$1(luvio, config),
|
|
1418
|
+
variables: {},
|
|
1419
|
+
};
|
|
1420
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1421
|
+
config,
|
|
1422
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1423
|
+
});
|
|
1424
|
+
return cacheSnapshot;
|
|
1425
|
+
}
|
|
1426
|
+
const getSuggestionsAdapterFactory = (luvio) => function Commerce__getSuggestions(untrustedConfig, requestContext) {
|
|
1427
|
+
const config = validateAdapterConfig$2(untrustedConfig, getSuggestions_ConfigPropertyNames);
|
|
1428
|
+
// Invalid or incomplete config
|
|
1429
|
+
if (config === null) {
|
|
1430
|
+
return null;
|
|
1431
|
+
}
|
|
1432
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1433
|
+
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
1434
|
+
};
|
|
1435
|
+
|
|
1436
|
+
function validate$4(obj, path = 'SearchCategoryRepresentation') {
|
|
1437
|
+
const v_error = (() => {
|
|
1438
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1439
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1440
|
+
}
|
|
1441
|
+
const obj_children = obj.children;
|
|
1442
|
+
const path_children = path + '.children';
|
|
1443
|
+
if (!ArrayIsArray(obj_children)) {
|
|
1444
|
+
return new TypeError('Expected "array" but received "' + typeof obj_children + '" (at "' + path_children + '")');
|
|
1445
|
+
}
|
|
1446
|
+
for (let i = 0; i < obj_children.length; i++) {
|
|
1447
|
+
const obj_children_item = obj_children[i];
|
|
1448
|
+
const path_children_item = path_children + '[' + i + ']';
|
|
1449
|
+
const referencepath_children_itemValidationError = validate$4(obj_children_item, path_children_item);
|
|
1450
|
+
if (referencepath_children_itemValidationError !== null) {
|
|
1451
|
+
let message = 'Object doesn\'t match SearchCategoryRepresentation (at "' + path_children_item + '")\n';
|
|
1452
|
+
message += referencepath_children_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1453
|
+
return new TypeError(message);
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
const obj_productCount = obj.productCount;
|
|
1457
|
+
const path_productCount = path + '.productCount';
|
|
1458
|
+
if (typeof obj_productCount !== 'number' || (typeof obj_productCount === 'number' && Math.floor(obj_productCount) !== obj_productCount)) {
|
|
1459
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_productCount + '" (at "' + path_productCount + '")');
|
|
1460
|
+
}
|
|
1461
|
+
})();
|
|
1462
|
+
return v_error === undefined ? null : v_error;
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
var DiscriminatorValues$1;
|
|
1466
|
+
(function (DiscriminatorValues) {
|
|
1467
|
+
DiscriminatorValues["DistinctValue"] = "DistinctValue";
|
|
1468
|
+
})(DiscriminatorValues$1 || (DiscriminatorValues$1 = {}));
|
|
1469
|
+
|
|
1470
|
+
var DiscriminatorValues;
|
|
1471
|
+
(function (DiscriminatorValues) {
|
|
1472
|
+
DiscriminatorValues["DistinctValue"] = "DistinctValue";
|
|
1473
|
+
})(DiscriminatorValues || (DiscriminatorValues = {}));
|
|
1474
|
+
function validate$3(obj, path = 'SearchFacetRepresentation') {
|
|
1475
|
+
const v_error = (() => {
|
|
1476
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1477
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1478
|
+
}
|
|
1479
|
+
if (obj.attributeType !== undefined) {
|
|
1480
|
+
const obj_attributeType = obj.attributeType;
|
|
1481
|
+
const path_attributeType = path + '.attributeType';
|
|
1482
|
+
if (typeof obj_attributeType !== 'string') {
|
|
1483
|
+
return new TypeError('Expected "string" but received "' + typeof obj_attributeType + '" (at "' + path_attributeType + '")');
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
const obj_displayName = obj.displayName;
|
|
1487
|
+
const path_displayName = path + '.displayName';
|
|
1488
|
+
if (typeof obj_displayName !== 'string') {
|
|
1489
|
+
return new TypeError('Expected "string" but received "' + typeof obj_displayName + '" (at "' + path_displayName + '")');
|
|
1490
|
+
}
|
|
1491
|
+
const obj_displayRank = obj.displayRank;
|
|
1492
|
+
const path_displayRank = path + '.displayRank';
|
|
1493
|
+
if (typeof obj_displayRank !== 'number' || (typeof obj_displayRank === 'number' && Math.floor(obj_displayRank) !== obj_displayRank)) {
|
|
1494
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_displayRank + '" (at "' + path_displayRank + '")');
|
|
1495
|
+
}
|
|
1496
|
+
const obj_displayType = obj.displayType;
|
|
1497
|
+
const path_displayType = path + '.displayType';
|
|
1498
|
+
if (typeof obj_displayType !== 'string') {
|
|
1499
|
+
return new TypeError('Expected "string" but received "' + typeof obj_displayType + '" (at "' + path_displayType + '")');
|
|
1500
|
+
}
|
|
1501
|
+
if (obj.facetType !== undefined) {
|
|
1502
|
+
const obj_facetType = obj.facetType;
|
|
1503
|
+
const path_facetType = path + '.facetType';
|
|
1504
|
+
if (typeof obj_facetType !== 'string') {
|
|
1505
|
+
return new TypeError('Expected "string" but received "' + typeof obj_facetType + '" (at "' + path_facetType + '")');
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
const obj_nameOrId = obj.nameOrId;
|
|
1509
|
+
const path_nameOrId = path + '.nameOrId';
|
|
1510
|
+
if (typeof obj_nameOrId !== 'string') {
|
|
1511
|
+
return new TypeError('Expected "string" but received "' + typeof obj_nameOrId + '" (at "' + path_nameOrId + '")');
|
|
1512
|
+
}
|
|
1513
|
+
})();
|
|
1514
|
+
return v_error === undefined ? null : v_error;
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
function validate$2(obj, path = 'ProductSummaryRepresentation') {
|
|
1518
|
+
const v_error = (() => {
|
|
1519
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1520
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1521
|
+
}
|
|
1522
|
+
const obj_fields = obj.fields;
|
|
1523
|
+
const path_fields = path + '.fields';
|
|
1524
|
+
if (typeof obj_fields !== 'object' || ArrayIsArray(obj_fields) || obj_fields === null) {
|
|
1525
|
+
return new TypeError('Expected "object" but received "' + typeof obj_fields + '" (at "' + path_fields + '")');
|
|
1526
|
+
}
|
|
1527
|
+
const obj_fields_keys = ObjectKeys(obj_fields);
|
|
1528
|
+
for (let i = 0; i < obj_fields_keys.length; i++) {
|
|
1529
|
+
const key = obj_fields_keys[i];
|
|
1530
|
+
const obj_fields_prop = obj_fields[key];
|
|
1531
|
+
const path_fields_prop = path_fields + '["' + key + '"]';
|
|
1532
|
+
let obj_fields_prop_union0 = null;
|
|
1533
|
+
const obj_fields_prop_union0_error = (() => {
|
|
1534
|
+
if (typeof obj_fields_prop !== 'string') {
|
|
1535
|
+
return new TypeError('Expected "string" but received "' + typeof obj_fields_prop + '" (at "' + path_fields_prop + '")');
|
|
1536
|
+
}
|
|
1537
|
+
})();
|
|
1538
|
+
if (obj_fields_prop_union0_error != null) {
|
|
1539
|
+
obj_fields_prop_union0 = obj_fields_prop_union0_error.message;
|
|
1540
|
+
}
|
|
1541
|
+
let obj_fields_prop_union1 = null;
|
|
1542
|
+
const obj_fields_prop_union1_error = (() => {
|
|
1543
|
+
if (obj_fields_prop !== null) {
|
|
1544
|
+
return new TypeError('Expected "null" but received "' + typeof obj_fields_prop + '" (at "' + path_fields_prop + '")');
|
|
1545
|
+
}
|
|
1546
|
+
})();
|
|
1547
|
+
if (obj_fields_prop_union1_error != null) {
|
|
1548
|
+
obj_fields_prop_union1 = obj_fields_prop_union1_error.message;
|
|
1549
|
+
}
|
|
1550
|
+
if (obj_fields_prop_union0 && obj_fields_prop_union1) {
|
|
1551
|
+
let message = 'Object doesn\'t match union (at "' + path_fields_prop + '")';
|
|
1552
|
+
message += '\n' + obj_fields_prop_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
1553
|
+
message += '\n' + obj_fields_prop_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
1554
|
+
return new TypeError(message);
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
const obj_id = obj.id;
|
|
1558
|
+
const path_id = path + '.id';
|
|
1559
|
+
if (typeof obj_id !== 'string') {
|
|
1560
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
1561
|
+
}
|
|
1562
|
+
const obj_name = obj.name;
|
|
1563
|
+
const path_name = path + '.name';
|
|
1564
|
+
if (typeof obj_name !== 'string') {
|
|
1565
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
1566
|
+
}
|
|
1567
|
+
})();
|
|
1568
|
+
return v_error === undefined ? null : v_error;
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
function validate$1(obj, path = 'ProductSummaryCollectionRepresentation') {
|
|
1572
|
+
const v_error = (() => {
|
|
1573
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1574
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1575
|
+
}
|
|
1576
|
+
const obj_currencyIsoCode = obj.currencyIsoCode;
|
|
1577
|
+
const path_currencyIsoCode = path + '.currencyIsoCode';
|
|
1578
|
+
if (typeof obj_currencyIsoCode !== 'string') {
|
|
1579
|
+
return new TypeError('Expected "string" but received "' + typeof obj_currencyIsoCode + '" (at "' + path_currencyIsoCode + '")');
|
|
1580
|
+
}
|
|
1581
|
+
if (obj.pageSize !== undefined) {
|
|
1582
|
+
const obj_pageSize = obj.pageSize;
|
|
1583
|
+
const path_pageSize = path + '.pageSize';
|
|
1584
|
+
if (typeof obj_pageSize !== 'number' || (typeof obj_pageSize === 'number' && Math.floor(obj_pageSize) !== obj_pageSize)) {
|
|
1585
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_pageSize + '" (at "' + path_pageSize + '")');
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
const obj_products = obj.products;
|
|
1589
|
+
const path_products = path + '.products';
|
|
1590
|
+
if (!ArrayIsArray(obj_products)) {
|
|
1591
|
+
return new TypeError('Expected "array" but received "' + typeof obj_products + '" (at "' + path_products + '")');
|
|
1592
|
+
}
|
|
1593
|
+
for (let i = 0; i < obj_products.length; i++) {
|
|
1594
|
+
const obj_products_item = obj_products[i];
|
|
1595
|
+
const path_products_item = path_products + '[' + i + ']';
|
|
1596
|
+
const referencepath_products_itemValidationError = validate$2(obj_products_item, path_products_item);
|
|
1597
|
+
if (referencepath_products_itemValidationError !== null) {
|
|
1598
|
+
let message = 'Object doesn\'t match ProductSummaryRepresentation (at "' + path_products_item + '")\n';
|
|
1599
|
+
message += referencepath_products_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1600
|
+
return new TypeError(message);
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
const obj_total = obj.total;
|
|
1604
|
+
const path_total = path + '.total';
|
|
1605
|
+
if (typeof obj_total !== 'number' || (typeof obj_total === 'number' && Math.floor(obj_total) !== obj_total)) {
|
|
1606
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_total + '" (at "' + path_total + '")');
|
|
1607
|
+
}
|
|
1608
|
+
})();
|
|
1609
|
+
return v_error === undefined ? null : v_error;
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
const VERSION = "605737e638033254bdffaf42f248c5b7";
|
|
1613
|
+
function validate(obj, path = 'ProductSearchResultsRepresentation') {
|
|
1614
|
+
const v_error = (() => {
|
|
1615
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1616
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1617
|
+
}
|
|
1618
|
+
const obj_categories = obj.categories;
|
|
1619
|
+
const path_categories = path + '.categories';
|
|
1620
|
+
const referencepath_categoriesValidationError = validate$4(obj_categories, path_categories);
|
|
1621
|
+
if (referencepath_categoriesValidationError !== null) {
|
|
1622
|
+
let message = 'Object doesn\'t match SearchCategoryRepresentation (at "' + path_categories + '")\n';
|
|
1623
|
+
message += referencepath_categoriesValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1624
|
+
return new TypeError(message);
|
|
1625
|
+
}
|
|
1626
|
+
const obj_facets = obj.facets;
|
|
1627
|
+
const path_facets = path + '.facets';
|
|
1628
|
+
if (!ArrayIsArray(obj_facets)) {
|
|
1629
|
+
return new TypeError('Expected "array" but received "' + typeof obj_facets + '" (at "' + path_facets + '")');
|
|
1630
|
+
}
|
|
1631
|
+
for (let i = 0; i < obj_facets.length; i++) {
|
|
1632
|
+
const obj_facets_item = obj_facets[i];
|
|
1633
|
+
const path_facets_item = path_facets + '[' + i + ']';
|
|
1634
|
+
const referencepath_facets_itemValidationError = validate$3(obj_facets_item, path_facets_item);
|
|
1635
|
+
if (referencepath_facets_itemValidationError !== null) {
|
|
1636
|
+
let message = 'Object doesn\'t match SearchFacetRepresentation (at "' + path_facets_item + '")\n';
|
|
1637
|
+
message += referencepath_facets_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1638
|
+
return new TypeError(message);
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
const obj_locale = obj.locale;
|
|
1642
|
+
const path_locale = path + '.locale';
|
|
1643
|
+
if (typeof obj_locale !== 'string') {
|
|
1644
|
+
return new TypeError('Expected "string" but received "' + typeof obj_locale + '" (at "' + path_locale + '")');
|
|
1645
|
+
}
|
|
1646
|
+
const obj_productsPage = obj.productsPage;
|
|
1647
|
+
const path_productsPage = path + '.productsPage';
|
|
1648
|
+
const referencepath_productsPageValidationError = validate$1(obj_productsPage, path_productsPage);
|
|
1649
|
+
if (referencepath_productsPageValidationError !== null) {
|
|
1650
|
+
let message = 'Object doesn\'t match ProductSummaryCollectionRepresentation (at "' + path_productsPage + '")\n';
|
|
1651
|
+
message += referencepath_productsPageValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1652
|
+
return new TypeError(message);
|
|
1653
|
+
}
|
|
1654
|
+
})();
|
|
1655
|
+
return v_error === undefined ? null : v_error;
|
|
1656
|
+
}
|
|
1657
|
+
const RepresentationType = 'ProductSearchResultsRepresentation';
|
|
1658
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
1659
|
+
return input;
|
|
1660
|
+
}
|
|
1661
|
+
const select$2 = function ProductSearchResultsRepresentationSelect() {
|
|
1662
|
+
return {
|
|
1663
|
+
kind: 'Fragment',
|
|
1664
|
+
version: VERSION,
|
|
1665
|
+
private: [],
|
|
1666
|
+
opaque: true
|
|
1667
|
+
};
|
|
1668
|
+
};
|
|
1669
|
+
function equals(existing, incoming) {
|
|
1670
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
1671
|
+
return false;
|
|
1672
|
+
}
|
|
1673
|
+
return true;
|
|
1674
|
+
}
|
|
1675
|
+
const ingest = function ProductSearchResultsRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1676
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1677
|
+
const validateError = validate(input);
|
|
1678
|
+
if (validateError !== null) {
|
|
1679
|
+
throw validateError;
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
const key = path.fullPath;
|
|
1683
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
|
|
1684
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "Commerce", VERSION, RepresentationType, equals);
|
|
1685
|
+
return createLink(key);
|
|
1686
|
+
};
|
|
1687
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
1688
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1689
|
+
const rootKey = fullPathFactory();
|
|
1690
|
+
rootKeySet.set(rootKey, {
|
|
1691
|
+
namespace: keyPrefix,
|
|
1692
|
+
representationName: RepresentationType,
|
|
1693
|
+
mergeable: false
|
|
1694
|
+
});
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
function select$1(luvio, params) {
|
|
1698
|
+
return select$2();
|
|
1699
|
+
}
|
|
1700
|
+
function keyBuilder$1(luvio, params) {
|
|
1701
|
+
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 + '::' + '[' + params.body.refinements.map(element => stableJSONStringify(element)).join(',') + ']' + '::' + 'searchTerm:' + params.body.searchTerm + '::' + 'sortOrderId:' + params.body.sortOrderId + ')';
|
|
1702
|
+
}
|
|
1703
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
1704
|
+
getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
1705
|
+
}
|
|
1706
|
+
function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
1707
|
+
const { body } = response;
|
|
1708
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
1709
|
+
luvio.storeIngest(key, ingest, body);
|
|
1710
|
+
const snapshot = luvio.storeLookup({
|
|
1711
|
+
recordId: key,
|
|
1712
|
+
node: select$1(),
|
|
1713
|
+
variables: {},
|
|
1714
|
+
}, snapshotRefresh);
|
|
1715
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1716
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1717
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
deepFreeze(snapshot.data);
|
|
1721
|
+
return snapshot;
|
|
1722
|
+
}
|
|
1723
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
1724
|
+
const key = keyBuilder$1(luvio, params);
|
|
1725
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1726
|
+
luvio.storeIngestError(key, errorSnapshot);
|
|
1727
|
+
return errorSnapshot;
|
|
1728
|
+
}
|
|
1729
|
+
function createResourceRequest$1(config) {
|
|
1730
|
+
const headers = {};
|
|
1731
|
+
return {
|
|
1732
|
+
baseUri: '/services/data/v66.0',
|
|
1733
|
+
basePath: '/commerce/webstores/' + config.urlParams.webstoreId + '/search/product-search',
|
|
1734
|
+
method: 'post',
|
|
1735
|
+
body: config.body,
|
|
1736
|
+
urlParams: config.urlParams,
|
|
1737
|
+
queryParams: config.queryParams,
|
|
1738
|
+
headers,
|
|
1739
|
+
priority: 'normal',
|
|
1740
|
+
};
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
const adapterName$1 = 'productSearch';
|
|
1744
|
+
const productSearch_ConfigPropertyMetadata = [
|
|
1745
|
+
generateParamConfigMetadata('webstoreId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1746
|
+
generateParamConfigMetadata('effectiveAccountId', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1747
|
+
generateParamConfigMetadata('categoryId', true, 2 /* Body */, 0 /* String */),
|
|
1748
|
+
generateParamConfigMetadata('fields', true, 2 /* Body */, 0 /* String */, true),
|
|
1749
|
+
generateParamConfigMetadata('page', true, 2 /* Body */, 3 /* Integer */),
|
|
1750
|
+
generateParamConfigMetadata('pageSize', true, 2 /* Body */, 3 /* Integer */),
|
|
1751
|
+
generateParamConfigMetadata('refinements', true, 2 /* Body */, 4 /* Unsupported */, true),
|
|
1752
|
+
generateParamConfigMetadata('searchTerm', true, 2 /* Body */, 0 /* String */),
|
|
1753
|
+
generateParamConfigMetadata('sortOrderId', true, 2 /* Body */, 0 /* String */),
|
|
1754
|
+
];
|
|
1755
|
+
const productSearch_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, productSearch_ConfigPropertyMetadata);
|
|
1756
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$7(productSearch_ConfigPropertyMetadata);
|
|
1757
|
+
function keyBuilder(luvio, config) {
|
|
1758
|
+
const resourceParams = createResourceParams$1(config);
|
|
1759
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
1760
|
+
}
|
|
1761
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
1762
|
+
const config = {};
|
|
1763
|
+
typeCheckConfig$7(untrustedConfig, config, productSearch_ConfigPropertyMetadata);
|
|
1764
|
+
const untrustedConfig_refinements = untrustedConfig.refinements;
|
|
1765
|
+
if (ArrayIsArray$1(untrustedConfig_refinements)) {
|
|
1766
|
+
const untrustedConfig_refinements_array = [];
|
|
1767
|
+
for (let i = 0, arrayLength = untrustedConfig_refinements.length; i < arrayLength; i++) {
|
|
1768
|
+
const untrustedConfig_refinements_item = untrustedConfig_refinements[i];
|
|
1769
|
+
if (untrustedIsObject(untrustedConfig_refinements_item)) {
|
|
1770
|
+
const untrustedConfig_refinements_item_object = {};
|
|
1771
|
+
if (untrustedConfig_refinements_item_object !== undefined && Object.keys(untrustedConfig_refinements_item_object).length >= 0) {
|
|
1772
|
+
untrustedConfig_refinements_array.push(untrustedConfig_refinements_item_object);
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
config.refinements = untrustedConfig_refinements_array;
|
|
1777
|
+
}
|
|
1778
|
+
return config;
|
|
1779
|
+
}
|
|
1780
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
1781
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1782
|
+
return null;
|
|
1783
|
+
}
|
|
1784
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1785
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1786
|
+
}
|
|
1787
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
1788
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1789
|
+
return null;
|
|
1790
|
+
}
|
|
1791
|
+
return config;
|
|
1792
|
+
}
|
|
1793
|
+
function adapterFragment(luvio, config) {
|
|
1794
|
+
createResourceParams$1(config);
|
|
1795
|
+
return select$1();
|
|
1796
|
+
}
|
|
1797
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
1798
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
|
|
1799
|
+
config,
|
|
1800
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
1801
|
+
});
|
|
1802
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1803
|
+
}
|
|
1804
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
1805
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
1806
|
+
config,
|
|
1807
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
1808
|
+
});
|
|
1809
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1810
|
+
}
|
|
1811
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
1812
|
+
const resourceParams = createResourceParams$1(config);
|
|
1813
|
+
const request = createResourceRequest$1(resourceParams);
|
|
1814
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1815
|
+
.then((response) => {
|
|
1816
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
1817
|
+
const cache = new StoreKeyMap();
|
|
1818
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
1819
|
+
return cache;
|
|
1820
|
+
});
|
|
1821
|
+
}, (response) => {
|
|
1822
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
1823
|
+
});
|
|
1824
|
+
}
|
|
1825
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
1826
|
+
return buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, 'get', false);
|
|
1827
|
+
}
|
|
1828
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
1829
|
+
const { luvio, config } = context;
|
|
1830
|
+
const selector = {
|
|
1831
|
+
recordId: keyBuilder(luvio, config),
|
|
1832
|
+
node: adapterFragment(luvio, config),
|
|
1833
|
+
variables: {},
|
|
1834
|
+
};
|
|
1835
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1836
|
+
config,
|
|
1837
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
1838
|
+
});
|
|
1839
|
+
return cacheSnapshot;
|
|
1840
|
+
}
|
|
1841
|
+
const productSearchAdapterFactory = (luvio) => function Commerce__productSearch(untrustedConfig, requestContext) {
|
|
1842
|
+
const config = validateAdapterConfig$1(untrustedConfig, productSearch_ConfigPropertyNames);
|
|
1843
|
+
// Invalid or incomplete config
|
|
1844
|
+
if (config === null) {
|
|
1845
|
+
return null;
|
|
1846
|
+
}
|
|
1847
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1848
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
1849
|
+
};
|
|
1850
|
+
|
|
1851
|
+
function select(luvio, params) {
|
|
1852
|
+
return select$9();
|
|
1853
|
+
}
|
|
1854
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
1855
|
+
getTypeCacheKeys$3(storeKeyMap, luvio, response);
|
|
1856
|
+
}
|
|
1857
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
1858
|
+
const { body } = response;
|
|
1859
|
+
const key = keyBuilderFromType(luvio, body);
|
|
1860
|
+
luvio.storeIngest(key, ingest$3, body);
|
|
1861
|
+
const snapshot = luvio.storeLookup({
|
|
1862
|
+
recordId: key,
|
|
1863
|
+
node: select(),
|
|
1864
|
+
variables: {},
|
|
1865
|
+
});
|
|
1866
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1867
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1868
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
deepFreeze(snapshot.data);
|
|
1872
|
+
return snapshot;
|
|
1873
|
+
}
|
|
1874
|
+
function createResourceRequest(config) {
|
|
1875
|
+
const headers = {};
|
|
1876
|
+
return {
|
|
1877
|
+
baseUri: '/services/data/v66.0',
|
|
1878
|
+
basePath: '/commerce/management/webstores/' + config.urlParams.webstoreId + '/search/boost-bury-rules/' + config.urlParams.ruleId + '',
|
|
1879
|
+
method: 'patch',
|
|
1880
|
+
body: config.body,
|
|
1881
|
+
urlParams: config.urlParams,
|
|
1882
|
+
queryParams: {},
|
|
1883
|
+
headers,
|
|
1884
|
+
priority: 'normal',
|
|
1885
|
+
};
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
const adapterName = 'updateSearchBoostBuryRule';
|
|
1889
|
+
const updateSearchBoostBuryRule_ConfigPropertyMetadata = [
|
|
1890
|
+
generateParamConfigMetadata('ruleId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1891
|
+
generateParamConfigMetadata('webstoreId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1892
|
+
generateParamConfigMetadata('action', true, 2 /* Body */, 0 /* String */),
|
|
1893
|
+
generateParamConfigMetadata('endDate', true, 2 /* Body */, 0 /* String */),
|
|
1894
|
+
generateParamConfigMetadata('level', true, 2 /* Body */, 3 /* Integer */),
|
|
1895
|
+
generateParamConfigMetadata('name', true, 2 /* Body */, 0 /* String */),
|
|
1896
|
+
generateParamConfigMetadata('queryContext', true, 2 /* Body */, 4 /* Unsupported */),
|
|
1897
|
+
generateParamConfigMetadata('startDate', true, 2 /* Body */, 0 /* String */),
|
|
1898
|
+
generateParamConfigMetadata('targetExpression', true, 2 /* Body */, 4 /* Unsupported */),
|
|
1899
|
+
];
|
|
1900
|
+
const updateSearchBoostBuryRule_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, updateSearchBoostBuryRule_ConfigPropertyMetadata);
|
|
1901
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$7(updateSearchBoostBuryRule_ConfigPropertyMetadata);
|
|
1902
|
+
function typeCheckConfig(untrustedConfig) {
|
|
1903
|
+
const config = {};
|
|
1904
|
+
typeCheckConfig$7(untrustedConfig, config, updateSearchBoostBuryRule_ConfigPropertyMetadata);
|
|
1905
|
+
const untrustedConfig_queryContext = untrustedConfig.queryContext;
|
|
1906
|
+
const referenceBoostBuryQueryContextInputRepresentationValidationError = validate$f(untrustedConfig_queryContext);
|
|
1907
|
+
if (referenceBoostBuryQueryContextInputRepresentationValidationError === null) {
|
|
1908
|
+
config.queryContext = untrustedConfig_queryContext;
|
|
1909
|
+
}
|
|
1910
|
+
const untrustedConfig_targetExpression = untrustedConfig.targetExpression;
|
|
1911
|
+
const referenceBoostBuryTargetExpressionInputRepresentationValidationError = validate$d(untrustedConfig_targetExpression);
|
|
1912
|
+
if (referenceBoostBuryTargetExpressionInputRepresentationValidationError === null) {
|
|
1913
|
+
config.targetExpression = untrustedConfig_targetExpression;
|
|
1914
|
+
}
|
|
1915
|
+
return config;
|
|
1916
|
+
}
|
|
1917
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
1918
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1919
|
+
return null;
|
|
1920
|
+
}
|
|
1921
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1922
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1923
|
+
}
|
|
1924
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
1925
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1926
|
+
return null;
|
|
1927
|
+
}
|
|
1928
|
+
return config;
|
|
1929
|
+
}
|
|
1930
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
1931
|
+
const resourceParams = createResourceParams(config);
|
|
1932
|
+
const request = createResourceRequest(resourceParams);
|
|
1933
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1934
|
+
.then((response) => {
|
|
1935
|
+
return luvio.handleSuccessResponse(() => {
|
|
1936
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
1937
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1938
|
+
}, () => {
|
|
1939
|
+
const cache = new StoreKeyMap();
|
|
1940
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
1941
|
+
return cache;
|
|
1942
|
+
});
|
|
1943
|
+
}, (response) => {
|
|
1944
|
+
deepFreeze(response);
|
|
1945
|
+
throw response;
|
|
1946
|
+
});
|
|
1947
|
+
}
|
|
1948
|
+
const updateSearchBoostBuryRuleAdapterFactory = (luvio) => {
|
|
1949
|
+
return function updateSearchBoostBuryRule(untrustedConfig) {
|
|
1950
|
+
const config = validateAdapterConfig(untrustedConfig, updateSearchBoostBuryRule_ConfigPropertyNames);
|
|
1951
|
+
// Invalid or incomplete config
|
|
1952
|
+
if (config === null) {
|
|
1953
|
+
throw new Error('Invalid config for "updateSearchBoostBuryRule"');
|
|
1954
|
+
}
|
|
1955
|
+
return buildNetworkSnapshot(luvio, config);
|
|
1956
|
+
};
|
|
1957
|
+
};
|
|
1958
|
+
|
|
1959
|
+
let createSearchBoostBuryRule;
|
|
1960
|
+
let deleteSearchBoostBuryRule;
|
|
1961
|
+
let getSearchBoostBuryRule;
|
|
1962
|
+
let getSearchBoostBuryRuleNotifyChange;
|
|
1963
|
+
let getSearchBoostBuryRules;
|
|
1964
|
+
let getSuggestions;
|
|
1965
|
+
let productSearch;
|
|
1966
|
+
let updateSearchBoostBuryRule;
|
|
1967
|
+
// Imperative GET Adapters
|
|
1968
|
+
let getSearchBoostBuryRule_imperative;
|
|
1969
|
+
let getSearchBoostBuryRules_imperative;
|
|
1970
|
+
let getSuggestions_imperative;
|
|
1971
|
+
let productSearch_imperative;
|
|
1972
|
+
const getSearchBoostBuryRuleMetadata = { apiFamily: 'Commerce', name: 'getSearchBoostBuryRule' };
|
|
1973
|
+
const getSearchBoostBuryRulesMetadata = { apiFamily: 'Commerce', name: 'getSearchBoostBuryRules' };
|
|
1974
|
+
const getSuggestionsMetadata = { apiFamily: 'Commerce', name: 'getSuggestions' };
|
|
1975
|
+
const productSearchMetadata = { apiFamily: 'Commerce', name: 'productSearch' };
|
|
1976
|
+
// Notify Update Available
|
|
1977
|
+
function bindExportsTo$1(luvio) {
|
|
1978
|
+
// LDS Adapters
|
|
1979
|
+
const getSearchBoostBuryRule_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getSearchBoostBuryRule', getSearchBoostBuryRuleAdapterFactory), getSearchBoostBuryRuleMetadata);
|
|
1980
|
+
const getSearchBoostBuryRules_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getSearchBoostBuryRules', getSearchBoostBuryRulesAdapterFactory), getSearchBoostBuryRulesMetadata);
|
|
1981
|
+
const getSuggestions_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getSuggestions', getSuggestionsAdapterFactory), getSuggestionsMetadata);
|
|
1982
|
+
const productSearch_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'productSearch', productSearchAdapterFactory), productSearchMetadata);
|
|
1983
|
+
function unwrapSnapshotData(factory) {
|
|
1984
|
+
const adapter = factory(luvio);
|
|
1985
|
+
return (config) => adapter(config).then((snapshot) => snapshot.data);
|
|
1986
|
+
}
|
|
1987
|
+
return {
|
|
1988
|
+
createSearchBoostBuryRule: unwrapSnapshotData(createSearchBoostBuryRuleAdapterFactory),
|
|
1989
|
+
deleteSearchBoostBuryRule: createLDSAdapter(luvio, adapterName$5, deleteSearchBoostBuryRuleAdapterFactory),
|
|
1990
|
+
getSearchBoostBuryRule: createWireAdapterConstructor(luvio, getSearchBoostBuryRule_ldsAdapter, getSearchBoostBuryRuleMetadata),
|
|
1991
|
+
getSearchBoostBuryRuleNotifyChange: createLDSAdapter(luvio, 'getSearchBoostBuryRuleNotifyChange', notifyChangeFactory),
|
|
1992
|
+
getSearchBoostBuryRules: createWireAdapterConstructor(luvio, getSearchBoostBuryRules_ldsAdapter, getSearchBoostBuryRulesMetadata),
|
|
1993
|
+
getSuggestions: createWireAdapterConstructor(luvio, getSuggestions_ldsAdapter, getSuggestionsMetadata),
|
|
1994
|
+
productSearch: createWireAdapterConstructor(luvio, productSearch_ldsAdapter, productSearchMetadata),
|
|
1995
|
+
updateSearchBoostBuryRule: unwrapSnapshotData(updateSearchBoostBuryRuleAdapterFactory),
|
|
1996
|
+
// Imperative GET Adapters
|
|
1997
|
+
getSearchBoostBuryRule_imperative: createImperativeAdapter(luvio, getSearchBoostBuryRule_ldsAdapter, getSearchBoostBuryRuleMetadata),
|
|
1998
|
+
getSearchBoostBuryRules_imperative: createImperativeAdapter(luvio, getSearchBoostBuryRules_ldsAdapter, getSearchBoostBuryRulesMetadata),
|
|
1999
|
+
getSuggestions_imperative: createImperativeAdapter(luvio, getSuggestions_ldsAdapter, getSuggestionsMetadata),
|
|
2000
|
+
productSearch_imperative: createImperativeAdapter(luvio, productSearch_ldsAdapter, productSearchMetadata),
|
|
2001
|
+
// Notify Update Availables
|
|
2002
|
+
};
|
|
2003
|
+
}
|
|
2004
|
+
withDefaultLuvio((luvio) => {
|
|
2005
|
+
({
|
|
2006
|
+
createSearchBoostBuryRule,
|
|
2007
|
+
deleteSearchBoostBuryRule,
|
|
2008
|
+
getSearchBoostBuryRule,
|
|
2009
|
+
getSearchBoostBuryRuleNotifyChange,
|
|
2010
|
+
getSearchBoostBuryRules,
|
|
2011
|
+
getSuggestions,
|
|
2012
|
+
productSearch,
|
|
2013
|
+
updateSearchBoostBuryRule,
|
|
2014
|
+
getSearchBoostBuryRule_imperative,
|
|
2015
|
+
getSearchBoostBuryRules_imperative,
|
|
2016
|
+
getSuggestions_imperative,
|
|
2017
|
+
productSearch_imperative,
|
|
2018
|
+
} = bindExportsTo$1(luvio));
|
|
2019
|
+
});
|
|
2020
|
+
|
|
2021
|
+
const notifyUpdateAvailableFactory = (luvio) => {
|
|
2022
|
+
// custom override of notifyUpdateAvailable function to bypass luvio key requirement since it is not possible to have
|
|
2023
|
+
// a luvio.key for SearchBoostBuryRulesCollectionOutputRepresentation
|
|
2024
|
+
return function notifySearchBoostBuryRulesCollectionOutputRepresentationUpdateAvailable(webstoreId) {
|
|
2025
|
+
const key = keyBuilder$5(luvio, { urlParams: { webstoreId: webstoreId } });
|
|
2026
|
+
return luvio.notifyStoreUpdateAvailable([key]);
|
|
2027
|
+
};
|
|
2028
|
+
};
|
|
2029
|
+
|
|
2030
|
+
/**
|
|
2031
|
+
* Original file is in 'packages/lds-adapters-commerce-search/src/generated/artifacts/sfdc.ts'
|
|
2032
|
+
* Overriding this file to manually inject custom notifyUpdateAvailableFactory implementation.
|
|
2033
|
+
*/
|
|
2034
|
+
// Notify Update Available
|
|
2035
|
+
// manually injected notifyUpdateAvailable
|
|
2036
|
+
let notifySearchBoostBuryRulesCollectionOutputRepresentationUpdateAvailable;
|
|
2037
|
+
function bindExportsTo(luvio) {
|
|
2038
|
+
return {
|
|
2039
|
+
// Notify Update Availables
|
|
2040
|
+
notifySearchBoostBuryRulesCollectionOutputRepresentationUpdateAvailable: createLDSAdapter(luvio, 'notifySearchBoostBuryRulesCollectionOutputRepresentationUpdateAvailable', notifyUpdateAvailableFactory),
|
|
2041
|
+
};
|
|
2042
|
+
}
|
|
2043
|
+
withDefaultLuvio((luvio) => {
|
|
2044
|
+
({ notifySearchBoostBuryRulesCollectionOutputRepresentationUpdateAvailable } =
|
|
2045
|
+
bindExportsTo(luvio));
|
|
2046
|
+
});
|
|
2047
|
+
|
|
2048
|
+
export { createSearchBoostBuryRule, deleteSearchBoostBuryRule, getSearchBoostBuryRule, getSearchBoostBuryRuleNotifyChange, getSearchBoostBuryRule_imperative, getSearchBoostBuryRules, getSearchBoostBuryRules_imperative, getSuggestions, getSuggestions_imperative, notifySearchBoostBuryRulesCollectionOutputRepresentationUpdateAvailable, productSearch, productSearch_imperative, updateSearchBoostBuryRule };
|
|
2049
|
+
// version: 0.1.0-dev1-c978a7b010
|