@salesforce/lds-adapters-cdp-engmt-config 1.347.0 → 1.348.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@
4
4
  * For full license text, see the LICENSE.txt file
5
5
  */
6
6
 
7
- import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$2, typeCheckConfig as typeCheckConfig$4, StoreKeyMap, createResourceParams as createResourceParams$4 } from '@luvio/engine';
7
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$2, typeCheckConfig as typeCheckConfig$5, StoreKeyMap, createResourceParams as createResourceParams$5 } from '@luvio/engine';
8
8
 
9
9
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
10
  const { keys: ObjectKeys, create: ObjectCreate } = Object;
@@ -92,8 +92,8 @@ function createLink(ref) {
92
92
  };
93
93
  }
94
94
 
95
- const TTL$1 = 6000;
96
- const VERSION$4 = "af006884d9c544cfb734740cc839ab94";
95
+ const TTL$2 = 6000;
96
+ const VERSION$4 = "171063a9be8004fe115bb5e31a231dd9";
97
97
  function validate$4(obj, path = 'EngagementSignalCollectionRepresentation') {
98
98
  const v_error = (() => {
99
99
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
@@ -116,10 +116,33 @@ function validate$4(obj, path = 'EngagementSignalCollectionRepresentation') {
116
116
  return new TypeError('Expected "defined" but received "' + typeof obj_engagementSignals_item + '" (at "' + path_engagementSignals_item + '")');
117
117
  }
118
118
  }
119
- const obj_nextPageUrl = obj.nextPageUrl;
120
- const path_nextPageUrl = path + '.nextPageUrl';
121
- if (typeof obj_nextPageUrl !== 'string') {
122
- return new TypeError('Expected "string" but received "' + typeof obj_nextPageUrl + '" (at "' + path_nextPageUrl + '")');
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
+ }
123
146
  }
124
147
  const obj_totalSize = obj.totalSize;
125
148
  const path_totalSize = path + '.totalSize';
@@ -129,11 +152,11 @@ function validate$4(obj, path = 'EngagementSignalCollectionRepresentation') {
129
152
  })();
130
153
  return v_error === undefined ? null : v_error;
131
154
  }
132
- const RepresentationType$1 = 'EngagementSignalCollectionRepresentation';
133
- function normalize$1(input, existing, path, luvio, store, timestamp) {
155
+ const RepresentationType$2 = 'EngagementSignalCollectionRepresentation';
156
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
134
157
  return input;
135
158
  }
