@salesforce/lds-adapters-cdp-engmt-config 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/cdp-engmt-config.js +2195 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/createEngagementSignal.d.ts +27 -0
- package/dist/es/es2018/types/src/generated/adapters/createEngagementSignalCompoundMetric.d.ts +20 -0
- package/dist/es/es2018/types/src/generated/adapters/createEngagementSignalMetric.d.ts +20 -0
- package/dist/es/es2018/types/src/generated/adapters/deleteCompoundMetric.d.ts +14 -0
- package/dist/es/es2018/types/src/generated/adapters/deleteEngagementSignal.d.ts +14 -0
- package/dist/es/es2018/types/src/generated/adapters/deleteEngagementSignalMetric.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/adapters/getCompoundMetric.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/adapters/getEngagementSignal.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/adapters/getEngagementSignalMetric.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/adapters/getEngagementSignals.d.ts +30 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +10 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +18 -0
- package/dist/es/es2018/types/src/generated/resources/deletePersonalizationCompoundMetricsByCompoundMetricIdOrName.d.ts +12 -0
- package/dist/es/es2018/types/src/generated/resources/deletePersonalizationEngagementSignalsByEngagementSignalId.d.ts +12 -0
- package/dist/es/es2018/types/src/generated/resources/deletePersonalizationEngagementSignalsMetricsByEngagementSignalIdAndEngagementSignalMetricId.d.ts +13 -0
- package/dist/es/es2018/types/src/generated/resources/getPersonalizationCompoundMetricsByCompoundMetricIdOrName.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/resources/getPersonalizationEngagementSignals.d.ts +18 -0
- package/dist/es/es2018/types/src/generated/resources/getPersonalizationEngagementSignalsByEngagementSignalId.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/resources/getPersonalizationEngagementSignalsMetricsByEngagementSignalIdAndEngagementSignalMetricId.d.ts +17 -0
- package/dist/es/es2018/types/src/generated/resources/postPersonalizationCompoundMetrics.d.ts +17 -0
- package/dist/es/es2018/types/src/generated/resources/postPersonalizationEngagementSignals.d.ts +24 -0
- package/dist/es/es2018/types/src/generated/resources/postPersonalizationEngagementSignalsMetricsByEngagementSignalId.d.ts +19 -0
- package/dist/es/es2018/types/src/generated/types/EngagementSignalCollectionRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/EngagementSignalCompoundMetricCollectionInputRepresentation.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/types/EngagementSignalCompoundMetricInputRepresentation.d.ts +43 -0
- package/dist/es/es2018/types/src/generated/types/EngagementSignalCompoundMetricRepresentation.d.ts +55 -0
- package/dist/es/es2018/types/src/generated/types/EngagementSignalFilterGroupCollectionInputRepresentation.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/types/EngagementSignalFilterGroupInputRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/EngagementSignalFilterGroupRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/EngagementSignalFilterInputRepresentation.d.ts +37 -0
- package/dist/es/es2018/types/src/generated/types/EngagementSignalFilterRepresentation.d.ts +37 -0
- package/dist/es/es2018/types/src/generated/types/EngagementSignalInputRepresentation.d.ts +64 -0
- package/dist/es/es2018/types/src/generated/types/EngagementSignalMetricCollectionInputRepresentation.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/types/EngagementSignalMetricFieldInputRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/EngagementSignalMetricFieldRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/EngagementSignalMetricInputRepresentation.d.ts +40 -0
- package/dist/es/es2018/types/src/generated/types/EngagementSignalMetricRepresentation.d.ts +47 -0
- package/dist/es/es2018/types/src/generated/types/EngagementSignalRepresentation.d.ts +88 -0
- package/dist/es/es2018/types/src/generated/types/FieldInputRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/FieldRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
- package/package.json +69 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +2422 -0
- package/src/raml/api.raml +543 -0
- package/src/raml/luvio.raml +85 -0
|
@@ -0,0 +1,2195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$4, typeCheckConfig as typeCheckConfig$a, StoreKeyMap, createResourceParams as createResourceParams$a } from '@luvio/engine';
|
|
8
|
+
|
|
9
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
10
|
+
const { keys: ObjectKeys, create: ObjectCreate } = Object;
|
|
11
|
+
const { isArray: ArrayIsArray$1 } = Array;
|
|
12
|
+
/**
|
|
13
|
+
* Validates an adapter config is well-formed.
|
|
14
|
+
* @param config The config to validate.
|
|
15
|
+
* @param adapter The adapter validation configuration.
|
|
16
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
17
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
18
|
+
*/
|
|
19
|
+
function validateConfig(config, adapter, oneOf) {
|
|
20
|
+
const { displayName } = adapter;
|
|
21
|
+
const { required, optional, unsupported } = adapter.parameters;
|
|
22
|
+
if (config === undefined ||
|
|
23
|
+
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
24
|
+
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
25
|
+
}
|
|
26
|
+
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
27
|
+
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
28
|
+
}
|
|
29
|
+
if (unsupported !== undefined &&
|
|
30
|
+
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
31
|
+
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
32
|
+
}
|
|
33
|
+
const supported = required.concat(optional);
|
|
34
|
+
if (ObjectKeys(config).some(key => !supported.includes(key))) {
|
|
35
|
+
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function untrustedIsObject(untrusted) {
|
|
39
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
40
|
+
}
|
|
41
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
42
|
+
return configPropertyNames.parameters.required.every(req => req in config);
|
|
43
|
+
}
|
|
44
|
+
const snapshotRefreshOptions = {
|
|
45
|
+
overrides: {
|
|
46
|
+
headers: {
|
|
47
|
+
'Cache-Control': 'no-cache',
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
|
|
52
|
+
return {
|
|
53
|
+
name,
|
|
54
|
+
required,
|
|
55
|
+
resourceType,
|
|
56
|
+
typeCheckShape,
|
|
57
|
+
isArrayShape,
|
|
58
|
+
coerceFn,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function buildAdapterValidationConfig(displayName, paramsMeta) {
|
|
62
|
+
const required = paramsMeta.filter(p => p.required).map(p => p.name);
|
|
63
|
+
const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
|
|
64
|
+
return {
|
|
65
|
+
displayName,
|
|
66
|
+
parameters: {
|
|
67
|
+
required,
|
|
68
|
+
optional,
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const keyPrefix = 'engmt-config';
|
|
73
|
+
|
|
74
|
+
const { isArray: ArrayIsArray } = Array;
|
|
75
|
+
const { stringify: JSONStringify } = JSON;
|
|
76
|
+
function equalsArray(a, b, equalsItem) {
|
|
77
|
+
const aLength = a.length;
|
|
78
|
+
const bLength = b.length;
|
|
79
|
+
if (aLength !== bLength) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
for (let i = 0; i < aLength; i++) {
|
|
83
|
+
if (equalsItem(a[i], b[i]) === false) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
function createLink(ref) {
|
|
90
|
+
return {
|
|
91
|
+
__ref: serializeStructuredKey(ref),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const TTL$3 = 6000;
|
|
96
|
+
const VERSION$5 = "171063a9be8004fe115bb5e31a231dd9";
|
|
97
|
+
function validate$5(obj, path = 'EngagementSignalCollectionRepresentation') {
|
|
98
|
+
const v_error = (() => {
|
|
99
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
100
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
101
|
+
}
|
|
102
|
+
const obj_currentPageUrl = obj.currentPageUrl;
|
|
103
|
+
const path_currentPageUrl = path + '.currentPageUrl';
|
|
104
|
+
if (typeof obj_currentPageUrl !== 'string') {
|
|
105
|
+
return new TypeError('Expected "string" but received "' + typeof obj_currentPageUrl + '" (at "' + path_currentPageUrl + '")');
|
|
106
|
+
}
|
|
107
|
+
const obj_engagementSignals = obj.engagementSignals;
|
|
108
|
+
const path_engagementSignals = path + '.engagementSignals';
|
|
109
|
+
if (!ArrayIsArray(obj_engagementSignals)) {
|
|
110
|
+
return new TypeError('Expected "array" but received "' + typeof obj_engagementSignals + '" (at "' + path_engagementSignals + '")');
|
|
111
|
+
}
|
|
112
|
+
for (let i = 0; i < obj_engagementSignals.length; i++) {
|
|
113
|
+
const obj_engagementSignals_item = obj_engagementSignals[i];
|
|
114
|
+
const path_engagementSignals_item = path_engagementSignals + '[' + i + ']';
|
|
115
|
+
if (obj_engagementSignals_item === undefined) {
|
|
116
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_engagementSignals_item + '" (at "' + path_engagementSignals_item + '")');
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (obj.nextPageUrl !== undefined) {
|
|
120
|
+
const obj_nextPageUrl = obj.nextPageUrl;
|
|
121
|
+
const path_nextPageUrl = path + '.nextPageUrl';
|
|
122
|
+
let obj_nextPageUrl_union0 = null;
|
|
123
|
+
const obj_nextPageUrl_union0_error = (() => {
|
|
124
|
+
if (typeof obj_nextPageUrl !== 'string') {
|
|
125
|
+
return new TypeError('Expected "string" but received "' + typeof obj_nextPageUrl + '" (at "' + path_nextPageUrl + '")');
|
|
126
|
+
}
|
|
127
|
+
})();
|
|
128
|
+
if (obj_nextPageUrl_union0_error != null) {
|
|
129
|
+
obj_nextPageUrl_union0 = obj_nextPageUrl_union0_error.message;
|
|
130
|
+
}
|
|
131
|
+
let obj_nextPageUrl_union1 = null;
|
|
132
|
+
const obj_nextPageUrl_union1_error = (() => {
|
|
133
|
+
if (obj_nextPageUrl !== null) {
|
|
134
|
+
return new TypeError('Expected "null" but received "' + typeof obj_nextPageUrl + '" (at "' + path_nextPageUrl + '")');
|
|
135
|
+
}
|
|
136
|
+
})();
|
|
137
|
+
if (obj_nextPageUrl_union1_error != null) {
|
|
138
|
+
obj_nextPageUrl_union1 = obj_nextPageUrl_union1_error.message;
|
|
139
|
+
}
|
|
140
|
+
if (obj_nextPageUrl_union0 && obj_nextPageUrl_union1) {
|
|
141
|
+
let message = 'Object doesn\'t match union (at "' + path_nextPageUrl + '")';
|
|
142
|
+
message += '\n' + obj_nextPageUrl_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
143
|
+
message += '\n' + obj_nextPageUrl_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
144
|
+
return new TypeError(message);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const obj_totalSize = obj.totalSize;
|
|
148
|
+
const path_totalSize = path + '.totalSize';
|
|
149
|
+
if (typeof obj_totalSize !== 'number' || (typeof obj_totalSize === 'number' && Math.floor(obj_totalSize) !== obj_totalSize)) {
|
|
150
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_totalSize + '" (at "' + path_totalSize + '")');
|
|
151
|
+
}
|
|
152
|
+
})();
|
|
153
|
+
return v_error === undefined ? null : v_error;
|
|
154
|
+
}
|
|
155
|
+
const RepresentationType$3 = 'EngagementSignalCollectionRepresentation';
|
|
156
|
+
function normalize$3(input, existing, path, luvio, store, timestamp) {
|
|
157
|
+
return input;
|
|
158
|
+
}
|
|
159
|
+
const select$c = function EngagementSignalCollectionRepresentationSelect() {
|
|
160
|
+
return {
|
|
161
|
+
kind: 'Fragment',
|
|
162
|
+
version: VERSION$5,
|
|
163
|
+
private: [],
|
|
164
|
+
selections: [
|
|
165
|
+
{
|
|
166
|
+
name: 'currentPageUrl',
|
|
167
|
+
kind: 'Scalar'
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
name: 'engagementSignals',
|
|
171
|
+
kind: 'Object',
|
|
172
|
+
// any
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: 'nextPageUrl',
|
|
176
|
+
kind: 'Scalar',
|
|
177
|
+
required: false
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
name: 'totalSize',
|
|
181
|
+
kind: 'Scalar'
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
function equals$5(existing, incoming) {
|
|
187
|
+
const existing_totalSize = existing.totalSize;
|
|
188
|
+
const incoming_totalSize = incoming.totalSize;
|
|
189
|
+
if (!(existing_totalSize === incoming_totalSize)) {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
const existing_currentPageUrl = existing.currentPageUrl;
|
|
193
|
+
const incoming_currentPageUrl = incoming.currentPageUrl;
|
|
194
|
+
if (!(existing_currentPageUrl === incoming_currentPageUrl)) {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
const existing_engagementSignals = existing.engagementSignals;
|
|
198
|
+
const incoming_engagementSignals = incoming.engagementSignals;
|
|
199
|
+
const equals_engagementSignals_items = equalsArray(existing_engagementSignals, incoming_engagementSignals, (existing_engagementSignals_item, incoming_engagementSignals_item) => {
|
|
200
|
+
if (JSONStringify(incoming_engagementSignals_item) !== JSONStringify(existing_engagementSignals_item)) {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
if (equals_engagementSignals_items === false) {
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
const existing_nextPageUrl = existing.nextPageUrl;
|
|
208
|
+
const incoming_nextPageUrl = incoming.nextPageUrl;
|
|
209
|
+
// if at least one of these optionals is defined
|
|
210
|
+
if (existing_nextPageUrl !== undefined || incoming_nextPageUrl !== undefined) {
|
|
211
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
212
|
+
// not equal
|
|
213
|
+
if (existing_nextPageUrl === undefined || incoming_nextPageUrl === undefined) {
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
if (!(existing_nextPageUrl === incoming_nextPageUrl)) {
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
const ingest$3 = function EngagementSignalCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
223
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
224
|
+
const validateError = validate$5(input);
|
|
225
|
+
if (validateError !== null) {
|
|
226
|
+
throw validateError;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
const key = path.fullPath;
|
|
230
|
+
const ttlToUse = TTL$3;
|
|
231
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "engmt-config", VERSION$5, RepresentationType$3, equals$5);
|
|
232
|
+
return createLink(key);
|
|
233
|
+
};
|
|
234
|
+
function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
|
|
235
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
236
|
+
const rootKey = fullPathFactory();
|
|
237
|
+
rootKeySet.set(rootKey, {
|
|
238
|
+
namespace: keyPrefix,
|
|
239
|
+
representationName: RepresentationType$3,
|
|
240
|
+
mergeable: false
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function select$b(luvio, params) {
|
|
245
|
+
return select$c();
|
|
246
|
+
}
|
|
247
|
+
function keyBuilder$d(luvio, params) {
|
|
248
|
+
return keyPrefix + '::EngagementSignalCollectionRepresentation:(' + 'dataspaceName:' + params.queryParams.dataspaceName + ',' + 'limit:' + params.queryParams.limit + ',' + 'offset:' + params.queryParams.offset + ',' + 'profileDataGraphName:' + params.queryParams.profileDataGraphName + ')';
|
|
249
|
+
}
|
|
250
|
+
function getResponseCacheKeys$9(storeKeyMap, luvio, resourceParams, response) {
|
|
251
|
+
getTypeCacheKeys$3(storeKeyMap, luvio, response, () => keyBuilder$d(luvio, resourceParams));
|
|
252
|
+
}
|
|
253
|
+
function ingestSuccess$6(luvio, resourceParams, response, snapshotRefresh) {
|
|
254
|
+
const { body } = response;
|
|
255
|
+
const key = keyBuilder$d(luvio, resourceParams);
|
|
256
|
+
luvio.storeIngest(key, ingest$3, body);
|
|
257
|
+
const snapshot = luvio.storeLookup({
|
|
258
|
+
recordId: key,
|
|
259
|
+
node: select$b(),
|
|
260
|
+
variables: {},
|
|
261
|
+
}, snapshotRefresh);
|
|
262
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
263
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
264
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
deepFreeze(snapshot.data);
|
|
268
|
+
return snapshot;
|
|
269
|
+
}
|
|
270
|
+
function ingestError$3(luvio, params, error, snapshotRefresh) {
|
|
271
|
+
const key = keyBuilder$d(luvio, params);
|
|
272
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
273
|
+
const storeMetadataParams = {
|
|
274
|
+
ttl: TTL$3,
|
|
275
|
+
namespace: keyPrefix,
|
|
276
|
+
version: VERSION$5,
|
|
277
|
+
representationName: RepresentationType$3
|
|
278
|
+
};
|
|
279
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
280
|
+
return errorSnapshot;
|
|
281
|
+
}
|
|
282
|
+
function createResourceRequest$9(config) {
|
|
283
|
+
const headers = {};
|
|
284
|
+
return {
|
|
285
|
+
baseUri: '/services/data/v66.0',
|
|
286
|
+
basePath: '/personalization/engagement-signals',
|
|
287
|
+
method: 'get',
|
|
288
|
+
body: null,
|
|
289
|
+
urlParams: {},
|
|
290
|
+
queryParams: config.queryParams,
|
|
291
|
+
headers,
|
|
292
|
+
priority: 'normal',
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
const adapterName$9 = 'getEngagementSignals';
|
|
297
|
+
const getEngagementSignals_ConfigPropertyMetadata = [
|
|
298
|
+
generateParamConfigMetadata('dataspaceName', false, 1 /* QueryParameter */, 0 /* String */),
|
|
299
|
+
generateParamConfigMetadata('limit', false, 1 /* QueryParameter */, 3 /* Integer */),
|
|
300
|
+
generateParamConfigMetadata('offset', false, 1 /* QueryParameter */, 3 /* Integer */),
|
|
301
|
+
generateParamConfigMetadata('profileDataGraphName', false, 1 /* QueryParameter */, 0 /* String */),
|
|
302
|
+
];
|
|
303
|
+
const getEngagementSignals_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$9, getEngagementSignals_ConfigPropertyMetadata);
|
|
304
|
+
const createResourceParams$9 = /*#__PURE__*/ createResourceParams$a(getEngagementSignals_ConfigPropertyMetadata);
|
|
305
|
+
function keyBuilder$c(luvio, config) {
|
|
306
|
+
const resourceParams = createResourceParams$9(config);
|
|
307
|
+
return keyBuilder$d(luvio, resourceParams);
|
|
308
|
+
}
|
|
309
|
+
function typeCheckConfig$9(untrustedConfig) {
|
|
310
|
+
const config = {};
|
|
311
|
+
typeCheckConfig$a(untrustedConfig, config, getEngagementSignals_ConfigPropertyMetadata);
|
|
312
|
+
return config;
|
|
313
|
+
}
|
|
314
|
+
function validateAdapterConfig$9(untrustedConfig, configPropertyNames) {
|
|
315
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
316
|
+
return null;
|
|
317
|
+
}
|
|
318
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
319
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
320
|
+
}
|
|
321
|
+
const config = typeCheckConfig$9(untrustedConfig);
|
|
322
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
323
|
+
return null;
|
|
324
|
+
}
|
|
325
|
+
return config;
|
|
326
|
+
}
|
|
327
|
+
function adapterFragment$3(luvio, config) {
|
|
328
|
+
createResourceParams$9(config);
|
|
329
|
+
return select$b();
|
|
330
|
+
}
|
|
331
|
+
function onFetchResponseSuccess$3(luvio, config, resourceParams, response) {
|
|
332
|
+
const snapshot = ingestSuccess$6(luvio, resourceParams, response, {
|
|
333
|
+
config,
|
|
334
|
+
resolve: () => buildNetworkSnapshot$9(luvio, config, snapshotRefreshOptions)
|
|
335
|
+
});
|
|
336
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
337
|
+
}
|
|
338
|
+
function onFetchResponseError$3(luvio, config, resourceParams, response) {
|
|
339
|
+
const snapshot = ingestError$3(luvio, resourceParams, response, {
|
|
340
|
+
config,
|
|
341
|
+
resolve: () => buildNetworkSnapshot$9(luvio, config, snapshotRefreshOptions)
|
|
342
|
+
});
|
|
343
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
344
|
+
}
|
|
345
|
+
function buildNetworkSnapshot$9(luvio, config, options) {
|
|
346
|
+
const resourceParams = createResourceParams$9(config);
|
|
347
|
+
const request = createResourceRequest$9(resourceParams);
|
|
348
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
349
|
+
.then((response) => {
|
|
350
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$3(luvio, config, resourceParams, response), () => {
|
|
351
|
+
const cache = new StoreKeyMap();
|
|
352
|
+
getResponseCacheKeys$9(cache, luvio, resourceParams, response.body);
|
|
353
|
+
return cache;
|
|
354
|
+
});
|
|
355
|
+
}, (response) => {
|
|
356
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$3(luvio, config, resourceParams, response));
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
function buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext) {
|
|
360
|
+
return buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext, buildNetworkSnapshot$9, undefined, false);
|
|
361
|
+
}
|
|
362
|
+
function buildCachedSnapshotCachePolicy$3(context, storeLookup) {
|
|
363
|
+
const { luvio, config } = context;
|
|
364
|
+
const selector = {
|
|
365
|
+
recordId: keyBuilder$c(luvio, config),
|
|
366
|
+
node: adapterFragment$3(luvio, config),
|
|
367
|
+
variables: {},
|
|
368
|
+
};
|
|
369
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
370
|
+
config,
|
|
371
|
+
resolve: () => buildNetworkSnapshot$9(luvio, config, snapshotRefreshOptions)
|
|
372
|
+
});
|
|
373
|
+
return cacheSnapshot;
|
|
374
|
+
}
|
|
375
|
+
const getEngagementSignalsAdapterFactory = (luvio) => function engmtConfig__getEngagementSignals(untrustedConfig, requestContext) {
|
|
376
|
+
const config = validateAdapterConfig$9(untrustedConfig, getEngagementSignals_ConfigPropertyNames);
|
|
377
|
+
// Invalid or incomplete config
|
|
378
|
+
if (config === null) {
|
|
379
|
+
return null;
|
|
380
|
+
}
|
|
381
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
382
|
+
buildCachedSnapshotCachePolicy$3, buildNetworkSnapshotCachePolicy$3);
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
const VERSION$4 = "8f73e1515e2fe09097e6618181bf923a";
|
|
386
|
+
function validate$4(obj, path = 'EngagementSignalFilterGroupRepresentation') {
|
|
387
|
+
const v_error = (() => {
|
|
388
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
389
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
390
|
+
}
|
|
391
|
+
const obj_conjunctiveOperator = obj.conjunctiveOperator;
|
|
392
|
+
const path_conjunctiveOperator = path + '.conjunctiveOperator';
|
|
393
|
+
if (typeof obj_conjunctiveOperator !== 'string') {
|
|
394
|
+
return new TypeError('Expected "string" but received "' + typeof obj_conjunctiveOperator + '" (at "' + path_conjunctiveOperator + '")');
|
|
395
|
+
}
|
|
396
|
+
const obj_filters = obj.filters;
|
|
397
|
+
const path_filters = path + '.filters';
|
|
398
|
+
if (!ArrayIsArray(obj_filters)) {
|
|
399
|
+
return new TypeError('Expected "array" but received "' + typeof obj_filters + '" (at "' + path_filters + '")');
|
|
400
|
+
}
|
|
401
|
+
for (let i = 0; i < obj_filters.length; i++) {
|
|
402
|
+
const obj_filters_item = obj_filters[i];
|
|
403
|
+
const path_filters_item = path_filters + '[' + i + ']';
|
|
404
|
+
if (obj_filters_item === undefined) {
|
|
405
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_filters_item + '" (at "' + path_filters_item + '")');
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
})();
|
|
409
|
+
return v_error === undefined ? null : v_error;
|
|
410
|
+
}
|
|
411
|
+
const select$a = function EngagementSignalFilterGroupRepresentationSelect() {
|
|
412
|
+
return {
|
|
413
|
+
kind: 'Fragment',
|
|
414
|
+
version: VERSION$4,
|
|
415
|
+
private: [],
|
|
416
|
+
selections: [
|
|
417
|
+
{
|
|
418
|
+
name: 'conjunctiveOperator',
|
|
419
|
+
kind: 'Scalar'
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
name: 'filters',
|
|
423
|
+
kind: 'Object',
|
|
424
|
+
// any
|
|
425
|
+
}
|
|
426
|
+
]
|
|
427
|
+
};
|
|
428
|
+
};
|
|
429
|
+
function equals$4(existing, incoming) {
|
|
430
|
+
const existing_conjunctiveOperator = existing.conjunctiveOperator;
|
|
431
|
+
const incoming_conjunctiveOperator = incoming.conjunctiveOperator;
|
|
432
|
+
if (!(existing_conjunctiveOperator === incoming_conjunctiveOperator)) {
|
|
433
|
+
return false;
|
|
434
|
+
}
|
|
435
|
+
const existing_filters = existing.filters;
|
|
436
|
+
const incoming_filters = incoming.filters;
|
|
437
|
+
const equals_filters_items = equalsArray(existing_filters, incoming_filters, (existing_filters_item, incoming_filters_item) => {
|
|
438
|
+
if (JSONStringify(incoming_filters_item) !== JSONStringify(existing_filters_item)) {
|
|
439
|
+
return false;
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
if (equals_filters_items === false) {
|
|
443
|
+
return false;
|
|
444
|
+
}
|
|
445
|
+
return true;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
const VERSION$3 = "0005de97d1fcbbc963014cd633384ca4";
|
|
449
|
+
function validate$3(obj, path = 'EngagementSignalMetricFieldRepresentation') {
|
|
450
|
+
const v_error = (() => {
|
|
451
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
452
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
453
|
+
}
|
|
454
|
+
const obj_engagementSignalMetricName = obj.engagementSignalMetricName;
|
|
455
|
+
const path_engagementSignalMetricName = path + '.engagementSignalMetricName';
|
|
456
|
+
if (typeof obj_engagementSignalMetricName !== 'string') {
|
|
457
|
+
return new TypeError('Expected "string" but received "' + typeof obj_engagementSignalMetricName + '" (at "' + path_engagementSignalMetricName + '")');
|
|
458
|
+
}
|
|
459
|
+
const obj_engagementSignalName = obj.engagementSignalName;
|
|
460
|
+
const path_engagementSignalName = path + '.engagementSignalName';
|
|
461
|
+
if (typeof obj_engagementSignalName !== 'string') {
|
|
462
|
+
return new TypeError('Expected "string" but received "' + typeof obj_engagementSignalName + '" (at "' + path_engagementSignalName + '")');
|
|
463
|
+
}
|
|
464
|
+
})();
|
|
465
|
+
return v_error === undefined ? null : v_error;
|
|
466
|
+
}
|
|
467
|
+
const select$9 = function EngagementSignalMetricFieldRepresentationSelect() {
|
|
468
|
+
return {
|
|
469
|
+
kind: 'Fragment',
|
|
470
|
+
version: VERSION$3,
|
|
471
|
+
private: [],
|
|
472
|
+
selections: [
|
|
473
|
+
{
|
|
474
|
+
name: 'engagementSignalMetricName',
|
|
475
|
+
kind: 'Scalar'
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
name: 'engagementSignalName',
|
|
479
|
+
kind: 'Scalar'
|
|
480
|
+
}
|
|
481
|
+
]
|
|
482
|
+
};
|
|
483
|
+
};
|
|
484
|
+
function equals$3(existing, incoming) {
|
|
485
|
+
const existing_engagementSignalMetricName = existing.engagementSignalMetricName;
|
|
486
|
+
const incoming_engagementSignalMetricName = incoming.engagementSignalMetricName;
|
|
487
|
+
if (!(existing_engagementSignalMetricName === incoming_engagementSignalMetricName)) {
|
|
488
|
+
return false;
|
|
489
|
+
}
|
|
490
|
+
const existing_engagementSignalName = existing.engagementSignalName;
|
|
491
|
+
const incoming_engagementSignalName = incoming.engagementSignalName;
|
|
492
|
+
if (!(existing_engagementSignalName === incoming_engagementSignalName)) {
|
|
493
|
+
return false;
|
|
494
|
+
}
|
|
495
|
+
return true;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
const TTL$2 = 6000;
|
|
499
|
+
const VERSION$2 = "d1b71af9a537281a97d72bbef89beb62";
|
|
500
|
+
function validate$2(obj, path = 'EngagementSignalCompoundMetricRepresentation') {
|
|
501
|
+
const v_error = (() => {
|
|
502
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
503
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
504
|
+
}
|
|
505
|
+
const obj_denominatorMetric = obj.denominatorMetric;
|
|
506
|
+
const path_denominatorMetric = path + '.denominatorMetric';
|
|
507
|
+
const referencepath_denominatorMetricValidationError = validate$3(obj_denominatorMetric, path_denominatorMetric);
|
|
508
|
+
if (referencepath_denominatorMetricValidationError !== null) {
|
|
509
|
+
let message = 'Object doesn\'t match EngagementSignalMetricFieldRepresentation (at "' + path_denominatorMetric + '")\n';
|
|
510
|
+
message += referencepath_denominatorMetricValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
511
|
+
return new TypeError(message);
|
|
512
|
+
}
|
|
513
|
+
const obj_description = obj.description;
|
|
514
|
+
const path_description = path + '.description';
|
|
515
|
+
if (typeof obj_description !== 'string') {
|
|
516
|
+
return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
|
|
517
|
+
}
|
|
518
|
+
const obj_id = obj.id;
|
|
519
|
+
const path_id = path + '.id';
|
|
520
|
+
if (typeof obj_id !== 'string') {
|
|
521
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
522
|
+
}
|
|
523
|
+
const obj_label = obj.label;
|
|
524
|
+
const path_label = path + '.label';
|
|
525
|
+
if (typeof obj_label !== 'string') {
|
|
526
|
+
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
527
|
+
}
|
|
528
|
+
const obj_name = obj.name;
|
|
529
|
+
const path_name = path + '.name';
|
|
530
|
+
if (typeof obj_name !== 'string') {
|
|
531
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
532
|
+
}
|
|
533
|
+
const obj_numeratorMetric = obj.numeratorMetric;
|
|
534
|
+
const path_numeratorMetric = path + '.numeratorMetric';
|
|
535
|
+
const referencepath_numeratorMetricValidationError = validate$3(obj_numeratorMetric, path_numeratorMetric);
|
|
536
|
+
if (referencepath_numeratorMetricValidationError !== null) {
|
|
537
|
+
let message = 'Object doesn\'t match EngagementSignalMetricFieldRepresentation (at "' + path_numeratorMetric + '")\n';
|
|
538
|
+
message += referencepath_numeratorMetricValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
539
|
+
return new TypeError(message);
|
|
540
|
+
}
|
|
541
|
+
const obj_operator = obj.operator;
|
|
542
|
+
const path_operator = path + '.operator';
|
|
543
|
+
if (typeof obj_operator !== 'string') {
|
|
544
|
+
return new TypeError('Expected "string" but received "' + typeof obj_operator + '" (at "' + path_operator + '")');
|
|
545
|
+
}
|
|
546
|
+
})();
|
|
547
|
+
return v_error === undefined ? null : v_error;
|
|
548
|
+
}
|
|
549
|
+
const RepresentationType$2 = 'EngagementSignalCompoundMetricRepresentation';
|
|
550
|
+
function keyBuilder$b(luvio, config) {
|
|
551
|
+
return keyPrefix + '::' + RepresentationType$2 + ':' + config.id;
|
|
552
|
+
}
|
|
553
|
+
function keyBuilderFromType$2(luvio, object) {
|
|
554
|
+
const keyParams = {
|
|
555
|
+
id: object.id
|
|
556
|
+
};
|
|
557
|
+
return keyBuilder$b(luvio, keyParams);
|
|
558
|
+
}
|
|
559
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
560
|
+
return input;
|
|
561
|
+
}
|
|
562
|
+
const select$8 = function EngagementSignalCompoundMetricRepresentationSelect() {
|
|
563
|
+
const { selections: EngagementSignalMetricFieldRepresentation__selections, opaque: EngagementSignalMetricFieldRepresentation__opaque, } = select$9();
|
|
564
|
+
return {
|
|
565
|
+
kind: 'Fragment',
|
|
566
|
+
version: VERSION$2,
|
|
567
|
+
private: [],
|
|
568
|
+
selections: [
|
|
569
|
+
{
|
|
570
|
+
name: 'denominatorMetric',
|
|
571
|
+
kind: 'Object',
|
|
572
|
+
selections: EngagementSignalMetricFieldRepresentation__selections
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
name: 'description',
|
|
576
|
+
kind: 'Scalar'
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
name: 'id',
|
|
580
|
+
kind: 'Scalar'
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
name: 'label',
|
|
584
|
+
kind: 'Scalar'
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
name: 'name',
|
|
588
|
+
kind: 'Scalar'
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
name: 'numeratorMetric',
|
|
592
|
+
kind: 'Object',
|
|
593
|
+
selections: EngagementSignalMetricFieldRepresentation__selections
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
name: 'operator',
|
|
597
|
+
kind: 'Scalar'
|
|
598
|
+
}
|
|
599
|
+
]
|
|
600
|
+
};
|
|
601
|
+
};
|
|
602
|
+
function equals$2(existing, incoming) {
|
|
603
|
+
const existing_description = existing.description;
|
|
604
|
+
const incoming_description = incoming.description;
|
|
605
|
+
if (!(existing_description === incoming_description)) {
|
|
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_label = existing.label;
|
|
614
|
+
const incoming_label = incoming.label;
|
|
615
|
+
if (!(existing_label === incoming_label)) {
|
|
616
|
+
return false;
|
|
617
|
+
}
|
|
618
|
+
const existing_name = existing.name;
|
|
619
|
+
const incoming_name = incoming.name;
|
|
620
|
+
if (!(existing_name === incoming_name)) {
|
|
621
|
+
return false;
|
|
622
|
+
}
|
|
623
|
+
const existing_operator = existing.operator;
|
|
624
|
+
const incoming_operator = incoming.operator;
|
|
625
|
+
if (!(existing_operator === incoming_operator)) {
|
|
626
|
+
return false;
|
|
627
|
+
}
|
|
628
|
+
const existing_denominatorMetric = existing.denominatorMetric;
|
|
629
|
+
const incoming_denominatorMetric = incoming.denominatorMetric;
|
|
630
|
+
if (!(equals$3(existing_denominatorMetric, incoming_denominatorMetric))) {
|
|
631
|
+
return false;
|
|
632
|
+
}
|
|
633
|
+
const existing_numeratorMetric = existing.numeratorMetric;
|
|
634
|
+
const incoming_numeratorMetric = incoming.numeratorMetric;
|
|
635
|
+
if (!(equals$3(existing_numeratorMetric, incoming_numeratorMetric))) {
|
|
636
|
+
return false;
|
|
637
|
+
}
|
|
638
|
+
return true;
|
|
639
|
+
}
|
|
640
|
+
const ingest$2 = function EngagementSignalCompoundMetricRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
641
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
642
|
+
const validateError = validate$2(input);
|
|
643
|
+
if (validateError !== null) {
|
|
644
|
+
throw validateError;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
const key = keyBuilderFromType$2(luvio, input);
|
|
648
|
+
const ttlToUse = TTL$2;
|
|
649
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "engmt-config", VERSION$2, RepresentationType$2, equals$2);
|
|
650
|
+
return createLink(key);
|
|
651
|
+
};
|
|
652
|
+
function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
|
|
653
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
654
|
+
const rootKey = keyBuilderFromType$2(luvio, input);
|
|
655
|
+
rootKeySet.set(rootKey, {
|
|
656
|
+
namespace: keyPrefix,
|
|
657
|
+
representationName: RepresentationType$2,
|
|
658
|
+
mergeable: false
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
const TTL$1 = 6000;
|
|
663
|
+
const VERSION$1 = "3c26e95c8929ac6685f9de88dab642ed";
|
|
664
|
+
function validate$1(obj, path = 'EngagementSignalMetricRepresentation') {
|
|
665
|
+
const v_error = (() => {
|
|
666
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
667
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
668
|
+
}
|
|
669
|
+
const obj_aggregateFunction = obj.aggregateFunction;
|
|
670
|
+
const path_aggregateFunction = path + '.aggregateFunction';
|
|
671
|
+
if (typeof obj_aggregateFunction !== 'string') {
|
|
672
|
+
return new TypeError('Expected "string" but received "' + typeof obj_aggregateFunction + '" (at "' + path_aggregateFunction + '")');
|
|
673
|
+
}
|
|
674
|
+
const obj_field = obj.field;
|
|
675
|
+
const path_field = path + '.field';
|
|
676
|
+
if (obj_field === undefined) {
|
|
677
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_field + '" (at "' + path_field + '")');
|
|
678
|
+
}
|
|
679
|
+
const obj_id = obj.id;
|
|
680
|
+
const path_id = path + '.id';
|
|
681
|
+
if (typeof obj_id !== 'string') {
|
|
682
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
683
|
+
}
|
|
684
|
+
const obj_name = obj.name;
|
|
685
|
+
const path_name = path + '.name';
|
|
686
|
+
if (typeof obj_name !== 'string') {
|
|
687
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
688
|
+
}
|
|
689
|
+
})();
|
|
690
|
+
return v_error === undefined ? null : v_error;
|
|
691
|
+
}
|
|
692
|
+
const RepresentationType$1 = 'EngagementSignalMetricRepresentation';
|
|
693
|
+
function keyBuilder$a(luvio, config) {
|
|
694
|
+
return keyPrefix + '::' + RepresentationType$1 + ':' + config.id;
|
|
695
|
+
}
|
|
696
|
+
function keyBuilderFromType$1(luvio, object) {
|
|
697
|
+
const keyParams = {
|
|
698
|
+
id: object.id
|
|
699
|
+
};
|
|
700
|
+
return keyBuilder$a(luvio, keyParams);
|
|
701
|
+
}
|
|
702
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
703
|
+
return input;
|
|
704
|
+
}
|
|
705
|
+
const select$7 = function EngagementSignalMetricRepresentationSelect() {
|
|
706
|
+
return {
|
|
707
|
+
kind: 'Fragment',
|
|
708
|
+
version: VERSION$1,
|
|
709
|
+
private: [],
|
|
710
|
+
selections: [
|
|
711
|
+
{
|
|
712
|
+
name: 'aggregateFunction',
|
|
713
|
+
kind: 'Scalar'
|
|
714
|
+
},
|
|
715
|
+
{
|
|
716
|
+
name: 'field',
|
|
717
|
+
kind: 'Object',
|
|
718
|
+
// any
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
name: 'id',
|
|
722
|
+
kind: 'Scalar'
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
name: 'name',
|
|
726
|
+
kind: 'Scalar'
|
|
727
|
+
}
|
|
728
|
+
]
|
|
729
|
+
};
|
|
730
|
+
};
|
|
731
|
+
function equals$1(existing, incoming) {
|
|
732
|
+
const existing_aggregateFunction = existing.aggregateFunction;
|
|
733
|
+
const incoming_aggregateFunction = incoming.aggregateFunction;
|
|
734
|
+
if (!(existing_aggregateFunction === incoming_aggregateFunction)) {
|
|
735
|
+
return false;
|
|
736
|
+
}
|
|
737
|
+
const existing_id = existing.id;
|
|
738
|
+
const incoming_id = incoming.id;
|
|
739
|
+
if (!(existing_id === incoming_id)) {
|
|
740
|
+
return false;
|
|
741
|
+
}
|
|
742
|
+
const existing_name = existing.name;
|
|
743
|
+
const incoming_name = incoming.name;
|
|
744
|
+
if (!(existing_name === incoming_name)) {
|
|
745
|
+
return false;
|
|
746
|
+
}
|
|
747
|
+
const existing_field = existing.field;
|
|
748
|
+
const incoming_field = incoming.field;
|
|
749
|
+
if (JSONStringify(incoming_field) !== JSONStringify(existing_field)) {
|
|
750
|
+
return false;
|
|
751
|
+
}
|
|
752
|
+
return true;
|
|
753
|
+
}
|
|
754
|
+
const ingest$1 = function EngagementSignalMetricRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
755
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
756
|
+
const validateError = validate$1(input);
|
|
757
|
+
if (validateError !== null) {
|
|
758
|
+
throw validateError;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
const key = keyBuilderFromType$1(luvio, input);
|
|
762
|
+
const ttlToUse = TTL$1;
|
|
763
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "engmt-config", VERSION$1, RepresentationType$1, equals$1);
|
|
764
|
+
return createLink(key);
|
|
765
|
+
};
|
|
766
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
767
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
768
|
+
const rootKey = keyBuilderFromType$1(luvio, input);
|
|
769
|
+
rootKeySet.set(rootKey, {
|
|
770
|
+
namespace: keyPrefix,
|
|
771
|
+
representationName: RepresentationType$1,
|
|
772
|
+
mergeable: false
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
const TTL = 6000;
|
|
777
|
+
const VERSION = "642992246eac3845fc5e2e16f2fe8021";
|
|
778
|
+
function validate(obj, path = 'EngagementSignalRepresentation') {
|
|
779
|
+
const v_error = (() => {
|
|
780
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
781
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
782
|
+
}
|
|
783
|
+
if (obj.catalogIdField !== undefined) {
|
|
784
|
+
const obj_catalogIdField = obj.catalogIdField;
|
|
785
|
+
const path_catalogIdField = path + '.catalogIdField';
|
|
786
|
+
if (obj_catalogIdField === undefined) {
|
|
787
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_catalogIdField + '" (at "' + path_catalogIdField + '")');
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
if (obj.compoundMetrics !== undefined) {
|
|
791
|
+
const obj_compoundMetrics = obj.compoundMetrics;
|
|
792
|
+
const path_compoundMetrics = path + '.compoundMetrics';
|
|
793
|
+
if (!ArrayIsArray(obj_compoundMetrics)) {
|
|
794
|
+
return new TypeError('Expected "array" but received "' + typeof obj_compoundMetrics + '" (at "' + path_compoundMetrics + '")');
|
|
795
|
+
}
|
|
796
|
+
for (let i = 0; i < obj_compoundMetrics.length; i++) {
|
|
797
|
+
const obj_compoundMetrics_item = obj_compoundMetrics[i];
|
|
798
|
+
const path_compoundMetrics_item = path_compoundMetrics + '[' + i + ']';
|
|
799
|
+
if (typeof obj_compoundMetrics_item !== 'object' || Array.isArray(obj_compoundMetrics_item)) {
|
|
800
|
+
return new TypeError('Expected "object" but received "' + typeof obj_compoundMetrics_item + '" (at "' + path_compoundMetrics_item + '")');
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
const obj_dataSpaceName = obj.dataSpaceName;
|
|
805
|
+
const path_dataSpaceName = path + '.dataSpaceName';
|
|
806
|
+
if (typeof obj_dataSpaceName !== 'string') {
|
|
807
|
+
return new TypeError('Expected "string" but received "' + typeof obj_dataSpaceName + '" (at "' + path_dataSpaceName + '")');
|
|
808
|
+
}
|
|
809
|
+
if (obj.distinctFields !== undefined) {
|
|
810
|
+
const obj_distinctFields = obj.distinctFields;
|
|
811
|
+
const path_distinctFields = path + '.distinctFields';
|
|
812
|
+
if (!ArrayIsArray(obj_distinctFields)) {
|
|
813
|
+
return new TypeError('Expected "array" but received "' + typeof obj_distinctFields + '" (at "' + path_distinctFields + '")');
|
|
814
|
+
}
|
|
815
|
+
for (let i = 0; i < obj_distinctFields.length; i++) {
|
|
816
|
+
const obj_distinctFields_item = obj_distinctFields[i];
|
|
817
|
+
const path_distinctFields_item = path_distinctFields + '[' + i + ']';
|
|
818
|
+
if (obj_distinctFields_item === undefined) {
|
|
819
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_distinctFields_item + '" (at "' + path_distinctFields_item + '")');
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
if (obj.filterGroups !== undefined) {
|
|
824
|
+
const obj_filterGroups = obj.filterGroups;
|
|
825
|
+
const path_filterGroups = path + '.filterGroups';
|
|
826
|
+
if (!ArrayIsArray(obj_filterGroups)) {
|
|
827
|
+
return new TypeError('Expected "array" but received "' + typeof obj_filterGroups + '" (at "' + path_filterGroups + '")');
|
|
828
|
+
}
|
|
829
|
+
for (let i = 0; i < obj_filterGroups.length; i++) {
|
|
830
|
+
const obj_filterGroups_item = obj_filterGroups[i];
|
|
831
|
+
const path_filterGroups_item = path_filterGroups + '[' + i + ']';
|
|
832
|
+
const referencepath_filterGroups_itemValidationError = validate$4(obj_filterGroups_item, path_filterGroups_item);
|
|
833
|
+
if (referencepath_filterGroups_itemValidationError !== null) {
|
|
834
|
+
let message = 'Object doesn\'t match EngagementSignalFilterGroupRepresentation (at "' + path_filterGroups_item + '")\n';
|
|
835
|
+
message += referencepath_filterGroups_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
836
|
+
return new TypeError(message);
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
const obj_id = obj.id;
|
|
841
|
+
const path_id = path + '.id';
|
|
842
|
+
if (typeof obj_id !== 'string') {
|
|
843
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
844
|
+
}
|
|
845
|
+
const obj_label = obj.label;
|
|
846
|
+
const path_label = path + '.label';
|
|
847
|
+
if (typeof obj_label !== 'string') {
|
|
848
|
+
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
849
|
+
}
|
|
850
|
+
if (obj.metrics !== undefined) {
|
|
851
|
+
const obj_metrics = obj.metrics;
|
|
852
|
+
const path_metrics = path + '.metrics';
|
|
853
|
+
if (!ArrayIsArray(obj_metrics)) {
|
|
854
|
+
return new TypeError('Expected "array" but received "' + typeof obj_metrics + '" (at "' + path_metrics + '")');
|
|
855
|
+
}
|
|
856
|
+
for (let i = 0; i < obj_metrics.length; i++) {
|
|
857
|
+
const obj_metrics_item = obj_metrics[i];
|
|
858
|
+
const path_metrics_item = path_metrics + '[' + i + ']';
|
|
859
|
+
if (typeof obj_metrics_item !== 'object' || Array.isArray(obj_metrics_item)) {
|
|
860
|
+
return new TypeError('Expected "object" but received "' + typeof obj_metrics_item + '" (at "' + path_metrics_item + '")');
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
const obj_name = obj.name;
|
|
865
|
+
const path_name = path + '.name';
|
|
866
|
+
if (typeof obj_name !== 'string') {
|
|
867
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
868
|
+
}
|
|
869
|
+
const obj_objectName = obj.objectName;
|
|
870
|
+
const path_objectName = path + '.objectName';
|
|
871
|
+
if (typeof obj_objectName !== 'string') {
|
|
872
|
+
return new TypeError('Expected "string" but received "' + typeof obj_objectName + '" (at "' + path_objectName + '")');
|
|
873
|
+
}
|
|
874
|
+
const obj_timestampField = obj.timestampField;
|
|
875
|
+
const path_timestampField = path + '.timestampField';
|
|
876
|
+
if (obj_timestampField === undefined) {
|
|
877
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_timestampField + '" (at "' + path_timestampField + '")');
|
|
878
|
+
}
|
|
879
|
+
const obj_uniqueIdentifier = obj.uniqueIdentifier;
|
|
880
|
+
const path_uniqueIdentifier = path + '.uniqueIdentifier';
|
|
881
|
+
if (obj_uniqueIdentifier === undefined) {
|
|
882
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_uniqueIdentifier + '" (at "' + path_uniqueIdentifier + '")');
|
|
883
|
+
}
|
|
884
|
+
const obj_userIdField = obj.userIdField;
|
|
885
|
+
const path_userIdField = path + '.userIdField';
|
|
886
|
+
if (obj_userIdField === undefined) {
|
|
887
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_userIdField + '" (at "' + path_userIdField + '")');
|
|
888
|
+
}
|
|
889
|
+
})();
|
|
890
|
+
return v_error === undefined ? null : v_error;
|
|
891
|
+
}
|
|
892
|
+
const RepresentationType = 'EngagementSignalRepresentation';
|
|
893
|
+
function keyBuilder$9(luvio, config) {
|
|
894
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.id;
|
|
895
|
+
}
|
|
896
|
+
function keyBuilderFromType(luvio, object) {
|
|
897
|
+
const keyParams = {
|
|
898
|
+
id: object.id
|
|
899
|
+
};
|
|
900
|
+
return keyBuilder$9(luvio, keyParams);
|
|
901
|
+
}
|
|
902
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
903
|
+
const input_compoundMetrics = input.compoundMetrics;
|
|
904
|
+
const input_compoundMetrics_id = path.fullPath + '__compoundMetrics';
|
|
905
|
+
if (input_compoundMetrics !== undefined) {
|
|
906
|
+
for (let i = 0; i < input_compoundMetrics.length; i++) {
|
|
907
|
+
const input_compoundMetrics_item = input_compoundMetrics[i];
|
|
908
|
+
let input_compoundMetrics_item_id = input_compoundMetrics_id + '__' + i;
|
|
909
|
+
input_compoundMetrics[i] = ingest$2(input_compoundMetrics_item, {
|
|
910
|
+
fullPath: input_compoundMetrics_item_id,
|
|
911
|
+
propertyName: i,
|
|
912
|
+
parent: {
|
|
913
|
+
data: input,
|
|
914
|
+
key: path.fullPath,
|
|
915
|
+
existing: existing,
|
|
916
|
+
},
|
|
917
|
+
ttl: path.ttl
|
|
918
|
+
}, luvio, store, timestamp);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
const input_metrics = input.metrics;
|
|
922
|
+
const input_metrics_id = path.fullPath + '__metrics';
|
|
923
|
+
if (input_metrics !== undefined) {
|
|
924
|
+
for (let i = 0; i < input_metrics.length; i++) {
|
|
925
|
+
const input_metrics_item = input_metrics[i];
|
|
926
|
+
let input_metrics_item_id = input_metrics_id + '__' + i;
|
|
927
|
+
input_metrics[i] = ingest$1(input_metrics_item, {
|
|
928
|
+
fullPath: input_metrics_item_id,
|
|
929
|
+
propertyName: i,
|
|
930
|
+
parent: {
|
|
931
|
+
data: input,
|
|
932
|
+
key: path.fullPath,
|
|
933
|
+
existing: existing,
|
|
934
|
+
},
|
|
935
|
+
ttl: path.ttl
|
|
936
|
+
}, luvio, store, timestamp);
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
return input;
|
|
940
|
+
}
|
|
941
|
+
const select$6 = function EngagementSignalRepresentationSelect() {
|
|
942
|
+
const { selections: EngagementSignalFilterGroupRepresentation__selections, opaque: EngagementSignalFilterGroupRepresentation__opaque, } = select$a();
|
|
943
|
+
return {
|
|
944
|
+
kind: 'Fragment',
|
|
945
|
+
version: VERSION,
|
|
946
|
+
private: [],
|
|
947
|
+
selections: [
|
|
948
|
+
{
|
|
949
|
+
name: 'catalogIdField',
|
|
950
|
+
kind: 'Object',
|
|
951
|
+
// any
|
|
952
|
+
},
|
|
953
|
+
{
|
|
954
|
+
name: 'compoundMetrics',
|
|
955
|
+
kind: 'Link',
|
|
956
|
+
plural: true,
|
|
957
|
+
required: false,
|
|
958
|
+
fragment: select$8()
|
|
959
|
+
},
|
|
960
|
+
{
|
|
961
|
+
name: 'dataSpaceName',
|
|
962
|
+
kind: 'Scalar'
|
|
963
|
+
},
|
|
964
|
+
{
|
|
965
|
+
name: 'distinctFields',
|
|
966
|
+
kind: 'Object',
|
|
967
|
+
// any
|
|
968
|
+
},
|
|
969
|
+
{
|
|
970
|
+
name: 'filterGroups',
|
|
971
|
+
kind: 'Object',
|
|
972
|
+
plural: true,
|
|
973
|
+
selections: EngagementSignalFilterGroupRepresentation__selections,
|
|
974
|
+
required: false
|
|
975
|
+
},
|
|
976
|
+
{
|
|
977
|
+
name: 'id',
|
|
978
|
+
kind: 'Scalar'
|
|
979
|
+
},
|
|
980
|
+
{
|
|
981
|
+
name: 'label',
|
|
982
|
+
kind: 'Scalar'
|
|
983
|
+
},
|
|
984
|
+
{
|
|
985
|
+
name: 'metrics',
|
|
986
|
+
kind: 'Link',
|
|
987
|
+
plural: true,
|
|
988
|
+
required: false,
|
|
989
|
+
fragment: select$7()
|
|
990
|
+
},
|
|
991
|
+
{
|
|
992
|
+
name: 'name',
|
|
993
|
+
kind: 'Scalar'
|
|
994
|
+
},
|
|
995
|
+
{
|
|
996
|
+
name: 'objectName',
|
|
997
|
+
kind: 'Scalar'
|
|
998
|
+
},
|
|
999
|
+
{
|
|
1000
|
+
name: 'timestampField',
|
|
1001
|
+
kind: 'Object',
|
|
1002
|
+
// any
|
|
1003
|
+
},
|
|
1004
|
+
{
|
|
1005
|
+
name: 'uniqueIdentifier',
|
|
1006
|
+
kind: 'Object',
|
|
1007
|
+
// any
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
name: 'userIdField',
|
|
1011
|
+
kind: 'Object',
|
|
1012
|
+
// any
|
|
1013
|
+
}
|
|
1014
|
+
]
|
|
1015
|
+
};
|
|
1016
|
+
};
|
|
1017
|
+
function equals(existing, incoming) {
|
|
1018
|
+
const existing_dataSpaceName = existing.dataSpaceName;
|
|
1019
|
+
const incoming_dataSpaceName = incoming.dataSpaceName;
|
|
1020
|
+
if (!(existing_dataSpaceName === incoming_dataSpaceName)) {
|
|
1021
|
+
return false;
|
|
1022
|
+
}
|
|
1023
|
+
const existing_id = existing.id;
|
|
1024
|
+
const incoming_id = incoming.id;
|
|
1025
|
+
if (!(existing_id === incoming_id)) {
|
|
1026
|
+
return false;
|
|
1027
|
+
}
|
|
1028
|
+
const existing_label = existing.label;
|
|
1029
|
+
const incoming_label = incoming.label;
|
|
1030
|
+
if (!(existing_label === incoming_label)) {
|
|
1031
|
+
return false;
|
|
1032
|
+
}
|
|
1033
|
+
const existing_name = existing.name;
|
|
1034
|
+
const incoming_name = incoming.name;
|
|
1035
|
+
if (!(existing_name === incoming_name)) {
|
|
1036
|
+
return false;
|
|
1037
|
+
}
|
|
1038
|
+
const existing_objectName = existing.objectName;
|
|
1039
|
+
const incoming_objectName = incoming.objectName;
|
|
1040
|
+
if (!(existing_objectName === incoming_objectName)) {
|
|
1041
|
+
return false;
|
|
1042
|
+
}
|
|
1043
|
+
const existing_catalogIdField = existing.catalogIdField;
|
|
1044
|
+
const incoming_catalogIdField = incoming.catalogIdField;
|
|
1045
|
+
// if at least one of these optionals is defined
|
|
1046
|
+
if (existing_catalogIdField !== undefined || incoming_catalogIdField !== undefined) {
|
|
1047
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
1048
|
+
// not equal
|
|
1049
|
+
if (existing_catalogIdField === undefined || incoming_catalogIdField === undefined) {
|
|
1050
|
+
return false;
|
|
1051
|
+
}
|
|
1052
|
+
if (JSONStringify(incoming_catalogIdField) !== JSONStringify(existing_catalogIdField)) {
|
|
1053
|
+
return false;
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
const existing_compoundMetrics = existing.compoundMetrics;
|
|
1057
|
+
const incoming_compoundMetrics = incoming.compoundMetrics;
|
|
1058
|
+
// if at least one of these optionals is defined
|
|
1059
|
+
if (existing_compoundMetrics !== undefined || incoming_compoundMetrics !== undefined) {
|
|
1060
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
1061
|
+
// not equal
|
|
1062
|
+
if (existing_compoundMetrics === undefined || incoming_compoundMetrics === undefined) {
|
|
1063
|
+
return false;
|
|
1064
|
+
}
|
|
1065
|
+
const equals_compoundMetrics_items = equalsArray(existing_compoundMetrics, incoming_compoundMetrics, (existing_compoundMetrics_item, incoming_compoundMetrics_item) => {
|
|
1066
|
+
if (!(existing_compoundMetrics_item.__ref === incoming_compoundMetrics_item.__ref)) {
|
|
1067
|
+
return false;
|
|
1068
|
+
}
|
|
1069
|
+
});
|
|
1070
|
+
if (equals_compoundMetrics_items === false) {
|
|
1071
|
+
return false;
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
const existing_distinctFields = existing.distinctFields;
|
|
1075
|
+
const incoming_distinctFields = incoming.distinctFields;
|
|
1076
|
+
// if at least one of these optionals is defined
|
|
1077
|
+
if (existing_distinctFields !== undefined || incoming_distinctFields !== undefined) {
|
|
1078
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
1079
|
+
// not equal
|
|
1080
|
+
if (existing_distinctFields === undefined || incoming_distinctFields === undefined) {
|
|
1081
|
+
return false;
|
|
1082
|
+
}
|
|
1083
|
+
const equals_distinctFields_items = equalsArray(existing_distinctFields, incoming_distinctFields, (existing_distinctFields_item, incoming_distinctFields_item) => {
|
|
1084
|
+
if (JSONStringify(incoming_distinctFields_item) !== JSONStringify(existing_distinctFields_item)) {
|
|
1085
|
+
return false;
|
|
1086
|
+
}
|
|
1087
|
+
});
|
|
1088
|
+
if (equals_distinctFields_items === false) {
|
|
1089
|
+
return false;
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
const existing_filterGroups = existing.filterGroups;
|
|
1093
|
+
const incoming_filterGroups = incoming.filterGroups;
|
|
1094
|
+
// if at least one of these optionals is defined
|
|
1095
|
+
if (existing_filterGroups !== undefined || incoming_filterGroups !== undefined) {
|
|
1096
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
1097
|
+
// not equal
|
|
1098
|
+
if (existing_filterGroups === undefined || incoming_filterGroups === undefined) {
|
|
1099
|
+
return false;
|
|
1100
|
+
}
|
|
1101
|
+
const equals_filterGroups_items = equalsArray(existing_filterGroups, incoming_filterGroups, (existing_filterGroups_item, incoming_filterGroups_item) => {
|
|
1102
|
+
if (!(equals$4(existing_filterGroups_item, incoming_filterGroups_item))) {
|
|
1103
|
+
return false;
|
|
1104
|
+
}
|
|
1105
|
+
});
|
|
1106
|
+
if (equals_filterGroups_items === false) {
|
|
1107
|
+
return false;
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
const existing_metrics = existing.metrics;
|
|
1111
|
+
const incoming_metrics = incoming.metrics;
|
|
1112
|
+
// if at least one of these optionals is defined
|
|
1113
|
+
if (existing_metrics !== undefined || incoming_metrics !== undefined) {
|
|
1114
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
1115
|
+
// not equal
|
|
1116
|
+
if (existing_metrics === undefined || incoming_metrics === undefined) {
|
|
1117
|
+
return false;
|
|
1118
|
+
}
|
|
1119
|
+
const equals_metrics_items = equalsArray(existing_metrics, incoming_metrics, (existing_metrics_item, incoming_metrics_item) => {
|
|
1120
|
+
if (!(existing_metrics_item.__ref === incoming_metrics_item.__ref)) {
|
|
1121
|
+
return false;
|
|
1122
|
+
}
|
|
1123
|
+
});
|
|
1124
|
+
if (equals_metrics_items === false) {
|
|
1125
|
+
return false;
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
const existing_timestampField = existing.timestampField;
|
|
1129
|
+
const incoming_timestampField = incoming.timestampField;
|
|
1130
|
+
if (JSONStringify(incoming_timestampField) !== JSONStringify(existing_timestampField)) {
|
|
1131
|
+
return false;
|
|
1132
|
+
}
|
|
1133
|
+
const existing_uniqueIdentifier = existing.uniqueIdentifier;
|
|
1134
|
+
const incoming_uniqueIdentifier = incoming.uniqueIdentifier;
|
|
1135
|
+
if (JSONStringify(incoming_uniqueIdentifier) !== JSONStringify(existing_uniqueIdentifier)) {
|
|
1136
|
+
return false;
|
|
1137
|
+
}
|
|
1138
|
+
const existing_userIdField = existing.userIdField;
|
|
1139
|
+
const incoming_userIdField = incoming.userIdField;
|
|
1140
|
+
if (JSONStringify(incoming_userIdField) !== JSONStringify(existing_userIdField)) {
|
|
1141
|
+
return false;
|
|
1142
|
+
}
|
|
1143
|
+
return true;
|
|
1144
|
+
}
|
|
1145
|
+
const ingest = function EngagementSignalRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1146
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1147
|
+
const validateError = validate(input);
|
|
1148
|
+
if (validateError !== null) {
|
|
1149
|
+
throw validateError;
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
const key = keyBuilderFromType(luvio, input);
|
|
1153
|
+
const ttlToUse = TTL;
|
|
1154
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "engmt-config", VERSION, RepresentationType, equals);
|
|
1155
|
+
return createLink(key);
|
|
1156
|
+
};
|
|
1157
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
1158
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1159
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
1160
|
+
rootKeySet.set(rootKey, {
|
|
1161
|
+
namespace: keyPrefix,
|
|
1162
|
+
representationName: RepresentationType,
|
|
1163
|
+
mergeable: false
|
|
1164
|
+
});
|
|
1165
|
+
if (input.compoundMetrics !== undefined) {
|
|
1166
|
+
const input_compoundMetrics_length = input.compoundMetrics.length;
|
|
1167
|
+
for (let i = 0; i < input_compoundMetrics_length; i++) {
|
|
1168
|
+
getTypeCacheKeys$2(rootKeySet, luvio, input.compoundMetrics[i]);
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
if (input.metrics !== undefined) {
|
|
1172
|
+
const input_metrics_length = input.metrics.length;
|
|
1173
|
+
for (let i = 0; i < input_metrics_length; i++) {
|
|
1174
|
+
getTypeCacheKeys$1(rootKeySet, luvio, input.metrics[i]);
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
function select$5(luvio, params) {
|
|
1180
|
+
return select$6();
|
|
1181
|
+
}
|
|
1182
|
+
function getResponseCacheKeys$8(storeKeyMap, luvio, resourceParams, response) {
|
|
1183
|
+
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
1184
|
+
}
|
|
1185
|
+
function ingestSuccess$5(luvio, resourceParams, response) {
|
|
1186
|
+
const { body } = response;
|
|
1187
|
+
const key = keyBuilderFromType(luvio, body);
|
|
1188
|
+
luvio.storeIngest(key, ingest, body);
|
|
1189
|
+
const snapshot = luvio.storeLookup({
|
|
1190
|
+
recordId: key,
|
|
1191
|
+
node: select$5(),
|
|
1192
|
+
variables: {},
|
|
1193
|
+
});
|
|
1194
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1195
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1196
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
deepFreeze(snapshot.data);
|
|
1200
|
+
return snapshot;
|
|
1201
|
+
}
|
|
1202
|
+
function createResourceRequest$8(config) {
|
|
1203
|
+
const headers = {};
|
|
1204
|
+
return {
|
|
1205
|
+
baseUri: '/services/data/v66.0',
|
|
1206
|
+
basePath: '/personalization/engagement-signals',
|
|
1207
|
+
method: 'post',
|
|
1208
|
+
body: config.body,
|
|
1209
|
+
urlParams: {},
|
|
1210
|
+
queryParams: {},
|
|
1211
|
+
headers,
|
|
1212
|
+
priority: 'normal',
|
|
1213
|
+
};
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
const adapterName$8 = 'createEngagementSignal';
|
|
1217
|
+
const createEngagementSignal_ConfigPropertyMetadata = [
|
|
1218
|
+
generateParamConfigMetadata('catalogIdField', false, 2 /* Body */, 4 /* Unsupported */),
|
|
1219
|
+
generateParamConfigMetadata('compoundMetrics', false, 2 /* Body */, 4 /* Unsupported */, true),
|
|
1220
|
+
generateParamConfigMetadata('dataSpaceName', true, 2 /* Body */, 0 /* String */),
|
|
1221
|
+
generateParamConfigMetadata('description', false, 2 /* Body */, 0 /* String */),
|
|
1222
|
+
generateParamConfigMetadata('distinctFields', false, 2 /* Body */, 4 /* Unsupported */, true),
|
|
1223
|
+
generateParamConfigMetadata('filterGroups', false, 2 /* Body */, 4 /* Unsupported */, true),
|
|
1224
|
+
generateParamConfigMetadata('label', true, 2 /* Body */, 0 /* String */),
|
|
1225
|
+
generateParamConfigMetadata('metrics', false, 2 /* Body */, 4 /* Unsupported */, true),
|
|
1226
|
+
generateParamConfigMetadata('name', true, 2 /* Body */, 0 /* String */),
|
|
1227
|
+
generateParamConfigMetadata('objectName', true, 2 /* Body */, 0 /* String */),
|
|
1228
|
+
generateParamConfigMetadata('timestampField', true, 2 /* Body */, 4 /* Unsupported */),
|
|
1229
|
+
generateParamConfigMetadata('uniqueIdentifier', true, 2 /* Body */, 4 /* Unsupported */),
|
|
1230
|
+
generateParamConfigMetadata('userIdField', true, 2 /* Body */, 4 /* Unsupported */),
|
|
1231
|
+
];
|
|
1232
|
+
const createEngagementSignal_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$8, createEngagementSignal_ConfigPropertyMetadata);
|
|
1233
|
+
const createResourceParams$8 = /*#__PURE__*/ createResourceParams$a(createEngagementSignal_ConfigPropertyMetadata);
|
|
1234
|
+
function typeCheckConfig$8(untrustedConfig) {
|
|
1235
|
+
const config = {};
|
|
1236
|
+
typeCheckConfig$a(untrustedConfig, config, createEngagementSignal_ConfigPropertyMetadata);
|
|
1237
|
+
const untrustedConfig_catalogIdField = untrustedConfig.catalogIdField;
|
|
1238
|
+
config.catalogIdField = untrustedConfig_catalogIdField;
|
|
1239
|
+
const untrustedConfig_compoundMetrics = untrustedConfig.compoundMetrics;
|
|
1240
|
+
if (ArrayIsArray$1(untrustedConfig_compoundMetrics)) {
|
|
1241
|
+
const untrustedConfig_compoundMetrics_array = [];
|
|
1242
|
+
for (let i = 0, arrayLength = untrustedConfig_compoundMetrics.length; i < arrayLength; i++) {
|
|
1243
|
+
const untrustedConfig_compoundMetrics_item = untrustedConfig_compoundMetrics[i];
|
|
1244
|
+
untrustedConfig_compoundMetrics_array.push(untrustedConfig_compoundMetrics_item);
|
|
1245
|
+
}
|
|
1246
|
+
config.compoundMetrics = untrustedConfig_compoundMetrics_array;
|
|
1247
|
+
}
|
|
1248
|
+
const untrustedConfig_distinctFields = untrustedConfig.distinctFields;
|
|
1249
|
+
if (ArrayIsArray$1(untrustedConfig_distinctFields)) {
|
|
1250
|
+
const untrustedConfig_distinctFields_array = [];
|
|
1251
|
+
for (let i = 0, arrayLength = untrustedConfig_distinctFields.length; i < arrayLength; i++) {
|
|
1252
|
+
const untrustedConfig_distinctFields_item = untrustedConfig_distinctFields[i];
|
|
1253
|
+
untrustedConfig_distinctFields_array.push(untrustedConfig_distinctFields_item);
|
|
1254
|
+
}
|
|
1255
|
+
config.distinctFields = untrustedConfig_distinctFields_array;
|
|
1256
|
+
}
|
|
1257
|
+
const untrustedConfig_filterGroups = untrustedConfig.filterGroups;
|
|
1258
|
+
if (ArrayIsArray$1(untrustedConfig_filterGroups)) {
|
|
1259
|
+
const untrustedConfig_filterGroups_array = [];
|
|
1260
|
+
for (let i = 0, arrayLength = untrustedConfig_filterGroups.length; i < arrayLength; i++) {
|
|
1261
|
+
const untrustedConfig_filterGroups_item = untrustedConfig_filterGroups[i];
|
|
1262
|
+
untrustedConfig_filterGroups_array.push(untrustedConfig_filterGroups_item);
|
|
1263
|
+
}
|
|
1264
|
+
config.filterGroups = untrustedConfig_filterGroups_array;
|
|
1265
|
+
}
|
|
1266
|
+
const untrustedConfig_metrics = untrustedConfig.metrics;
|
|
1267
|
+
if (ArrayIsArray$1(untrustedConfig_metrics)) {
|
|
1268
|
+
const untrustedConfig_metrics_array = [];
|
|
1269
|
+
for (let i = 0, arrayLength = untrustedConfig_metrics.length; i < arrayLength; i++) {
|
|
1270
|
+
const untrustedConfig_metrics_item = untrustedConfig_metrics[i];
|
|
1271
|
+
untrustedConfig_metrics_array.push(untrustedConfig_metrics_item);
|
|
1272
|
+
}
|
|
1273
|
+
config.metrics = untrustedConfig_metrics_array;
|
|
1274
|
+
}
|
|
1275
|
+
const untrustedConfig_timestampField = untrustedConfig.timestampField;
|
|
1276
|
+
config.timestampField = untrustedConfig_timestampField;
|
|
1277
|
+
const untrustedConfig_uniqueIdentifier = untrustedConfig.uniqueIdentifier;
|
|
1278
|
+
config.uniqueIdentifier = untrustedConfig_uniqueIdentifier;
|
|
1279
|
+
const untrustedConfig_userIdField = untrustedConfig.userIdField;
|
|
1280
|
+
config.userIdField = untrustedConfig_userIdField;
|
|
1281
|
+
return config;
|
|
1282
|
+
}
|
|
1283
|
+
function validateAdapterConfig$8(untrustedConfig, configPropertyNames) {
|
|
1284
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1285
|
+
return null;
|
|
1286
|
+
}
|
|
1287
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1288
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1289
|
+
}
|
|
1290
|
+
const config = typeCheckConfig$8(untrustedConfig);
|
|
1291
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1292
|
+
return null;
|
|
1293
|
+
}
|
|
1294
|
+
return config;
|
|
1295
|
+
}
|
|
1296
|
+
function buildNetworkSnapshot$8(luvio, config, options) {
|
|
1297
|
+
const resourceParams = createResourceParams$8(config);
|
|
1298
|
+
const request = createResourceRequest$8(resourceParams);
|
|
1299
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1300
|
+
.then((response) => {
|
|
1301
|
+
return luvio.handleSuccessResponse(() => {
|
|
1302
|
+
const snapshot = ingestSuccess$5(luvio, resourceParams, response);
|
|
1303
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1304
|
+
}, () => {
|
|
1305
|
+
const cache = new StoreKeyMap();
|
|
1306
|
+
getResponseCacheKeys$8(cache, luvio, resourceParams, response.body);
|
|
1307
|
+
return cache;
|
|
1308
|
+
});
|
|
1309
|
+
}, (response) => {
|
|
1310
|
+
deepFreeze(response);
|
|
1311
|
+
throw response;
|
|
1312
|
+
});
|
|
1313
|
+
}
|
|
1314
|
+
const createEngagementSignalAdapterFactory = (luvio) => {
|
|
1315
|
+
return function createEngagementSignal(untrustedConfig) {
|
|
1316
|
+
const config = validateAdapterConfig$8(untrustedConfig, createEngagementSignal_ConfigPropertyNames);
|
|
1317
|
+
// Invalid or incomplete config
|
|
1318
|
+
if (config === null) {
|
|
1319
|
+
throw new Error('Invalid config for "createEngagementSignal"');
|
|
1320
|
+
}
|
|
1321
|
+
return buildNetworkSnapshot$8(luvio, config);
|
|
1322
|
+
};
|
|
1323
|
+
};
|
|
1324
|
+
|
|
1325
|
+
function keyBuilder$8(luvio, params) {
|
|
1326
|
+
return keyBuilder$9(luvio, {
|
|
1327
|
+
id: params.urlParams.engagementSignalId
|
|
1328
|
+
});
|
|
1329
|
+
}
|
|
1330
|
+
function getResponseCacheKeys$7(cacheKeyMap, luvio, resourceParams) {
|
|
1331
|
+
const key = keyBuilder$8(luvio, resourceParams);
|
|
1332
|
+
cacheKeyMap.set(key, {
|
|
1333
|
+
namespace: keyPrefix,
|
|
1334
|
+
representationName: RepresentationType,
|
|
1335
|
+
mergeable: false
|
|
1336
|
+
});
|
|
1337
|
+
}
|
|
1338
|
+
function evictSuccess$2(luvio, resourceParams) {
|
|
1339
|
+
const key = keyBuilder$8(luvio, resourceParams);
|
|
1340
|
+
luvio.storeEvict(key);
|
|
1341
|
+
}
|
|
1342
|
+
function createResourceRequest$7(config) {
|
|
1343
|
+
const headers = {};
|
|
1344
|
+
return {
|
|
1345
|
+
baseUri: '/services/data/v66.0',
|
|
1346
|
+
basePath: '/personalization/engagement-signals/' + config.urlParams.engagementSignalId + '',
|
|
1347
|
+
method: 'delete',
|
|
1348
|
+
body: null,
|
|
1349
|
+
urlParams: config.urlParams,
|
|
1350
|
+
queryParams: {},
|
|
1351
|
+
headers,
|
|
1352
|
+
priority: 'normal',
|
|
1353
|
+
};
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
const adapterName$7 = 'deleteEngagementSignal';
|
|
1357
|
+
const deleteEngagementSignal_ConfigPropertyMetadata = [
|
|
1358
|
+
generateParamConfigMetadata('engagementSignalId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1359
|
+
];
|
|
1360
|
+
const deleteEngagementSignal_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$7, deleteEngagementSignal_ConfigPropertyMetadata);
|
|
1361
|
+
const createResourceParams$7 = /*#__PURE__*/ createResourceParams$a(deleteEngagementSignal_ConfigPropertyMetadata);
|
|
1362
|
+
function typeCheckConfig$7(untrustedConfig) {
|
|
1363
|
+
const config = {};
|
|
1364
|
+
typeCheckConfig$a(untrustedConfig, config, deleteEngagementSignal_ConfigPropertyMetadata);
|
|
1365
|
+
return config;
|
|
1366
|
+
}
|
|
1367
|
+
function validateAdapterConfig$7(untrustedConfig, configPropertyNames) {
|
|
1368
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1369
|
+
return null;
|
|
1370
|
+
}
|
|
1371
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1372
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1373
|
+
}
|
|
1374
|
+
const config = typeCheckConfig$7(untrustedConfig);
|
|
1375
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1376
|
+
return null;
|
|
1377
|
+
}
|
|
1378
|
+
return config;
|
|
1379
|
+
}
|
|
1380
|
+
function buildNetworkSnapshot$7(luvio, config, options) {
|
|
1381
|
+
const resourceParams = createResourceParams$7(config);
|
|
1382
|
+
const request = createResourceRequest$7(resourceParams);
|
|
1383
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1384
|
+
.then(() => {
|
|
1385
|
+
return luvio.handleSuccessResponse(() => {
|
|
1386
|
+
evictSuccess$2(luvio, resourceParams);
|
|
1387
|
+
return luvio.storeBroadcast();
|
|
1388
|
+
}, () => {
|
|
1389
|
+
const cache = new StoreKeyMap();
|
|
1390
|
+
getResponseCacheKeys$7(cache, luvio, resourceParams);
|
|
1391
|
+
return cache;
|
|
1392
|
+
});
|
|
1393
|
+
}, (response) => {
|
|
1394
|
+
deepFreeze(response);
|
|
1395
|
+
throw response;
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
const deleteEngagementSignalAdapterFactory = (luvio) => {
|
|
1399
|
+
return function engmtConfigdeleteEngagementSignal(untrustedConfig) {
|
|
1400
|
+
const config = validateAdapterConfig$7(untrustedConfig, deleteEngagementSignal_ConfigPropertyNames);
|
|
1401
|
+
// Invalid or incomplete config
|
|
1402
|
+
if (config === null) {
|
|
1403
|
+
throw new Error(`Invalid config for "${adapterName$7}"`);
|
|
1404
|
+
}
|
|
1405
|
+
return buildNetworkSnapshot$7(luvio, config);
|
|
1406
|
+
};
|
|
1407
|
+
};
|
|
1408
|
+
|
|
1409
|
+
function select$4(luvio, params) {
|
|
1410
|
+
return select$6();
|
|
1411
|
+
}
|
|
1412
|
+
function keyBuilder$7(luvio, params) {
|
|
1413
|
+
return keyBuilder$9(luvio, {
|
|
1414
|
+
id: params.urlParams.engagementSignalId
|
|
1415
|
+
});
|
|
1416
|
+
}
|
|
1417
|
+
function getResponseCacheKeys$6(storeKeyMap, luvio, resourceParams, response) {
|
|
1418
|
+
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
1419
|
+
}
|
|
1420
|
+
function ingestSuccess$4(luvio, resourceParams, response, snapshotRefresh) {
|
|
1421
|
+
const { body } = response;
|
|
1422
|
+
const key = keyBuilder$7(luvio, resourceParams);
|
|
1423
|
+
luvio.storeIngest(key, ingest, body);
|
|
1424
|
+
const snapshot = luvio.storeLookup({
|
|
1425
|
+
recordId: key,
|
|
1426
|
+
node: select$4(),
|
|
1427
|
+
variables: {},
|
|
1428
|
+
}, snapshotRefresh);
|
|
1429
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1430
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1431
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
deepFreeze(snapshot.data);
|
|
1435
|
+
return snapshot;
|
|
1436
|
+
}
|
|
1437
|
+
function ingestError$2(luvio, params, error, snapshotRefresh) {
|
|
1438
|
+
const key = keyBuilder$7(luvio, params);
|
|
1439
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1440
|
+
const storeMetadataParams = {
|
|
1441
|
+
ttl: TTL,
|
|
1442
|
+
namespace: keyPrefix,
|
|
1443
|
+
version: VERSION,
|
|
1444
|
+
representationName: RepresentationType
|
|
1445
|
+
};
|
|
1446
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
1447
|
+
return errorSnapshot;
|
|
1448
|
+
}
|
|
1449
|
+
function createResourceRequest$6(config) {
|
|
1450
|
+
const headers = {};
|
|
1451
|
+
return {
|
|
1452
|
+
baseUri: '/services/data/v66.0',
|
|
1453
|
+
basePath: '/personalization/engagement-signals/' + config.urlParams.engagementSignalId + '',
|
|
1454
|
+
method: 'get',
|
|
1455
|
+
body: null,
|
|
1456
|
+
urlParams: config.urlParams,
|
|
1457
|
+
queryParams: {},
|
|
1458
|
+
headers,
|
|
1459
|
+
priority: 'normal',
|
|
1460
|
+
};
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
const adapterName$6 = 'getEngagementSignal';
|
|
1464
|
+
const getEngagementSignal_ConfigPropertyMetadata = [
|
|
1465
|
+
generateParamConfigMetadata('engagementSignalId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1466
|
+
];
|
|
1467
|
+
const getEngagementSignal_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$6, getEngagementSignal_ConfigPropertyMetadata);
|
|
1468
|
+
const createResourceParams$6 = /*#__PURE__*/ createResourceParams$a(getEngagementSignal_ConfigPropertyMetadata);
|
|
1469
|
+
function keyBuilder$6(luvio, config) {
|
|
1470
|
+
const resourceParams = createResourceParams$6(config);
|
|
1471
|
+
return keyBuilder$7(luvio, resourceParams);
|
|
1472
|
+
}
|
|
1473
|
+
function typeCheckConfig$6(untrustedConfig) {
|
|
1474
|
+
const config = {};
|
|
1475
|
+
typeCheckConfig$a(untrustedConfig, config, getEngagementSignal_ConfigPropertyMetadata);
|
|
1476
|
+
return config;
|
|
1477
|
+
}
|
|
1478
|
+
function validateAdapterConfig$6(untrustedConfig, configPropertyNames) {
|
|
1479
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1480
|
+
return null;
|
|
1481
|
+
}
|
|
1482
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1483
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1484
|
+
}
|
|
1485
|
+
const config = typeCheckConfig$6(untrustedConfig);
|
|
1486
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1487
|
+
return null;
|
|
1488
|
+
}
|
|
1489
|
+
return config;
|
|
1490
|
+
}
|
|
1491
|
+
function adapterFragment$2(luvio, config) {
|
|
1492
|
+
createResourceParams$6(config);
|
|
1493
|
+
return select$4();
|
|
1494
|
+
}
|
|
1495
|
+
function onFetchResponseSuccess$2(luvio, config, resourceParams, response) {
|
|
1496
|
+
const snapshot = ingestSuccess$4(luvio, resourceParams, response, {
|
|
1497
|
+
config,
|
|
1498
|
+
resolve: () => buildNetworkSnapshot$6(luvio, config, snapshotRefreshOptions)
|
|
1499
|
+
});
|
|
1500
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1501
|
+
}
|
|
1502
|
+
function onFetchResponseError$2(luvio, config, resourceParams, response) {
|
|
1503
|
+
const snapshot = ingestError$2(luvio, resourceParams, response, {
|
|
1504
|
+
config,
|
|
1505
|
+
resolve: () => buildNetworkSnapshot$6(luvio, config, snapshotRefreshOptions)
|
|
1506
|
+
});
|
|
1507
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1508
|
+
}
|
|
1509
|
+
function buildNetworkSnapshot$6(luvio, config, options) {
|
|
1510
|
+
const resourceParams = createResourceParams$6(config);
|
|
1511
|
+
const request = createResourceRequest$6(resourceParams);
|
|
1512
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1513
|
+
.then((response) => {
|
|
1514
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$2(luvio, config, resourceParams, response), () => {
|
|
1515
|
+
const cache = new StoreKeyMap();
|
|
1516
|
+
getResponseCacheKeys$6(cache, luvio, resourceParams, response.body);
|
|
1517
|
+
return cache;
|
|
1518
|
+
});
|
|
1519
|
+
}, (response) => {
|
|
1520
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$2(luvio, config, resourceParams, response));
|
|
1521
|
+
});
|
|
1522
|
+
}
|
|
1523
|
+
function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
|
|
1524
|
+
return buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext, buildNetworkSnapshot$6, undefined, false);
|
|
1525
|
+
}
|
|
1526
|
+
function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
|
|
1527
|
+
const { luvio, config } = context;
|
|
1528
|
+
const selector = {
|
|
1529
|
+
recordId: keyBuilder$6(luvio, config),
|
|
1530
|
+
node: adapterFragment$2(luvio, config),
|
|
1531
|
+
variables: {},
|
|
1532
|
+
};
|
|
1533
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1534
|
+
config,
|
|
1535
|
+
resolve: () => buildNetworkSnapshot$6(luvio, config, snapshotRefreshOptions)
|
|
1536
|
+
});
|
|
1537
|
+
return cacheSnapshot;
|
|
1538
|
+
}
|
|
1539
|
+
const getEngagementSignalAdapterFactory = (luvio) => function engmtConfig__getEngagementSignal(untrustedConfig, requestContext) {
|
|
1540
|
+
const config = validateAdapterConfig$6(untrustedConfig, getEngagementSignal_ConfigPropertyNames);
|
|
1541
|
+
// Invalid or incomplete config
|
|
1542
|
+
if (config === null) {
|
|
1543
|
+
return null;
|
|
1544
|
+
}
|
|
1545
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1546
|
+
buildCachedSnapshotCachePolicy$2, buildNetworkSnapshotCachePolicy$2);
|
|
1547
|
+
};
|
|
1548
|
+
|
|
1549
|
+
function select$3(luvio, params) {
|
|
1550
|
+
return select$7();
|
|
1551
|
+
}
|
|
1552
|
+
function getResponseCacheKeys$5(storeKeyMap, luvio, resourceParams, response) {
|
|
1553
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response);
|
|
1554
|
+
}
|
|
1555
|
+
function ingestSuccess$3(luvio, resourceParams, response) {
|
|
1556
|
+
const { body } = response;
|
|
1557
|
+
const key = keyBuilderFromType$1(luvio, body);
|
|
1558
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
1559
|
+
const snapshot = luvio.storeLookup({
|
|
1560
|
+
recordId: key,
|
|
1561
|
+
node: select$3(),
|
|
1562
|
+
variables: {},
|
|
1563
|
+
});
|
|
1564
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1565
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1566
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
deepFreeze(snapshot.data);
|
|
1570
|
+
return snapshot;
|
|
1571
|
+
}
|
|
1572
|
+
function createResourceRequest$5(config) {
|
|
1573
|
+
const headers = {};
|
|
1574
|
+
return {
|
|
1575
|
+
baseUri: '/services/data/v66.0',
|
|
1576
|
+
basePath: '/personalization/engagement-signals/' + config.urlParams.engagementSignalId + '/metrics',
|
|
1577
|
+
method: 'post',
|
|
1578
|
+
body: config.body,
|
|
1579
|
+
urlParams: config.urlParams,
|
|
1580
|
+
queryParams: {},
|
|
1581
|
+
headers,
|
|
1582
|
+
priority: 'normal',
|
|
1583
|
+
};
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
const adapterName$5 = 'createEngagementSignalMetric';
|
|
1587
|
+
const createEngagementSignalMetric_ConfigPropertyMetadata = [
|
|
1588
|
+
generateParamConfigMetadata('engagementSignalId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1589
|
+
generateParamConfigMetadata('aggregateFunction', true, 2 /* Body */, 0 /* String */),
|
|
1590
|
+
generateParamConfigMetadata('description', false, 2 /* Body */, 0 /* String */),
|
|
1591
|
+
generateParamConfigMetadata('field', true, 2 /* Body */, 4 /* Unsupported */),
|
|
1592
|
+
generateParamConfigMetadata('label', false, 2 /* Body */, 0 /* String */),
|
|
1593
|
+
generateParamConfigMetadata('name', true, 2 /* Body */, 0 /* String */),
|
|
1594
|
+
];
|
|
1595
|
+
const createEngagementSignalMetric_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$5, createEngagementSignalMetric_ConfigPropertyMetadata);
|
|
1596
|
+
const createResourceParams$5 = /*#__PURE__*/ createResourceParams$a(createEngagementSignalMetric_ConfigPropertyMetadata);
|
|
1597
|
+
function typeCheckConfig$5(untrustedConfig) {
|
|
1598
|
+
const config = {};
|
|
1599
|
+
typeCheckConfig$a(untrustedConfig, config, createEngagementSignalMetric_ConfigPropertyMetadata);
|
|
1600
|
+
const untrustedConfig_field = untrustedConfig.field;
|
|
1601
|
+
config.field = untrustedConfig_field;
|
|
1602
|
+
return config;
|
|
1603
|
+
}
|
|
1604
|
+
function validateAdapterConfig$5(untrustedConfig, configPropertyNames) {
|
|
1605
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1606
|
+
return null;
|
|
1607
|
+
}
|
|
1608
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1609
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1610
|
+
}
|
|
1611
|
+
const config = typeCheckConfig$5(untrustedConfig);
|
|
1612
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1613
|
+
return null;
|
|
1614
|
+
}
|
|
1615
|
+
return config;
|
|
1616
|
+
}
|
|
1617
|
+
function buildNetworkSnapshot$5(luvio, config, options) {
|
|
1618
|
+
const resourceParams = createResourceParams$5(config);
|
|
1619
|
+
const request = createResourceRequest$5(resourceParams);
|
|
1620
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1621
|
+
.then((response) => {
|
|
1622
|
+
return luvio.handleSuccessResponse(() => {
|
|
1623
|
+
const snapshot = ingestSuccess$3(luvio, resourceParams, response);
|
|
1624
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1625
|
+
}, () => {
|
|
1626
|
+
const cache = new StoreKeyMap();
|
|
1627
|
+
getResponseCacheKeys$5(cache, luvio, resourceParams, response.body);
|
|
1628
|
+
return cache;
|
|
1629
|
+
});
|
|
1630
|
+
}, (response) => {
|
|
1631
|
+
deepFreeze(response);
|
|
1632
|
+
throw response;
|
|
1633
|
+
});
|
|
1634
|
+
}
|
|
1635
|
+
const createEngagementSignalMetricAdapterFactory = (luvio) => {
|
|
1636
|
+
return function createEngagementSignalMetric(untrustedConfig) {
|
|
1637
|
+
const config = validateAdapterConfig$5(untrustedConfig, createEngagementSignalMetric_ConfigPropertyNames);
|
|
1638
|
+
// Invalid or incomplete config
|
|
1639
|
+
if (config === null) {
|
|
1640
|
+
throw new Error('Invalid config for "createEngagementSignalMetric"');
|
|
1641
|
+
}
|
|
1642
|
+
return buildNetworkSnapshot$5(luvio, config);
|
|
1643
|
+
};
|
|
1644
|
+
};
|
|
1645
|
+
|
|
1646
|
+
function select$2(luvio, params) {
|
|
1647
|
+
return select$8();
|
|
1648
|
+
}
|
|
1649
|
+
function getResponseCacheKeys$4(storeKeyMap, luvio, resourceParams, response) {
|
|
1650
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response);
|
|
1651
|
+
}
|
|
1652
|
+
function ingestSuccess$2(luvio, resourceParams, response) {
|
|
1653
|
+
const { body } = response;
|
|
1654
|
+
const key = keyBuilderFromType$2(luvio, body);
|
|
1655
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
1656
|
+
const snapshot = luvio.storeLookup({
|
|
1657
|
+
recordId: key,
|
|
1658
|
+
node: select$2(),
|
|
1659
|
+
variables: {},
|
|
1660
|
+
});
|
|
1661
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1662
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1663
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
deepFreeze(snapshot.data);
|
|
1667
|
+
return snapshot;
|
|
1668
|
+
}
|
|
1669
|
+
function createResourceRequest$4(config) {
|
|
1670
|
+
const headers = {};
|
|
1671
|
+
return {
|
|
1672
|
+
baseUri: '/services/data/v66.0',
|
|
1673
|
+
basePath: '/personalization/compound-metrics',
|
|
1674
|
+
method: 'post',
|
|
1675
|
+
body: config.body,
|
|
1676
|
+
urlParams: {},
|
|
1677
|
+
queryParams: {},
|
|
1678
|
+
headers,
|
|
1679
|
+
priority: 'normal',
|
|
1680
|
+
};
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
const adapterName$4 = 'createEngagementSignalCompoundMetric';
|
|
1684
|
+
const createEngagementSignalCompoundMetric_ConfigPropertyMetadata = [
|
|
1685
|
+
generateParamConfigMetadata('denominatorMetric', true, 2 /* Body */, 4 /* Unsupported */),
|
|
1686
|
+
generateParamConfigMetadata('description', true, 2 /* Body */, 0 /* String */),
|
|
1687
|
+
generateParamConfigMetadata('label', true, 2 /* Body */, 0 /* String */),
|
|
1688
|
+
generateParamConfigMetadata('name', true, 2 /* Body */, 0 /* String */),
|
|
1689
|
+
generateParamConfigMetadata('numeratorMetric', true, 2 /* Body */, 4 /* Unsupported */),
|
|
1690
|
+
generateParamConfigMetadata('operator', true, 2 /* Body */, 0 /* String */),
|
|
1691
|
+
];
|
|
1692
|
+
const createEngagementSignalCompoundMetric_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$4, createEngagementSignalCompoundMetric_ConfigPropertyMetadata);
|
|
1693
|
+
const createResourceParams$4 = /*#__PURE__*/ createResourceParams$a(createEngagementSignalCompoundMetric_ConfigPropertyMetadata);
|
|
1694
|
+
function typeCheckConfig$4(untrustedConfig) {
|
|
1695
|
+
const config = {};
|
|
1696
|
+
typeCheckConfig$a(untrustedConfig, config, createEngagementSignalCompoundMetric_ConfigPropertyMetadata);
|
|
1697
|
+
const untrustedConfig_denominatorMetric = untrustedConfig.denominatorMetric;
|
|
1698
|
+
config.denominatorMetric = untrustedConfig_denominatorMetric;
|
|
1699
|
+
const untrustedConfig_numeratorMetric = untrustedConfig.numeratorMetric;
|
|
1700
|
+
config.numeratorMetric = untrustedConfig_numeratorMetric;
|
|
1701
|
+
return config;
|
|
1702
|
+
}
|
|
1703
|
+
function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
|
|
1704
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1705
|
+
return null;
|
|
1706
|
+
}
|
|
1707
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1708
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1709
|
+
}
|
|
1710
|
+
const config = typeCheckConfig$4(untrustedConfig);
|
|
1711
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1712
|
+
return null;
|
|
1713
|
+
}
|
|
1714
|
+
return config;
|
|
1715
|
+
}
|
|
1716
|
+
function buildNetworkSnapshot$4(luvio, config, options) {
|
|
1717
|
+
const resourceParams = createResourceParams$4(config);
|
|
1718
|
+
const request = createResourceRequest$4(resourceParams);
|
|
1719
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1720
|
+
.then((response) => {
|
|
1721
|
+
return luvio.handleSuccessResponse(() => {
|
|
1722
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response);
|
|
1723
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1724
|
+
}, () => {
|
|
1725
|
+
const cache = new StoreKeyMap();
|
|
1726
|
+
getResponseCacheKeys$4(cache, luvio, resourceParams, response.body);
|
|
1727
|
+
return cache;
|
|
1728
|
+
});
|
|
1729
|
+
}, (response) => {
|
|
1730
|
+
deepFreeze(response);
|
|
1731
|
+
throw response;
|
|
1732
|
+
});
|
|
1733
|
+
}
|
|
1734
|
+
const createEngagementSignalCompoundMetricAdapterFactory = (luvio) => {
|
|
1735
|
+
return function createEngagementSignalCompoundMetric(untrustedConfig) {
|
|
1736
|
+
const config = validateAdapterConfig$4(untrustedConfig, createEngagementSignalCompoundMetric_ConfigPropertyNames);
|
|
1737
|
+
// Invalid or incomplete config
|
|
1738
|
+
if (config === null) {
|
|
1739
|
+
throw new Error('Invalid config for "createEngagementSignalCompoundMetric"');
|
|
1740
|
+
}
|
|
1741
|
+
return buildNetworkSnapshot$4(luvio, config);
|
|
1742
|
+
};
|
|
1743
|
+
};
|
|
1744
|
+
|
|
1745
|
+
function keyBuilder$5(luvio, params) {
|
|
1746
|
+
return keyBuilder$a(luvio, {
|
|
1747
|
+
id: params.urlParams.engagementSignalMetricId
|
|
1748
|
+
});
|
|
1749
|
+
}
|
|
1750
|
+
function getResponseCacheKeys$3(cacheKeyMap, luvio, resourceParams) {
|
|
1751
|
+
const key = keyBuilder$5(luvio, resourceParams);
|
|
1752
|
+
cacheKeyMap.set(key, {
|
|
1753
|
+
namespace: keyPrefix,
|
|
1754
|
+
representationName: RepresentationType$1,
|
|
1755
|
+
mergeable: false
|
|
1756
|
+
});
|
|
1757
|
+
}
|
|
1758
|
+
function evictSuccess$1(luvio, resourceParams) {
|
|
1759
|
+
const key = keyBuilder$5(luvio, resourceParams);
|
|
1760
|
+
luvio.storeEvict(key);
|
|
1761
|
+
}
|
|
1762
|
+
function createResourceRequest$3(config) {
|
|
1763
|
+
const headers = {};
|
|
1764
|
+
return {
|
|
1765
|
+
baseUri: '/services/data/v66.0',
|
|
1766
|
+
basePath: '/personalization/engagement-signals/' + config.urlParams.engagementSignalId + '/metrics/' + config.urlParams.engagementSignalMetricId + '',
|
|
1767
|
+
method: 'delete',
|
|
1768
|
+
body: null,
|
|
1769
|
+
urlParams: config.urlParams,
|
|
1770
|
+
queryParams: {},
|
|
1771
|
+
headers,
|
|
1772
|
+
priority: 'normal',
|
|
1773
|
+
};
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
const adapterName$3 = 'deleteEngagementSignalMetric';
|
|
1777
|
+
const deleteEngagementSignalMetric_ConfigPropertyMetadata = [
|
|
1778
|
+
generateParamConfigMetadata('engagementSignalId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1779
|
+
generateParamConfigMetadata('engagementSignalMetricId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1780
|
+
];
|
|
1781
|
+
const deleteEngagementSignalMetric_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, deleteEngagementSignalMetric_ConfigPropertyMetadata);
|
|
1782
|
+
const createResourceParams$3 = /*#__PURE__*/ createResourceParams$a(deleteEngagementSignalMetric_ConfigPropertyMetadata);
|
|
1783
|
+
function typeCheckConfig$3(untrustedConfig) {
|
|
1784
|
+
const config = {};
|
|
1785
|
+
typeCheckConfig$a(untrustedConfig, config, deleteEngagementSignalMetric_ConfigPropertyMetadata);
|
|
1786
|
+
return config;
|
|
1787
|
+
}
|
|
1788
|
+
function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
|
|
1789
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1790
|
+
return null;
|
|
1791
|
+
}
|
|
1792
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1793
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1794
|
+
}
|
|
1795
|
+
const config = typeCheckConfig$3(untrustedConfig);
|
|
1796
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1797
|
+
return null;
|
|
1798
|
+
}
|
|
1799
|
+
return config;
|
|
1800
|
+
}
|
|
1801
|
+
function buildNetworkSnapshot$3(luvio, config, options) {
|
|
1802
|
+
const resourceParams = createResourceParams$3(config);
|
|
1803
|
+
const request = createResourceRequest$3(resourceParams);
|
|
1804
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1805
|
+
.then(() => {
|
|
1806
|
+
return luvio.handleSuccessResponse(() => {
|
|
1807
|
+
evictSuccess$1(luvio, resourceParams);
|
|
1808
|
+
return luvio.storeBroadcast();
|
|
1809
|
+
}, () => {
|
|
1810
|
+
const cache = new StoreKeyMap();
|
|
1811
|
+
getResponseCacheKeys$3(cache, luvio, resourceParams);
|
|
1812
|
+
return cache;
|
|
1813
|
+
});
|
|
1814
|
+
}, (response) => {
|
|
1815
|
+
deepFreeze(response);
|
|
1816
|
+
throw response;
|
|
1817
|
+
});
|
|
1818
|
+
}
|
|
1819
|
+
const deleteEngagementSignalMetricAdapterFactory = (luvio) => {
|
|
1820
|
+
return function engmtConfigdeleteEngagementSignalMetric(untrustedConfig) {
|
|
1821
|
+
const config = validateAdapterConfig$3(untrustedConfig, deleteEngagementSignalMetric_ConfigPropertyNames);
|
|
1822
|
+
// Invalid or incomplete config
|
|
1823
|
+
if (config === null) {
|
|
1824
|
+
throw new Error(`Invalid config for "${adapterName$3}"`);
|
|
1825
|
+
}
|
|
1826
|
+
return buildNetworkSnapshot$3(luvio, config);
|
|
1827
|
+
};
|
|
1828
|
+
};
|
|
1829
|
+
|
|
1830
|
+
function select$1(luvio, params) {
|
|
1831
|
+
return select$7();
|
|
1832
|
+
}
|
|
1833
|
+
function keyBuilder$4(luvio, params) {
|
|
1834
|
+
return keyBuilder$a(luvio, {
|
|
1835
|
+
id: params.urlParams.engagementSignalMetricId
|
|
1836
|
+
});
|
|
1837
|
+
}
|
|
1838
|
+
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
1839
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response);
|
|
1840
|
+
}
|
|
1841
|
+
function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
1842
|
+
const { body } = response;
|
|
1843
|
+
const key = keyBuilder$4(luvio, resourceParams);
|
|
1844
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
1845
|
+
const snapshot = luvio.storeLookup({
|
|
1846
|
+
recordId: key,
|
|
1847
|
+
node: select$1(),
|
|
1848
|
+
variables: {},
|
|
1849
|
+
}, snapshotRefresh);
|
|
1850
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1851
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1852
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1853
|
+
}
|
|
1854
|
+
}
|
|
1855
|
+
deepFreeze(snapshot.data);
|
|
1856
|
+
return snapshot;
|
|
1857
|
+
}
|
|
1858
|
+
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
1859
|
+
const key = keyBuilder$4(luvio, params);
|
|
1860
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1861
|
+
const storeMetadataParams = {
|
|
1862
|
+
ttl: TTL$1,
|
|
1863
|
+
namespace: keyPrefix,
|
|
1864
|
+
version: VERSION$1,
|
|
1865
|
+
representationName: RepresentationType$1
|
|
1866
|
+
};
|
|
1867
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
1868
|
+
return errorSnapshot;
|
|
1869
|
+
}
|
|
1870
|
+
function createResourceRequest$2(config) {
|
|
1871
|
+
const headers = {};
|
|
1872
|
+
return {
|
|
1873
|
+
baseUri: '/services/data/v66.0',
|
|
1874
|
+
basePath: '/personalization/engagement-signals/' + config.urlParams.engagementSignalId + '/metrics/' + config.urlParams.engagementSignalMetricId + '',
|
|
1875
|
+
method: 'get',
|
|
1876
|
+
body: null,
|
|
1877
|
+
urlParams: config.urlParams,
|
|
1878
|
+
queryParams: {},
|
|
1879
|
+
headers,
|
|
1880
|
+
priority: 'normal',
|
|
1881
|
+
};
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1884
|
+
const adapterName$2 = 'getEngagementSignalMetric';
|
|
1885
|
+
const getEngagementSignalMetric_ConfigPropertyMetadata = [
|
|
1886
|
+
generateParamConfigMetadata('engagementSignalId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1887
|
+
generateParamConfigMetadata('engagementSignalMetricId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1888
|
+
];
|
|
1889
|
+
const getEngagementSignalMetric_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getEngagementSignalMetric_ConfigPropertyMetadata);
|
|
1890
|
+
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$a(getEngagementSignalMetric_ConfigPropertyMetadata);
|
|
1891
|
+
function keyBuilder$3(luvio, config) {
|
|
1892
|
+
const resourceParams = createResourceParams$2(config);
|
|
1893
|
+
return keyBuilder$4(luvio, resourceParams);
|
|
1894
|
+
}
|
|
1895
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
1896
|
+
const config = {};
|
|
1897
|
+
typeCheckConfig$a(untrustedConfig, config, getEngagementSignalMetric_ConfigPropertyMetadata);
|
|
1898
|
+
return config;
|
|
1899
|
+
}
|
|
1900
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
1901
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1902
|
+
return null;
|
|
1903
|
+
}
|
|
1904
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1905
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1906
|
+
}
|
|
1907
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
1908
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1909
|
+
return null;
|
|
1910
|
+
}
|
|
1911
|
+
return config;
|
|
1912
|
+
}
|
|
1913
|
+
function adapterFragment$1(luvio, config) {
|
|
1914
|
+
createResourceParams$2(config);
|
|
1915
|
+
return select$1();
|
|
1916
|
+
}
|
|
1917
|
+
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
1918
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
|
|
1919
|
+
config,
|
|
1920
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1921
|
+
});
|
|
1922
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1923
|
+
}
|
|
1924
|
+
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
1925
|
+
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
1926
|
+
config,
|
|
1927
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1928
|
+
});
|
|
1929
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1930
|
+
}
|
|
1931
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
1932
|
+
const resourceParams = createResourceParams$2(config);
|
|
1933
|
+
const request = createResourceRequest$2(resourceParams);
|
|
1934
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1935
|
+
.then((response) => {
|
|
1936
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
|
|
1937
|
+
const cache = new StoreKeyMap();
|
|
1938
|
+
getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
|
|
1939
|
+
return cache;
|
|
1940
|
+
});
|
|
1941
|
+
}, (response) => {
|
|
1942
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
1943
|
+
});
|
|
1944
|
+
}
|
|
1945
|
+
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
1946
|
+
return buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
|
|
1947
|
+
}
|
|
1948
|
+
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
1949
|
+
const { luvio, config } = context;
|
|
1950
|
+
const selector = {
|
|
1951
|
+
recordId: keyBuilder$3(luvio, config),
|
|
1952
|
+
node: adapterFragment$1(luvio, config),
|
|
1953
|
+
variables: {},
|
|
1954
|
+
};
|
|
1955
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1956
|
+
config,
|
|
1957
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1958
|
+
});
|
|
1959
|
+
return cacheSnapshot;
|
|
1960
|
+
}
|
|
1961
|
+
const getEngagementSignalMetricAdapterFactory = (luvio) => function engmtConfig__getEngagementSignalMetric(untrustedConfig, requestContext) {
|
|
1962
|
+
const config = validateAdapterConfig$2(untrustedConfig, getEngagementSignalMetric_ConfigPropertyNames);
|
|
1963
|
+
// Invalid or incomplete config
|
|
1964
|
+
if (config === null) {
|
|
1965
|
+
return null;
|
|
1966
|
+
}
|
|
1967
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1968
|
+
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
1969
|
+
};
|
|
1970
|
+
|
|
1971
|
+
function keyBuilder$2(luvio, params) {
|
|
1972
|
+
return keyBuilder$b(luvio, {
|
|
1973
|
+
id: params.urlParams.compoundMetricIdOrName
|
|
1974
|
+
});
|
|
1975
|
+
}
|
|
1976
|
+
function getResponseCacheKeys$1(cacheKeyMap, luvio, resourceParams) {
|
|
1977
|
+
const key = keyBuilder$2(luvio, resourceParams);
|
|
1978
|
+
cacheKeyMap.set(key, {
|
|
1979
|
+
namespace: keyPrefix,
|
|
1980
|
+
representationName: RepresentationType$2,
|
|
1981
|
+
mergeable: false
|
|
1982
|
+
});
|
|
1983
|
+
}
|
|
1984
|
+
function evictSuccess(luvio, resourceParams) {
|
|
1985
|
+
const key = keyBuilder$2(luvio, resourceParams);
|
|
1986
|
+
luvio.storeEvict(key);
|
|
1987
|
+
}
|
|
1988
|
+
function createResourceRequest$1(config) {
|
|
1989
|
+
const headers = {};
|
|
1990
|
+
return {
|
|
1991
|
+
baseUri: '/services/data/v66.0',
|
|
1992
|
+
basePath: '/personalization/compound-metrics/' + config.urlParams.compoundMetricIdOrName + '',
|
|
1993
|
+
method: 'delete',
|
|
1994
|
+
body: null,
|
|
1995
|
+
urlParams: config.urlParams,
|
|
1996
|
+
queryParams: {},
|
|
1997
|
+
headers,
|
|
1998
|
+
priority: 'normal',
|
|
1999
|
+
};
|
|
2000
|
+
}
|
|
2001
|
+
|
|
2002
|
+
const adapterName$1 = 'deleteCompoundMetric';
|
|
2003
|
+
const deleteCompoundMetric_ConfigPropertyMetadata = [
|
|
2004
|
+
generateParamConfigMetadata('compoundMetricIdOrName', true, 0 /* UrlParameter */, 0 /* String */),
|
|
2005
|
+
];
|
|
2006
|
+
const deleteCompoundMetric_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, deleteCompoundMetric_ConfigPropertyMetadata);
|
|
2007
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$a(deleteCompoundMetric_ConfigPropertyMetadata);
|
|
2008
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
2009
|
+
const config = {};
|
|
2010
|
+
typeCheckConfig$a(untrustedConfig, config, deleteCompoundMetric_ConfigPropertyMetadata);
|
|
2011
|
+
return config;
|
|
2012
|
+
}
|
|
2013
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
2014
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
2015
|
+
return null;
|
|
2016
|
+
}
|
|
2017
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2018
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
2019
|
+
}
|
|
2020
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
2021
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
2022
|
+
return null;
|
|
2023
|
+
}
|
|
2024
|
+
return config;
|
|
2025
|
+
}
|
|
2026
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
2027
|
+
const resourceParams = createResourceParams$1(config);
|
|
2028
|
+
const request = createResourceRequest$1(resourceParams);
|
|
2029
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
2030
|
+
.then(() => {
|
|
2031
|
+
return luvio.handleSuccessResponse(() => {
|
|
2032
|
+
evictSuccess(luvio, resourceParams);
|
|
2033
|
+
return luvio.storeBroadcast();
|
|
2034
|
+
}, () => {
|
|
2035
|
+
const cache = new StoreKeyMap();
|
|
2036
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams);
|
|
2037
|
+
return cache;
|
|
2038
|
+
});
|
|
2039
|
+
}, (response) => {
|
|
2040
|
+
deepFreeze(response);
|
|
2041
|
+
throw response;
|
|
2042
|
+
});
|
|
2043
|
+
}
|
|
2044
|
+
const deleteCompoundMetricAdapterFactory = (luvio) => {
|
|
2045
|
+
return function engmtConfigdeleteCompoundMetric(untrustedConfig) {
|
|
2046
|
+
const config = validateAdapterConfig$1(untrustedConfig, deleteCompoundMetric_ConfigPropertyNames);
|
|
2047
|
+
// Invalid or incomplete config
|
|
2048
|
+
if (config === null) {
|
|
2049
|
+
throw new Error(`Invalid config for "${adapterName$1}"`);
|
|
2050
|
+
}
|
|
2051
|
+
return buildNetworkSnapshot$1(luvio, config);
|
|
2052
|
+
};
|
|
2053
|
+
};
|
|
2054
|
+
|
|
2055
|
+
function select(luvio, params) {
|
|
2056
|
+
return select$8();
|
|
2057
|
+
}
|
|
2058
|
+
function keyBuilder$1(luvio, params) {
|
|
2059
|
+
return keyBuilder$b(luvio, {
|
|
2060
|
+
id: params.urlParams.compoundMetricIdOrName
|
|
2061
|
+
});
|
|
2062
|
+
}
|
|
2063
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
2064
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response);
|
|
2065
|
+
}
|
|
2066
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
2067
|
+
const { body } = response;
|
|
2068
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
2069
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
2070
|
+
const snapshot = luvio.storeLookup({
|
|
2071
|
+
recordId: key,
|
|
2072
|
+
node: select(),
|
|
2073
|
+
variables: {},
|
|
2074
|
+
}, snapshotRefresh);
|
|
2075
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2076
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
2077
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
deepFreeze(snapshot.data);
|
|
2081
|
+
return snapshot;
|
|
2082
|
+
}
|
|
2083
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
2084
|
+
const key = keyBuilder$1(luvio, params);
|
|
2085
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
2086
|
+
const storeMetadataParams = {
|
|
2087
|
+
ttl: TTL$2,
|
|
2088
|
+
namespace: keyPrefix,
|
|
2089
|
+
version: VERSION$2,
|
|
2090
|
+
representationName: RepresentationType$2
|
|
2091
|
+
};
|
|
2092
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
2093
|
+
return errorSnapshot;
|
|
2094
|
+
}
|
|
2095
|
+
function createResourceRequest(config) {
|
|
2096
|
+
const headers = {};
|
|
2097
|
+
return {
|
|
2098
|
+
baseUri: '/services/data/v66.0',
|
|
2099
|
+
basePath: '/personalization/compound-metrics/' + config.urlParams.compoundMetricIdOrName + '',
|
|
2100
|
+
method: 'get',
|
|
2101
|
+
body: null,
|
|
2102
|
+
urlParams: config.urlParams,
|
|
2103
|
+
queryParams: {},
|
|
2104
|
+
headers,
|
|
2105
|
+
priority: 'normal',
|
|
2106
|
+
};
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
const adapterName = 'getCompoundMetric';
|
|
2110
|
+
const getCompoundMetric_ConfigPropertyMetadata = [
|
|
2111
|
+
generateParamConfigMetadata('compoundMetricIdOrName', true, 0 /* UrlParameter */, 0 /* String */),
|
|
2112
|
+
];
|
|
2113
|
+
const getCompoundMetric_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getCompoundMetric_ConfigPropertyMetadata);
|
|
2114
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$a(getCompoundMetric_ConfigPropertyMetadata);
|
|
2115
|
+
function keyBuilder(luvio, config) {
|
|
2116
|
+
const resourceParams = createResourceParams(config);
|
|
2117
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
2118
|
+
}
|
|
2119
|
+
function typeCheckConfig(untrustedConfig) {
|
|
2120
|
+
const config = {};
|
|
2121
|
+
typeCheckConfig$a(untrustedConfig, config, getCompoundMetric_ConfigPropertyMetadata);
|
|
2122
|
+
return config;
|
|
2123
|
+
}
|
|
2124
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
2125
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
2126
|
+
return null;
|
|
2127
|
+
}
|
|
2128
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2129
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
2130
|
+
}
|
|
2131
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
2132
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
2133
|
+
return null;
|
|
2134
|
+
}
|
|
2135
|
+
return config;
|
|
2136
|
+
}
|
|
2137
|
+
function adapterFragment(luvio, config) {
|
|
2138
|
+
createResourceParams(config);
|
|
2139
|
+
return select();
|
|
2140
|
+
}
|
|
2141
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
2142
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
2143
|
+
config,
|
|
2144
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
2145
|
+
});
|
|
2146
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
2147
|
+
}
|
|
2148
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
2149
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
2150
|
+
config,
|
|
2151
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
2152
|
+
});
|
|
2153
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
2154
|
+
}
|
|
2155
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
2156
|
+
const resourceParams = createResourceParams(config);
|
|
2157
|
+
const request = createResourceRequest(resourceParams);
|
|
2158
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
2159
|
+
.then((response) => {
|
|
2160
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
2161
|
+
const cache = new StoreKeyMap();
|
|
2162
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
2163
|
+
return cache;
|
|
2164
|
+
});
|
|
2165
|
+
}, (response) => {
|
|
2166
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
2167
|
+
});
|
|
2168
|
+
}
|
|
2169
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
2170
|
+
return buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
|
|
2171
|
+
}
|
|
2172
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
2173
|
+
const { luvio, config } = context;
|
|
2174
|
+
const selector = {
|
|
2175
|
+
recordId: keyBuilder(luvio, config),
|
|
2176
|
+
node: adapterFragment(luvio, config),
|
|
2177
|
+
variables: {},
|
|
2178
|
+
};
|
|
2179
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
2180
|
+
config,
|
|
2181
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
2182
|
+
});
|
|
2183
|
+
return cacheSnapshot;
|
|
2184
|
+
}
|
|
2185
|
+
const getCompoundMetricAdapterFactory = (luvio) => function engmtConfig__getCompoundMetric(untrustedConfig, requestContext) {
|
|
2186
|
+
const config = validateAdapterConfig(untrustedConfig, getCompoundMetric_ConfigPropertyNames);
|
|
2187
|
+
// Invalid or incomplete config
|
|
2188
|
+
if (config === null) {
|
|
2189
|
+
return null;
|
|
2190
|
+
}
|
|
2191
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
2192
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
2193
|
+
};
|
|
2194
|
+
|
|
2195
|
+
export { createEngagementSignalAdapterFactory, createEngagementSignalCompoundMetricAdapterFactory, createEngagementSignalMetricAdapterFactory, deleteCompoundMetricAdapterFactory, deleteEngagementSignalAdapterFactory, deleteEngagementSignalMetricAdapterFactory, getCompoundMetricAdapterFactory, getEngagementSignalAdapterFactory, getEngagementSignalMetricAdapterFactory, getEngagementSignalsAdapterFactory };
|