136
- const select$7 = function EngagementSignalCollectionRepresentationSelect() {
159
+ const select$8 = function EngagementSignalCollectionRepresentationSelect() {
137
160
  return {
138
161
  kind: 'Fragment',
139
162
  version: VERSION$4,
@@ -150,7 +173,8 @@ const select$7 = function EngagementSignalCollectionRepresentationSelect() {
150
173
  },
151
174
  {
152
175
  name: 'nextPageUrl',
153
- kind: 'Scalar'
176
+ kind: 'Scalar',
177
+ required: false
154
178
  },
155
179
  {
156
180
  name: 'totalSize',
@@ -170,11 +194,6 @@ function equals$4(existing, incoming) {
170
194
  if (!(existing_currentPageUrl === incoming_currentPageUrl)) {
171
195
  return false;
172
196
  }
173
- const existing_nextPageUrl = existing.nextPageUrl;
174
- const incoming_nextPageUrl = incoming.nextPageUrl;
175
- if (!(existing_nextPageUrl === incoming_nextPageUrl)) {
176
- return false;
177
- }
178
197
  const existing_engagementSignals = existing.engagementSignals;
179
198
  const incoming_engagementSignals = incoming.engagementSignals;
180
199
  const equals_engagementSignals_items = equalsArray(existing_engagementSignals, incoming_engagementSignals, (existing_engagementSignals_item, incoming_engagementSignals_item) => {
@@ -185,9 +204,22 @@ function equals$4(existing, incoming) {
185
204
  if (equals_engagementSignals_items === false) {
186
205
  return false;
187
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
+ }
188
220
  return true;
189
221
  }
190
- const ingest$1 = function EngagementSignalCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
222
+ const ingest$2 = function EngagementSignalCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
191
223
  if (process.env.NODE_ENV !== 'production') {
192
224
  const validateError = validate$4(input);
193
225
  if (validateError !== null) {
@@ -195,36 +227,36 @@ const ingest$1 = function EngagementSignalCollectionRepresentationIngest(input,
195
227
  }
196
228
  }
197
229
  const key = path.fullPath;
198
- const ttlToUse = TTL$1;
199
- ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "engmt-config", VERSION$4, RepresentationType$1, equals$4);
230
+ const ttlToUse = TTL$2;
231
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "engmt-config", VERSION$4, RepresentationType$2, equals$4);
200
232
  return createLink(key);
201
233
  };
202
- function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
234
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
203
235
  // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
204
236
  const rootKey = fullPathFactory();
205
237
  rootKeySet.set(rootKey, {
206
238
  namespace: keyPrefix,
207
- representationName: RepresentationType$1,
239
+ representationName: RepresentationType$2,
208
240
  mergeable: false
209
241
  });
210
242
  }
211
243
 
212
- function select$6(luvio, params) {
213
- return select$7();
244
+ function select$7(luvio, params) {
245
+ return select$8();
214
246
  }
215
- function keyBuilder$5(luvio, params) {
247
+ function keyBuilder$6(luvio, params) {
216
248
  return keyPrefix + '::EngagementSignalCollectionRepresentation:(' + 'dataspaceName:' + params.queryParams.dataspaceName + ',' + 'limit:' + params.queryParams.limit + ',' + 'offset:' + params.queryParams.offset + ',' + 'profileDataGraphName:' + params.queryParams.profileDataGraphName + ')';
217
249
  }
218
- function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
219
- getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$5(luvio, resourceParams));
250
+ function getResponseCacheKeys$4(storeKeyMap, luvio, resourceParams, response) {
251
+ getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$6(luvio, resourceParams));
220
252
  }
221
- function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
253
+ function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
222
254
  const { body } = response;
223
- const key = keyBuilder$5(luvio, resourceParams);
224
- luvio.storeIngest(key, ingest$1, body);
255
+ const key = keyBuilder$6(luvio, resourceParams);
256
+ luvio.storeIngest(key, ingest$2, body);
225
257
  const snapshot = luvio.storeLookup({
226
258
  recordId: key,
227
- node: select$6(),
259
+ node: select$7(),
228
260
  variables: {},
229
261
  }, snapshotRefresh);
230
262
  if (process.env.NODE_ENV !== 'production') {
@@ -236,18 +268,18 @@ function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
236
268
  return snapshot;
237
269
  }
238
270
  function ingestError$1(luvio, params, error, snapshotRefresh) {
239
- const key = keyBuilder$5(luvio, params);
271
+ const key = keyBuilder$6(luvio, params);
240
272
  const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
241
273
  const storeMetadataParams = {
242
- ttl: TTL$1,
274
+ ttl: TTL$2,
243
275
  namespace: keyPrefix,
244
276
  version: VERSION$4,
245
- representationName: RepresentationType$1
277
+ representationName: RepresentationType$2
246
278
  };
247
279
  luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
248
280
  return errorSnapshot;
249
281
  }
250
- function createResourceRequest$3(config) {
282
+ function createResourceRequest$4(config) {
251
283
  const headers = {};
252
284
  return {
253
285
  baseUri: '/services/data/v64.0',
@@ -261,63 +293,63 @@ function createResourceRequest$3(config) {
261
293
  };
262
294
  }
263
295
 
264
- const adapterName$3 = 'getEngagementSignals';
296
+ const adapterName$4 = 'getEngagementSignals';
265
297
  const getEngagementSignals_ConfigPropertyMetadata = [
266
298
  generateParamConfigMetadata('dataspaceName', false, 1 /* QueryParameter */, 0 /* String */),
267
299
  generateParamConfigMetadata('limit', false, 1 /* QueryParameter */, 3 /* Integer */),
268
300
  generateParamConfigMetadata('offset', false, 1 /* QueryParameter */, 3 /* Integer */),
269
301
  generateParamConfigMetadata('profileDataGraphName', false, 1 /* QueryParameter */, 0 /* String */),
270
302
  ];
271
- const getEngagementSignals_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, getEngagementSignals_ConfigPropertyMetadata);
272
- const createResourceParams$3 = /*#__PURE__*/ createResourceParams$4(getEngagementSignals_ConfigPropertyMetadata);
273
- function keyBuilder$4(luvio, config) {
274
- const resourceParams = createResourceParams$3(config);
275
- return keyBuilder$5(luvio, resourceParams);
303
+ const getEngagementSignals_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$4, getEngagementSignals_ConfigPropertyMetadata);
304
+ const createResourceParams$4 = /*#__PURE__*/ createResourceParams$5(getEngagementSignals_ConfigPropertyMetadata);
305
+ function keyBuilder$5(luvio, config) {
306
+ const resourceParams = createResourceParams$4(config);
307
+ return keyBuilder$6(luvio, resourceParams);
276
308
  }
277
- function typeCheckConfig$3(untrustedConfig) {
309
+ function typeCheckConfig$4(untrustedConfig) {
278
310
  const config = {};
279
- typeCheckConfig$4(untrustedConfig, config, getEngagementSignals_ConfigPropertyMetadata);
311
+ typeCheckConfig$5(untrustedConfig, config, getEngagementSignals_ConfigPropertyMetadata);
280
312
  return config;
281
313
  }
282
- function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
314
+ function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
283
315
  if (!untrustedIsObject(untrustedConfig)) {
284
316
  return null;
285
317
  }
286
318
  if (process.env.NODE_ENV !== 'production') {
287
319
  validateConfig(untrustedConfig, configPropertyNames);
288
320
  }
289
- const config = typeCheckConfig$3(untrustedConfig);
321
+ const config = typeCheckConfig$4(untrustedConfig);
290
322
  if (!areRequiredParametersPresent(config, configPropertyNames)) {
291
323
  return null;
292
324
  }
293
325
  return config;
294
326
  }
295
327
  function adapterFragment$1(luvio, config) {
296
- createResourceParams$3(config);
297
- return select$6();
328
+ createResourceParams$4(config);
329
+ return select$7();
298
330
  }
299
331
  function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
300
- const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
332
+ const snapshot = ingestSuccess$3(luvio, resourceParams, response, {
301
333
  config,
302
- resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
334
+ resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
303
335
  });
304
336
  return luvio.storeBroadcast().then(() => snapshot);
305
337
  }
306
338
  function onFetchResponseError$1(luvio, config, resourceParams, response) {
307
339
  const snapshot = ingestError$1(luvio, resourceParams, response, {
308
340
  config,
309
- resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
341
+ resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
310
342
  });
311
343
  return luvio.storeBroadcast().then(() => snapshot);
312
344
  }
313
- function buildNetworkSnapshot$3(luvio, config, options) {
314
- const resourceParams = createResourceParams$3(config);
315
- const request = createResourceRequest$3(resourceParams);
345
+ function buildNetworkSnapshot$4(luvio, config, options) {
346
+ const resourceParams = createResourceParams$4(config);
347
+ const request = createResourceRequest$4(resourceParams);
316
348
  return luvio.dispatchResourceRequest(request, options)
317
349
  .then((response) => {
318
350
  return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
319
351
  const cache = new StoreKeyMap();
320
- getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
352
+ getResponseCacheKeys$4(cache, luvio, resourceParams, response.body);
321
353
  return cache;
322
354
  });
323
355
  }, (response) => {
@@ -325,23 +357,23 @@ function buildNetworkSnapshot$3(luvio, config, options) {
325
357
  });
326
358
  }
327
359
  function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
328
- return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$3, undefined, false);
360
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$4, undefined, false);
329
361
  }
330
362
  function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
331
363
  const { luvio, config } = context;
332
364
  const selector = {
333
- recordId: keyBuilder$4(luvio, config),
365
+ recordId: keyBuilder$5(luvio, config),
334
366
  node: adapterFragment$1(luvio, config),
335
367
  variables: {},
336
368
  };
337
369
  const cacheSnapshot = storeLookup(selector, {
338
370
  config,
339
- resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
371
+ resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
340
372
  });
341
373
  return cacheSnapshot;
342
374
  }
343
375
  const getEngagementSignalsAdapterFactory = (luvio) => function engmtConfig__getEngagementSignals(untrustedConfig, requestContext) {
344
- const config = validateAdapterConfig$3(untrustedConfig, getEngagementSignals_ConfigPropertyNames);
376
+ const config = validateAdapterConfig$4(untrustedConfig, getEngagementSignals_ConfigPropertyNames);
345
377
  // Invalid or incomplete config
346
378
  if (config === null) {
347
379
  return null;
@@ -376,7 +408,7 @@ function validate$3(obj, path = 'EngagementSignalFilterGroupRepresentation') {
376
408
  })();
377
409
  return v_error === undefined ? null : v_error;
378
410
  }
379
- const select$5 = function EngagementSignalFilterGroupRepresentationSelect() {
411
+ const select$6 = function EngagementSignalFilterGroupRepresentationSelect() {
380
412
  return {
381
413
  kind: 'Fragment',
382
414
  version: VERSION$3,
@@ -413,56 +445,55 @@ function equals$3(existing, incoming) {
413
445
  return true;
414
446
  }
415
447
 
416
- const VERSION$2 = "acc5a20fa7e8dcb6bc0687db6d15e7f8";
417
- function validate$2(obj, path = 'EngagementSignalMetricRepresentation') {
448
+ const VERSION$2 = "610f115936516819ec203253177a4ea1";
449
+ function validate$2(obj, path = 'EngagementSignalRateMetricRepresentation') {
418
450
  const v_error = (() => {
419
451
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
420
452
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
421
453
  }
422
- const obj_aggregateFunction = obj.aggregateFunction;
423
- const path_aggregateFunction = path + '.aggregateFunction';
424
- if (typeof obj_aggregateFunction !== 'string') {
425
- return new TypeError('Expected "string" but received "' + typeof obj_aggregateFunction + '" (at "' + path_aggregateFunction + '")');
426
- }
427
- const obj_field = obj.field;
428
- const path_field = path + '.field';
429
- if (obj_field === undefined) {
430
- return new TypeError('Expected "defined" but received "' + typeof obj_field + '" (at "' + path_field + '")');
454
+ const obj_denominatorMetric = obj.denominatorMetric;
455
+ const path_denominatorMetric = path + '.denominatorMetric';
456
+ if (typeof obj_denominatorMetric !== 'string') {
457
+ return new TypeError('Expected "string" but received "' + typeof obj_denominatorMetric + '" (at "' + path_denominatorMetric + '")');
431
458
  }
432
459
  const obj_name = obj.name;
433
460
  const path_name = path + '.name';
434
461
  if (typeof obj_name !== 'string') {
435
462
  return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
436
463
  }
464
+ const obj_numeratorMetric = obj.numeratorMetric;
465
+ const path_numeratorMetric = path + '.numeratorMetric';
466
+ if (typeof obj_numeratorMetric !== 'string') {
467
+ return new TypeError('Expected "string" but received "' + typeof obj_numeratorMetric + '" (at "' + path_numeratorMetric + '")');
468
+ }
437
469
  })();
438
470
  return v_error === undefined ? null : v_error;
439
471
  }
440
- const select$4 = function EngagementSignalMetricRepresentationSelect() {
472
+ const select$5 = function EngagementSignalRateMetricRepresentationSelect() {
441
473
  return {
442
474
  kind: 'Fragment',
443
475
  version: VERSION$2,
444
476
  private: [],
445
477
  selections: [
446
478
  {
447
- name: 'aggregateFunction',
479
+ name: 'denominatorMetric',
448
480
  kind: 'Scalar'
449
481
  },
450
482
  {
451
- name: 'field',
452
- kind: 'Object',
453
- // any
483
+ name: 'name',
484
+ kind: 'Scalar'
454
485
  },
455
486
  {
456
- name: 'name',
487
+ name: 'numeratorMetric',
457
488
  kind: 'Scalar'
458
489
  }
459
490
  ]
460
491
  };
461
492
  };
462
493
  function equals$2(existing, incoming) {
463
- const existing_aggregateFunction = existing.aggregateFunction;
464
- const incoming_aggregateFunction = incoming.aggregateFunction;
465
- if (!(existing_aggregateFunction === incoming_aggregateFunction)) {
494
+ const existing_denominatorMetric = existing.denominatorMetric;
495
+ const incoming_denominatorMetric = incoming.denominatorMetric;
496
+ if (!(existing_denominatorMetric === incoming_denominatorMetric)) {
466
497
  return false;
467
498
  }
468
499
  const existing_name = existing.name;
@@ -470,63 +501,92 @@ function equals$2(existing, incoming) {
470
501
  if (!(existing_name === incoming_name)) {
471
502
  return false;
472
503
  }
473
- const existing_field = existing.field;
474
- const incoming_field = incoming.field;
475
- if (JSONStringify(incoming_field) !== JSONStringify(existing_field)) {
504
+ const existing_numeratorMetric = existing.numeratorMetric;
505
+ const incoming_numeratorMetric = incoming.numeratorMetric;
506
+ if (!(existing_numeratorMetric === incoming_numeratorMetric)) {
476
507
  return false;
477
508
  }
478
509
  return true;
479
510
  }
480
511
 
481
- const VERSION$1 = "610f115936516819ec203253177a4ea1";
482
- function validate$1(obj, path = 'EngagementSignalRateMetricRepresentation') {
512
+ const TTL$1 = 6000;
513
+ const VERSION$1 = "3c26e95c8929ac6685f9de88dab642ed";
514
+ function validate$1(obj, path = 'EngagementSignalMetricRepresentation') {
483
515
  const v_error = (() => {
484
516
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
485
517
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
486
518
  }
487
- const obj_denominatorMetric = obj.denominatorMetric;
488
- const path_denominatorMetric = path + '.denominatorMetric';
489
- if (typeof obj_denominatorMetric !== 'string') {
490
- return new TypeError('Expected "string" but received "' + typeof obj_denominatorMetric + '" (at "' + path_denominatorMetric + '")');
519
+ const obj_aggregateFunction = obj.aggregateFunction;
520
+ const path_aggregateFunction = path + '.aggregateFunction';
521
+ if (typeof obj_aggregateFunction !== 'string') {
522
+ return new TypeError('Expected "string" but received "' + typeof obj_aggregateFunction + '" (at "' + path_aggregateFunction + '")');
523
+ }
524
+ const obj_field = obj.field;
525
+ const path_field = path + '.field';
526
+ if (obj_field === undefined) {
527
+ return new TypeError('Expected "defined" but received "' + typeof obj_field + '" (at "' + path_field + '")');
528
+ }
529
+ const obj_id = obj.id;
530
+ const path_id = path + '.id';
531
+ if (typeof obj_id !== 'string') {
532
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
491
533
  }
492
534
  const obj_name = obj.name;
493
535
  const path_name = path + '.name';
494
536
  if (typeof obj_name !== 'string') {
495
537
  return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
496
538
  }
497
- const obj_numeratorMetric = obj.numeratorMetric;
498
- const path_numeratorMetric = path + '.numeratorMetric';
499
- if (typeof obj_numeratorMetric !== 'string') {
500
- return new TypeError('Expected "string" but received "' + typeof obj_numeratorMetric + '" (at "' + path_numeratorMetric + '")');
501
- }
502
539
  })();
503
540
  return v_error === undefined ? null : v_error;
504
541
  }
505
- const select$3 = function EngagementSignalRateMetricRepresentationSelect() {
542
+ const RepresentationType$1 = 'EngagementSignalMetricRepresentation';
543
+ function keyBuilder$4(luvio, config) {
544
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.id;
545
+ }
546
+ function keyBuilderFromType$1(luvio, object) {
547
+ const keyParams = {
548
+ id: object.id
549
+ };
550
+ return keyBuilder$4(luvio, keyParams);
551
+ }
552
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
553
+ return input;
554
+ }
555
+ const select$4 = function EngagementSignalMetricRepresentationSelect() {
506
556
  return {
507
557
  kind: 'Fragment',
508
558
  version: VERSION$1,
509
559
  private: [],
510
560
  selections: [
511
561
  {
512
- name: 'denominatorMetric',
562
+ name: 'aggregateFunction',
513
563
  kind: 'Scalar'
514
564
  },
515
565
  {
516
- name: 'name',
566
+ name: 'field',
567
+ kind: 'Object',
568
+ // any
569
+ },
570
+ {
571
+ name: 'id',
517
572
  kind: 'Scalar'
518
573
  },
519
574
  {
520
- name: 'numeratorMetric',
575
+ name: 'name',
521
576
  kind: 'Scalar'
522
577
  }
523
578
  ]
524
579
  };
525
580
  };
526
581
  function equals$1(existing, incoming) {
527
- const existing_denominatorMetric = existing.denominatorMetric;
528
- const incoming_denominatorMetric = incoming.denominatorMetric;
529
- if (!(existing_denominatorMetric === incoming_denominatorMetric)) {
582
+ const existing_aggregateFunction = existing.aggregateFunction;
583
+ const incoming_aggregateFunction = incoming.aggregateFunction;
584
+ if (!(existing_aggregateFunction === incoming_aggregateFunction)) {
585
+ return false;
586
+ }
587
+ const existing_id = existing.id;
588
+ const incoming_id = incoming.id;
589
+ if (!(existing_id === incoming_id)) {
530
590
  return false;
531
591
  }
532
592
  const existing_name = existing.name;
@@ -534,16 +594,37 @@ function equals$1(existing, incoming) {
534
594
  if (!(existing_name === incoming_name)) {
535
595
  return false;
536
596
  }
537
- const existing_numeratorMetric = existing.numeratorMetric;
538
- const incoming_numeratorMetric = incoming.numeratorMetric;
539
- if (!(existing_numeratorMetric === incoming_numeratorMetric)) {
597
+ const existing_field = existing.field;
598
+ const incoming_field = incoming.field;
599
+ if (JSONStringify(incoming_field) !== JSONStringify(existing_field)) {
540
600
  return false;
541
601
  }
542
602
  return true;
543
603
  }
604
+ const ingest$1 = function EngagementSignalMetricRepresentationIngest(input, path, luvio, store, timestamp) {
605
+ if (process.env.NODE_ENV !== 'production') {
606
+ const validateError = validate$1(input);
607
+ if (validateError !== null) {
608
+ throw validateError;
609
+ }
610
+ }
611
+ const key = keyBuilderFromType$1(luvio, input);
612
+ const ttlToUse = TTL$1;
613
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "engmt-config", VERSION$1, RepresentationType$1, equals$1);
614
+ return createLink(key);
615
+ };
616
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
617
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
618
+ const rootKey = keyBuilderFromType$1(luvio, input);
619
+ rootKeySet.set(rootKey, {
620
+ namespace: keyPrefix,
621
+ representationName: RepresentationType$1,
622
+ mergeable: false
623
+ });
624
+ }
544
625
 
545
626
  const TTL = 6000;
546
- const VERSION = "298a01442e76ef05192134c6fbaf57ec";
627
+ const VERSION = "51ab05624909776e32bd8951d3494228";
547
628
  function validate(obj, path = 'EngagementSignalRepresentation') {
548
629
  const v_error = (() => {
549
630
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
@@ -611,11 +692,8 @@ function validate(obj, path = 'EngagementSignalRepresentation') {
611
692
  for (let i = 0; i < obj_metrics.length; i++) {
612
693
  const obj_metrics_item = obj_metrics[i];
613
694
  const path_metrics_item = path_metrics + '[' + i + ']';
614
- const referencepath_metrics_itemValidationError = validate$2(obj_metrics_item, path_metrics_item);
615
- if (referencepath_metrics_itemValidationError !== null) {
616
- let message = 'Object doesn\'t match EngagementSignalMetricRepresentation (at "' + path_metrics_item + '")\n';
617
- message += referencepath_metrics_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
618
- return new TypeError(message);
695
+ if (typeof obj_metrics_item !== 'object') {
696
+ return new TypeError('Expected "object" but received "' + typeof obj_metrics_item + '" (at "' + path_metrics_item + '")');
619
697
  }
620
698
  }
621
699
  }
@@ -638,7 +716,7 @@ function validate(obj, path = 'EngagementSignalRepresentation') {
638
716
  for (let i = 0; i < obj_rateMetrics.length; i++) {
639
717
  const obj_rateMetrics_item = obj_rateMetrics[i];
640
718
  const path_rateMetrics_item = path_rateMetrics + '[' + i + ']';
641
- const referencepath_rateMetrics_itemValidationError = validate$1(obj_rateMetrics_item, path_rateMetrics_item);
719
+ const referencepath_rateMetrics_itemValidationError = validate$2(obj_rateMetrics_item, path_rateMetrics_item);
642
720
  if (referencepath_rateMetrics_itemValidationError !== null) {
643
721
  let message = 'Object doesn\'t match EngagementSignalRateMetricRepresentation (at "' + path_rateMetrics_item + '")\n';
644
722
  message += referencepath_rateMetrics_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -675,12 +753,29 @@ function keyBuilderFromType(luvio, object) {
675
753
  return keyBuilder$3(luvio, keyParams);
676
754
  }
677
755
  function normalize(input, existing, path, luvio, store, timestamp) {
756
+ const input_metrics = input.metrics;
757
+ const input_metrics_id = path.fullPath + '__metrics';
758
+ if (input_metrics !== undefined) {
759
+ for (let i = 0; i < input_metrics.length; i++) {
760
+ const input_metrics_item = input_metrics[i];
761
+ let input_metrics_item_id = input_metrics_id + '__' + i;
762
+ input_metrics[i] = ingest$1(input_metrics_item, {
763
+ fullPath: input_metrics_item_id,
764
+ propertyName: i,
765
+ parent: {
766
+ data: input,
767
+ key: path.fullPath,
768
+ existing: existing,
769
+ },
770
+ ttl: path.ttl
771
+ }, luvio, store, timestamp);
772
+ }
773
+ }
678
774
  return input;
679
775
  }
680
- const select$2 = function EngagementSignalRepresentationSelect() {
681
- const { selections: EngagementSignalFilterGroupRepresentation__selections, opaque: EngagementSignalFilterGroupRepresentation__opaque, } = select$5();
682
- const { selections: EngagementSignalMetricRepresentation__selections, opaque: EngagementSignalMetricRepresentation__opaque, } = select$4();
683
- const { selections: EngagementSignalRateMetricRepresentation__selections, opaque: EngagementSignalRateMetricRepresentation__opaque, } = select$3();
776
+ const select$3 = function EngagementSignalRepresentationSelect() {
777
+ const { selections: EngagementSignalFilterGroupRepresentation__selections, opaque: EngagementSignalFilterGroupRepresentation__opaque, } = select$6();
778
+ const { selections: EngagementSignalRateMetricRepresentation__selections, opaque: EngagementSignalRateMetricRepresentation__opaque, } = select$5();
684
779
  return {
685
780
  kind: 'Fragment',
686
781
  version: VERSION,
@@ -717,10 +812,10 @@ const select$2 = function EngagementSignalRepresentationSelect() {
717
812
  },
718
813
  {
719
814
  name: 'metrics',
720
- kind: 'Object',
815
+ kind: 'Link',
721
816
  plural: true,
722
- selections: EngagementSignalMetricRepresentation__selections,
723
- required: false
817
+ required: false,
818
+ fragment: select$4()
724
819
  },
725
820
  {
726
821
  name: 'name',
@@ -840,7 +935,7 @@ function equals(existing, incoming) {
840
935
  return false;
841
936
  }
842
937
  const equals_metrics_items = equalsArray(existing_metrics, incoming_metrics, (existing_metrics_item, incoming_metrics_item) => {
843
- if (!(equals$2(existing_metrics_item, incoming_metrics_item))) {
938
+ if (!(existing_metrics_item.__ref === incoming_metrics_item.__ref)) {
844
939
  return false;
845
940
  }
846
941
  });
@@ -858,7 +953,7 @@ function equals(existing, incoming) {
858
953
  return false;
859
954
  }
860
955
  const equals_rateMetrics_items = equalsArray(existing_rateMetrics, incoming_rateMetrics, (existing_rateMetrics_item, incoming_rateMetrics_item) => {
861
- if (!(equals$1(existing_rateMetrics_item, incoming_rateMetrics_item))) {
956
+ if (!(equals$2(existing_rateMetrics_item, incoming_rateMetrics_item))) {
862
957
  return false;
863
958
  }
864
959
  });
@@ -903,21 +998,27 @@ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
903
998
  representationName: RepresentationType,
904
999
  mergeable: false
905
1000
  });
1001
+ if (input.metrics !== undefined) {
1002
+ const input_metrics_length = input.metrics.length;
1003
+ for (let i = 0; i < input_metrics_length; i++) {
1004
+ getTypeCacheKeys$1(rootKeySet, luvio, input.metrics[i]);
1005
+ }
1006
+ }
906
1007
  }
907
1008
 
908
- function select$1(luvio, params) {
909
- return select$2();
1009
+ function select$2(luvio, params) {
1010
+ return select$3();
910
1011
  }
911
- function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
1012
+ function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
912
1013
  getTypeCacheKeys(storeKeyMap, luvio, response);
913
1014
  }
914
- function ingestSuccess$1(luvio, resourceParams, response) {
1015
+ function ingestSuccess$2(luvio, resourceParams, response) {
915
1016
  const { body } = response;
916
1017
  const key = keyBuilderFromType(luvio, body);
917
1018
  luvio.storeIngest(key, ingest, body);
918
1019
  const snapshot = luvio.storeLookup({
919
1020
  recordId: key,
920
- node: select$1(),
1021
+ node: select$2(),
921
1022
  variables: {},
922
1023
  });
923
1024
  if (process.env.NODE_ENV !== 'production') {
@@ -928,7 +1029,7 @@ function ingestSuccess$1(luvio, resourceParams, response) {
928
1029
  deepFreeze(snapshot.data);
929
1030
  return snapshot;
930
1031
  }
931
- function createResourceRequest$2(config) {
1032
+ function createResourceRequest$3(config) {
932
1033
  const headers = {};
933
1034
  return {
934
1035
  baseUri: '/services/data/v64.0',
@@ -942,7 +1043,7 @@ function createResourceRequest$2(config) {
942
1043
  };
943
1044
  }
944
1045
 
945
- const adapterName$2 = 'createEngagementSignal';
1046
+ const adapterName$3 = 'createEngagementSignal';
946
1047
  const createEngagementSignal_ConfigPropertyMetadata = [
947
1048
  generateParamConfigMetadata('catalogIdField', false, 2 /* Body */, 4 /* Unsupported */),
948
1049
  generateParamConfigMetadata('dataSpaceName', true, 2 /* Body */, 0 /* String */),
@@ -958,11 +1059,11 @@ const createEngagementSignal_ConfigPropertyMetadata = [
958
1059
  generateParamConfigMetadata('uniqueIdentifier', true, 2 /* Body */, 4 /* Unsupported */),
959
1060
  generateParamConfigMetadata('userIdField', true, 2 /* Body */, 4 /* Unsupported */),
960
1061
  ];
961
- const createEngagementSignal_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, createEngagementSignal_ConfigPropertyMetadata);
962
- const createResourceParams$2 = /*#__PURE__*/ createResourceParams$4(createEngagementSignal_ConfigPropertyMetadata);
963
- function typeCheckConfig$2(untrustedConfig) {
1062
+ const createEngagementSignal_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, createEngagementSignal_ConfigPropertyMetadata);
1063
+ const createResourceParams$3 = /*#__PURE__*/ createResourceParams$5(createEngagementSignal_ConfigPropertyMetadata);
1064
+ function typeCheckConfig$3(untrustedConfig) {
964
1065
  const config = {};
965
- typeCheckConfig$4(untrustedConfig, config, createEngagementSignal_ConfigPropertyMetadata);
1066
+ typeCheckConfig$5(untrustedConfig, config, createEngagementSignal_ConfigPropertyMetadata);
966
1067
  const untrustedConfig_catalogIdField = untrustedConfig.catalogIdField;
967
1068
  config.catalogIdField = untrustedConfig_catalogIdField;
968
1069
  const untrustedConfig_distinctFields = untrustedConfig.distinctFields;
@@ -1009,30 +1110,30 @@ function typeCheckConfig$2(untrustedConfig) {
1009
1110
  config.userIdField = untrustedConfig_userIdField;
1010
1111
  return config;
1011
1112
  }
1012
- function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
1113
+ function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
1013
1114
  if (!untrustedIsObject(untrustedConfig)) {
1014
1115
  return null;
1015
1116
  }
1016
1117
  if (process.env.NODE_ENV !== 'production') {
1017
1118
  validateConfig(untrustedConfig, configPropertyNames);
1018
1119
  }
1019
- const config = typeCheckConfig$2(untrustedConfig);
1120
+ const config = typeCheckConfig$3(untrustedConfig);
1020
1121
  if (!areRequiredParametersPresent(config, configPropertyNames)) {
1021
1122
  return null;
1022
1123
  }
1023
1124
  return config;
1024
1125
  }
1025
- function buildNetworkSnapshot$2(luvio, config, options) {
1026
- const resourceParams = createResourceParams$2(config);
1027
- const request = createResourceRequest$2(resourceParams);
1126
+ function buildNetworkSnapshot$3(luvio, config, options) {
1127
+ const resourceParams = createResourceParams$3(config);
1128
+ const request = createResourceRequest$3(resourceParams);
1028
1129
  return luvio.dispatchResourceRequest(request, options)
1029
1130
  .then((response) => {
1030
1131
  return luvio.handleSuccessResponse(() => {
1031
- const snapshot = ingestSuccess$1(luvio, resourceParams, response);
1132
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response);
1032
1133
  return luvio.storeBroadcast().then(() => snapshot);
1033
1134
  }, () => {
1034
1135
  const cache = new StoreKeyMap();
1035
- getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
1136
+ getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
1036
1137
  return cache;
1037
1138
  });
1038
1139
  }, (response) => {
@@ -1042,12 +1143,12 @@ function buildNetworkSnapshot$2(luvio, config, options) {
1042
1143
  }
1043
1144
  const createEngagementSignalAdapterFactory = (luvio) => {
1044
1145
  return function createEngagementSignal(untrustedConfig) {
1045
- const config = validateAdapterConfig$2(untrustedConfig, createEngagementSignal_ConfigPropertyNames);
1146
+ const config = validateAdapterConfig$3(untrustedConfig, createEngagementSignal_ConfigPropertyNames);
1046
1147
  // Invalid or incomplete config
1047
1148
  if (config === null) {
1048
1149
  throw new Error('Invalid config for "createEngagementSignal"');
1049
1150
  }
1050
- return buildNetworkSnapshot$2(luvio, config);
1151
+ return buildNetworkSnapshot$3(luvio, config);
1051
1152
  };
1052
1153
  };
1053
1154
 
@@ -1056,7 +1157,7 @@ function keyBuilder$2(luvio, params) {
1056
1157
  id: params.urlParams.engagementSignalId
1057
1158
  });
1058
1159
  }
1059
- function getResponseCacheKeys$1(cacheKeyMap, luvio, resourceParams) {
1160
+ function getResponseCacheKeys$2(cacheKeyMap, luvio, resourceParams) {
1060
1161
  const key = keyBuilder$2(luvio, resourceParams);
1061
1162
  cacheKeyMap.set(key, {
1062
1163
  namespace: keyPrefix,
@@ -1068,7 +1169,7 @@ function evictSuccess(luvio, resourceParams) {
1068
1169
  const key = keyBuilder$2(luvio, resourceParams);
1069
1170
  luvio.storeEvict(key);
1070
1171
  }
1071
- function createResourceRequest$1(config) {
1172
+ function createResourceRequest$2(config) {
1072
1173
  const headers = {};
1073
1174
  return {
1074
1175
  baseUri: '/services/data/v64.0',
@@ -1082,33 +1183,33 @@ function createResourceRequest$1(config) {
1082
1183
  };
1083
1184
  }
1084
1185
 
1085
- const adapterName$1 = 'deleteEngagementSignal';
1186
+ const adapterName$2 = 'deleteEngagementSignal';
1086
1187
  const deleteEngagementSignal_ConfigPropertyMetadata = [
1087
1188
  generateParamConfigMetadata('engagementSignalId', true, 0 /* UrlParameter */, 0 /* String */),
1088
1189
  ];
1089
- const deleteEngagementSignal_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, deleteEngagementSignal_ConfigPropertyMetadata);
1090
- const createResourceParams$1 = /*#__PURE__*/ createResourceParams$4(deleteEngagementSignal_ConfigPropertyMetadata);
1091
- function typeCheckConfig$1(untrustedConfig) {
1190
+ const deleteEngagementSignal_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, deleteEngagementSignal_ConfigPropertyMetadata);
1191
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$5(deleteEngagementSignal_ConfigPropertyMetadata);
1192
+ function typeCheckConfig$2(untrustedConfig) {
1092
1193
  const config = {};
1093
- typeCheckConfig$4(untrustedConfig, config, deleteEngagementSignal_ConfigPropertyMetadata);
1194
+ typeCheckConfig$5(untrustedConfig, config, deleteEngagementSignal_ConfigPropertyMetadata);
1094
1195
  return config;
1095
1196
  }
1096
- function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
1197
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
1097
1198
  if (!untrustedIsObject(untrustedConfig)) {
1098
1199
  return null;
1099
1200
  }
1100
1201
  if (process.env.NODE_ENV !== 'production') {
1101
1202
  validateConfig(untrustedConfig, configPropertyNames);
1102
1203
  }
1103
- const config = typeCheckConfig$1(untrustedConfig);
1204
+ const config = typeCheckConfig$2(untrustedConfig);
1104
1205
  if (!areRequiredParametersPresent(config, configPropertyNames)) {
1105
1206
  return null;
1106
1207
  }
1107
1208
  return config;
1108
1209
  }
1109
- function buildNetworkSnapshot$1(luvio, config, options) {
1110
- const resourceParams = createResourceParams$1(config);
1111
- const request = createResourceRequest$1(resourceParams);
1210
+ function buildNetworkSnapshot$2(luvio, config, options) {
1211
+ const resourceParams = createResourceParams$2(config);
1212
+ const request = createResourceRequest$2(resourceParams);
1112
1213
  return luvio.dispatchResourceRequest(request, options)
1113
1214
  .then(() => {
1114
1215
  return luvio.handleSuccessResponse(() => {
@@ -1116,7 +1217,7 @@ function buildNetworkSnapshot$1(luvio, config, options) {
1116
1217
  return luvio.storeBroadcast();
1117
1218
  }, () => {
1118
1219
  const cache = new StoreKeyMap();
1119
- getResponseCacheKeys$1(cache, luvio, resourceParams);
1220
+ getResponseCacheKeys$2(cache, luvio, resourceParams);
1120
1221
  return cache;
1121
1222
  });
1122
1223
  }, (response) => {
@@ -1126,33 +1227,33 @@ function buildNetworkSnapshot$1(luvio, config, options) {
1126
1227
  }
1127
1228
  const deleteEngagementSignalAdapterFactory = (luvio) => {
1128
1229
  return function engmtConfigdeleteEngagementSignal(untrustedConfig) {
1129
- const config = validateAdapterConfig$1(untrustedConfig, deleteEngagementSignal_ConfigPropertyNames);
1230
+ const config = validateAdapterConfig$2(untrustedConfig, deleteEngagementSignal_ConfigPropertyNames);
1130
1231
  // Invalid or incomplete config
1131
1232
  if (config === null) {
1132
- throw new Error(`Invalid config for "${adapterName$1}"`);
1233
+ throw new Error(`Invalid config for "${adapterName$2}"`);
1133
1234
  }
1134
- return buildNetworkSnapshot$1(luvio, config);
1235
+ return buildNetworkSnapshot$2(luvio, config);
1135
1236
  };
1136
1237
  };
1137
1238
 
1138
- function select(luvio, params) {
1139
- return select$2();
1239
+ function select$1(luvio, params) {
1240
+ return select$3();
1140
1241
  }
1141
1242
  function keyBuilder$1(luvio, params) {
1142
1243
  return keyBuilder$3(luvio, {
1143
1244
  id: params.urlParams.engagementSignalId
1144
1245
  });
1145
1246
  }
1146
- function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
1247
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
1147
1248
  getTypeCacheKeys(storeKeyMap, luvio, response);
1148
1249
  }
1149
- function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
1250
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
1150
1251
  const { body } = response;
1151
1252
  const key = keyBuilder$1(luvio, resourceParams);
1152
1253
  luvio.storeIngest(key, ingest, body);
1153
1254
  const snapshot = luvio.storeLookup({
1154
1255
  recordId: key,
1155
- node: select(),
1256
+ node: select$1(),
1156
1257
  variables: {},
1157
1258
  }, snapshotRefresh);
1158
1259
  if (process.env.NODE_ENV !== 'production') {
@@ -1175,7 +1276,7 @@ function ingestError(luvio, params, error, snapshotRefresh) {
1175
1276
  luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
1176
1277
  return errorSnapshot;
1177
1278
  }
1178
- function createResourceRequest(config) {
1279
+ function createResourceRequest$1(config) {
1179
1280
  const headers = {};
1180
1281
  return {
1181
1282
  baseUri: '/services/data/v64.0',
@@ -1189,60 +1290,60 @@ function createResourceRequest(config) {
1189
1290
  };
1190
1291
  }
1191
1292
 
1192
- const adapterName = 'getEngagementSignal';
1293
+ const adapterName$1 = 'getEngagementSignal';
1193
1294
  const getEngagementSignal_ConfigPropertyMetadata = [
1194
1295
  generateParamConfigMetadata('engagementSignalId', true, 0 /* UrlParameter */, 0 /* String */),
1195
1296
  ];
1196
- const getEngagementSignal_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getEngagementSignal_ConfigPropertyMetadata);
1197
- const createResourceParams = /*#__PURE__*/ createResourceParams$4(getEngagementSignal_ConfigPropertyMetadata);
1297
+ const getEngagementSignal_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getEngagementSignal_ConfigPropertyMetadata);
1298
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$5(getEngagementSignal_ConfigPropertyMetadata);
1198
1299
  function keyBuilder(luvio, config) {
1199
- const resourceParams = createResourceParams(config);
1300
+ const resourceParams = createResourceParams$1(config);
1200
1301
  return keyBuilder$1(luvio, resourceParams);
1201
1302
  }
1202
- function typeCheckConfig(untrustedConfig) {
1303
+ function typeCheckConfig$1(untrustedConfig) {
1203
1304
  const config = {};
1204
- typeCheckConfig$4(untrustedConfig, config, getEngagementSignal_ConfigPropertyMetadata);
1305
+ typeCheckConfig$5(untrustedConfig, config, getEngagementSignal_ConfigPropertyMetadata);
1205
1306
  return config;
1206
1307
  }
1207
- function validateAdapterConfig(untrustedConfig, configPropertyNames) {
1308
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
1208
1309
  if (!untrustedIsObject(untrustedConfig)) {
1209
1310
  return null;
1210
1311
  }
1211
1312
  if (process.env.NODE_ENV !== 'production') {
1212
1313
  validateConfig(untrustedConfig, configPropertyNames);
1213
1314
  }
1214
- const config = typeCheckConfig(untrustedConfig);
1315
+ const config = typeCheckConfig$1(untrustedConfig);
1215
1316
  if (!areRequiredParametersPresent(config, configPropertyNames)) {
1216
1317
  return null;
1217
1318
  }
1218
1319
  return config;
1219
1320
  }
1220
1321
  function adapterFragment(luvio, config) {
1221
- createResourceParams(config);
1222
- return select();
1322
+ createResourceParams$1(config);
1323
+ return select$1();
1223
1324
  }
1224
1325
  function onFetchResponseSuccess(luvio, config, resourceParams, response) {
1225
- const snapshot = ingestSuccess(luvio, resourceParams, response, {
1326
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
1226
1327
  config,
1227
- resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1328
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1228
1329
  });
1229
1330
  return luvio.storeBroadcast().then(() => snapshot);
1230
1331
  }
1231
1332
  function onFetchResponseError(luvio, config, resourceParams, response) {
1232
1333
  const snapshot = ingestError(luvio, resourceParams, response, {
1233
1334
  config,
1234
- resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1335
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1235
1336
  });
1236
1337
  return luvio.storeBroadcast().then(() => snapshot);
1237
1338
  }
1238
- function buildNetworkSnapshot(luvio, config, options) {
1239
- const resourceParams = createResourceParams(config);
1240
- const request = createResourceRequest(resourceParams);
1339
+ function buildNetworkSnapshot$1(luvio, config, options) {
1340
+ const resourceParams = createResourceParams$1(config);
1341
+ const request = createResourceRequest$1(resourceParams);
1241
1342
  return luvio.dispatchResourceRequest(request, options)
1242
1343
  .then((response) => {
1243
1344
  return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
1244
1345
  const cache = new StoreKeyMap();
1245
- getResponseCacheKeys(cache, luvio, resourceParams, response.body);
1346
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
1246
1347
  return cache;
1247
1348
  });
1248
1349
  }, (response) => {
@@ -1250,7 +1351,7 @@ function buildNetworkSnapshot(luvio, config, options) {
1250
1351
  });
1251
1352
  }
1252
1353
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
1253
- return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
1354
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
1254
1355
  }
1255
1356
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
1256
1357
  const { luvio, config } = context;
@@ -1261,12 +1362,12 @@ function buildCachedSnapshotCachePolicy(context, storeLookup) {
1261
1362
  };
1262
1363
  const cacheSnapshot = storeLookup(selector, {
1263
1364
  config,
1264
- resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1365
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1265
1366
  });
1266
1367
  return cacheSnapshot;
1267
1368
  }
1268
1369
  const getEngagementSignalAdapterFactory = (luvio) => function engmtConfig__getEngagementSignal(untrustedConfig, requestContext) {
1269
- const config = validateAdapterConfig(untrustedConfig, getEngagementSignal_ConfigPropertyNames);
1370
+ const config = validateAdapterConfig$1(untrustedConfig, getEngagementSignal_ConfigPropertyNames);
1270
1371
  // Invalid or incomplete config
1271
1372
  if (config === null) {
1272
1373
  return null;
@@ -1275,4 +1376,101 @@ const getEngagementSignalAdapterFactory = (luvio) => function engmtConfig__getEn
1275
1376
  buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
1276
1377
  };
1277
1378
 
1278
- export { createEngagementSignalAdapterFactory, deleteEngagementSignalAdapterFactory, getEngagementSignalAdapterFactory, getEngagementSignalsAdapterFactory };
1379
+ function select(luvio, params) {
1380
+ return select$4();
1381
+ }
1382
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
1383
+ getTypeCacheKeys$1(storeKeyMap, luvio, response);
1384
+ }
1385
+ function ingestSuccess(luvio, resourceParams, response) {
1386
+ const { body } = response;
1387
+ const key = keyBuilderFromType$1(luvio, body);
1388
+ luvio.storeIngest(key, ingest$1, body);
1389
+ const snapshot = luvio.storeLookup({
1390
+ recordId: key,
1391
+ node: select(),
1392
+ variables: {},
1393
+ });
1394
+ if (process.env.NODE_ENV !== 'production') {
1395
+ if (snapshot.state !== 'Fulfilled') {
1396
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1397
+ }
1398
+ }
1399
+ deepFreeze(snapshot.data);
1400
+ return snapshot;
1401
+ }
1402
+ function createResourceRequest(config) {
1403
+ const headers = {};
1404
+ return {
1405
+ baseUri: '/services/data/v64.0',
1406
+ basePath: '/personalization/engagement-signals/' + config.urlParams.engagementSignalId + '/metrics',
1407
+ method: 'post',
1408
+ body: config.body,
1409
+ urlParams: config.urlParams,
1410
+ queryParams: {},
1411
+ headers,
1412
+ priority: 'normal',
1413
+ };
1414
+ }
1415
+
1416
+ const adapterName = 'createEngagementSignalMetric';
1417
+ const createEngagementSignalMetric_ConfigPropertyMetadata = [
1418
+ generateParamConfigMetadata('engagementSignalId', true, 0 /* UrlParameter */, 0 /* String */),
1419
+ generateParamConfigMetadata('aggregateFunction', true, 2 /* Body */, 0 /* String */),
1420
+ generateParamConfigMetadata('description', false, 2 /* Body */, 0 /* String */),
1421
+ generateParamConfigMetadata('field', true, 2 /* Body */, 4 /* Unsupported */),
1422
+ generateParamConfigMetadata('label', false, 2 /* Body */, 0 /* String */),
1423
+ generateParamConfigMetadata('name', true, 2 /* Body */, 0 /* String */),
1424
+ ];
1425
+ const createEngagementSignalMetric_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, createEngagementSignalMetric_ConfigPropertyMetadata);
1426
+ const createResourceParams = /*#__PURE__*/ createResourceParams$5(createEngagementSignalMetric_ConfigPropertyMetadata);
1427
+ function typeCheckConfig(untrustedConfig) {
1428
+ const config = {};
1429
+ typeCheckConfig$5(untrustedConfig, config, createEngagementSignalMetric_ConfigPropertyMetadata);
1430
+ const untrustedConfig_field = untrustedConfig.field;
1431
+ config.field = untrustedConfig_field;
1432
+ return config;
1433
+ }
1434
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
1435
+ if (!untrustedIsObject(untrustedConfig)) {
1436
+ return null;
1437
+ }
1438
+ if (process.env.NODE_ENV !== 'production') {
1439
+ validateConfig(untrustedConfig, configPropertyNames);
1440
+ }
1441
+ const config = typeCheckConfig(untrustedConfig);
1442
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1443
+ return null;
1444
+ }
1445
+ return config;
1446
+ }
1447
+ function buildNetworkSnapshot(luvio, config, options) {
1448
+ const resourceParams = createResourceParams(config);
1449
+ const request = createResourceRequest(resourceParams);
1450
+ return luvio.dispatchResourceRequest(request, options)
1451
+ .then((response) => {
1452
+ return luvio.handleSuccessResponse(() => {
1453
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
1454
+ return luvio.storeBroadcast().then(() => snapshot);
1455
+ }, () => {
1456
+ const cache = new StoreKeyMap();
1457
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
1458
+ return cache;
1459
+ });
1460
+ }, (response) => {
1461
+ deepFreeze(response);
1462
+ throw response;
1463
+ });
1464
+ }
1465
+ const createEngagementSignalMetricAdapterFactory = (luvio) => {
1466
+ return function createEngagementSignalMetric(untrustedConfig) {
1467
+ const config = validateAdapterConfig(untrustedConfig, createEngagementSignalMetric_ConfigPropertyNames);
1468
+ // Invalid or incomplete config
1469
+ if (config === null) {
1470
+ throw new Error('Invalid config for "createEngagementSignalMetric"');
1471
+ }
1472
+ return buildNetworkSnapshot(luvio, config);
1473
+ };
1474
+ };
1475
+
1476
+ export { createEngagementSignalAdapterFactory, createEngagementSignalMetricAdapterFactory, deleteEngagementSignalAdapterFactory, getEngagementSignalAdapterFactory, getEngagementSignalsAdapterFactory };