@salesforce/lds-adapters-sales-enablementmeasureconnectfamily 1.246.0 → 1.248.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, StoreKeyMap, createResourceParams as createResourceParams$1, typeCheckConfig as typeCheckConfig$1 } from '@luvio/engine';
7
+ import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$2, typeCheckConfig as typeCheckConfig$2, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1 } from '@luvio/engine';
8
8
 
9
9
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
10
  const { keys: ObjectKeys, create: ObjectCreate } = Object;
@@ -41,6 +41,13 @@ function untrustedIsObject(untrusted) {
41
41
  function areRequiredParametersPresent(config, configPropertyNames) {
42
42
  return configPropertyNames.parameters.required.every(req => req in config);
43
43
  }
44
+ const snapshotRefreshOptions = {
45
+ overrides: {
46
+ headers: {
47
+ 'Cache-Control': 'no-cache',
48
+ },
49
+ }
50
+ };
44
51
  function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
45
52
  return {
46
53
  name,
@@ -65,15 +72,28 @@ function buildAdapterValidationConfig(displayName, paramsMeta) {
65
72
  const keyPrefix = 'EnablementMeasureConnectFamily';
66
73
 
67
74
  const { isArray: ArrayIsArray } = Array;
75
+ function equalsArray(a, b, equalsItem) {
76
+ const aLength = a.length;
77
+ const bLength = b.length;
78
+ if (aLength !== bLength) {
79
+ return false;
80
+ }
81
+ for (let i = 0; i < aLength; i++) {
82
+ if (equalsItem(a[i], b[i]) === false) {
83
+ return false;
84
+ }
85
+ }
86
+ return true;
87
+ }
68
88
  function createLink(ref) {
69
89
  return {
70
90
  __ref: serializeStructuredKey(ref),
71
91
  };
72
92
  }
73
93
 
74
- const TTL = 5000;
75
- const VERSION = "06f642b78c6dc5286bb5b43198feed06";
76
- function validate(obj, path = 'OnDemandComputationResponseRepresentation') {
94
+ const TTL$1 = 5000;
95
+ const VERSION$3 = "06f642b78c6dc5286bb5b43198feed06";
96
+ function validate$3(obj, path = 'OnDemandComputationResponseRepresentation') {
77
97
  const v_error = (() => {
78
98
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
79
99
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -86,23 +106,23 @@ function validate(obj, path = 'OnDemandComputationResponseRepresentation') {
86
106
  })();
87
107
  return v_error === undefined ? null : v_error;
88
108
  }
89
- const RepresentationType = 'OnDemandComputationResponseRepresentation';
90
- function keyBuilder(luvio, config) {
91
- return keyPrefix + '::' + RepresentationType + ':' + config.enablementProgramId;
109
+ const RepresentationType$1 = 'OnDemandComputationResponseRepresentation';
110
+ function keyBuilder$2(luvio, config) {
111
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.enablementProgramId;
92
112
  }
93
113
  function keyBuilderFromType(luvio, object) {
94
114
  const keyParams = {
95
115
  enablementProgramId: object.enablementProgramId
96
116
  };
97
- return keyBuilder(luvio, keyParams);
117
+ return keyBuilder$2(luvio, keyParams);
98
118
  }
99
- function normalize(input, existing, path, luvio, store, timestamp) {
119
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
100
120
  return input;
101
121
  }
102
- const select$1 = function OnDemandComputationResponseRepresentationSelect() {
122
+ const select$5 = function OnDemandComputationResponseRepresentationSelect() {
103
123
  return {
104
124
  kind: 'Fragment',
105
- version: VERSION,
125
+ version: VERSION$3,
106
126
  private: [],
107
127
  selections: [
108
128
  {
@@ -112,7 +132,7 @@ const select$1 = function OnDemandComputationResponseRepresentationSelect() {
112
132
  ]
113
133
  };
114
134
  };
115
- function equals(existing, incoming) {
135
+ function equals$3(existing, incoming) {
116
136
  const existing_enablementProgramId = existing.enablementProgramId;
117
137
  const incoming_enablementProgramId = incoming.enablementProgramId;
118
138
  if (!(existing_enablementProgramId === incoming_enablementProgramId)) {
@@ -120,41 +140,41 @@ function equals(existing, incoming) {
120
140
  }
121
141
  return true;
122
142
  }
123
- const ingest = function OnDemandComputationResponseRepresentationIngest(input, path, luvio, store, timestamp) {
143
+ const ingest$1 = function OnDemandComputationResponseRepresentationIngest(input, path, luvio, store, timestamp) {
124
144
  if (process.env.NODE_ENV !== 'production') {
125
- const validateError = validate(input);
145
+ const validateError = validate$3(input);
126
146
  if (validateError !== null) {
127
147
  throw validateError;
128
148
  }
129
149
  }
130
150
  const key = keyBuilderFromType(luvio, input);
131
- const ttlToUse = TTL;
132
- ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "EnablementMeasureConnectFamily", VERSION, RepresentationType, equals);
151
+ const ttlToUse = TTL$1;
152
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "EnablementMeasureConnectFamily", VERSION$3, RepresentationType$1, equals$3);
133
153
  return createLink(key);
134
154
  };
135
- function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
155
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
136
156
  // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
137
157
  const rootKey = keyBuilderFromType(luvio, input);
138
158
  rootKeySet.set(rootKey, {
139
159
  namespace: keyPrefix,
140
- representationName: RepresentationType,
160
+ representationName: RepresentationType$1,
141
161
  mergeable: false
142
162
  });
143
163
  }
144
164
 
145
- function select(luvio, params) {
146
- return select$1();
165
+ function select$4(luvio, params) {
166
+ return select$5();
147
167
  }
148
- function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
149
- getTypeCacheKeys(storeKeyMap, luvio, response);
168
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
169
+ getTypeCacheKeys$1(storeKeyMap, luvio, response);
150
170
  }
151
- function ingestSuccess(luvio, resourceParams, response) {
171
+ function ingestSuccess$1(luvio, resourceParams, response) {
152
172
  const { body } = response;
153
173
  const key = keyBuilderFromType(luvio, body);
154
- luvio.storeIngest(key, ingest, body);
174
+ luvio.storeIngest(key, ingest$1, body);
155
175
  const snapshot = luvio.storeLookup({
156
176
  recordId: key,
157
- node: select(),
177
+ node: select$4(),
158
178
  variables: {},
159
179
  });
160
180
  if (process.env.NODE_ENV !== 'production') {
@@ -165,7 +185,7 @@ function ingestSuccess(luvio, resourceParams, response) {
165
185
  deepFreeze(snapshot.data);
166
186
  return snapshot;
167
187
  }
168
- function createResourceRequest(config) {
188
+ function createResourceRequest$1(config) {
169
189
  const headers = {};
170
190
  return {
171
191
  baseUri: '/services/data/v60.0',
@@ -179,41 +199,41 @@ function createResourceRequest(config) {
179
199
  };
180
200
  }
181
201
 
182
- const adapterName = 'triggerOnDemandComputation';
202
+ const adapterName$1 = 'triggerOnDemandComputation';
183
203
  const triggerOnDemandComputation_ConfigPropertyMetadata = [
184
204
  generateParamConfigMetadata('programId', true, 0 /* UrlParameter */, 0 /* String */),
185
205
  ];
186
- const triggerOnDemandComputation_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, triggerOnDemandComputation_ConfigPropertyMetadata);
187
- const createResourceParams = /*#__PURE__*/ createResourceParams$1(triggerOnDemandComputation_ConfigPropertyMetadata);
188
- function typeCheckConfig(untrustedConfig) {
206
+ const triggerOnDemandComputation_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, triggerOnDemandComputation_ConfigPropertyMetadata);
207
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$2(triggerOnDemandComputation_ConfigPropertyMetadata);
208
+ function typeCheckConfig$1(untrustedConfig) {
189
209
  const config = {};
190
- typeCheckConfig$1(untrustedConfig, config, triggerOnDemandComputation_ConfigPropertyMetadata);
210
+ typeCheckConfig$2(untrustedConfig, config, triggerOnDemandComputation_ConfigPropertyMetadata);
191
211
  return config;
192
212
  }
193
- function validateAdapterConfig(untrustedConfig, configPropertyNames) {
213
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
194
214
  if (!untrustedIsObject(untrustedConfig)) {
195
215
  return null;
196
216
  }
197
217
  if (process.env.NODE_ENV !== 'production') {
198
218
  validateConfig(untrustedConfig, configPropertyNames);
199
219
  }
200
- const config = typeCheckConfig(untrustedConfig);
220
+ const config = typeCheckConfig$1(untrustedConfig);
201
221
  if (!areRequiredParametersPresent(config, configPropertyNames)) {
202
222
  return null;
203
223
  }
204
224
  return config;
205
225
  }
206
- function buildNetworkSnapshot(luvio, config, options) {
207
- const resourceParams = createResourceParams(config);
208
- const request = createResourceRequest(resourceParams);
226
+ function buildNetworkSnapshot$1(luvio, config, options) {
227
+ const resourceParams = createResourceParams$1(config);
228
+ const request = createResourceRequest$1(resourceParams);
209
229
  return luvio.dispatchResourceRequest(request, options)
210
230
  .then((response) => {
211
231
  return luvio.handleSuccessResponse(() => {
212
- const snapshot = ingestSuccess(luvio, resourceParams, response);
232
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response);
213
233
  return luvio.storeBroadcast().then(() => snapshot);
214
234
  }, () => {
215
235
  const cache = new StoreKeyMap();
216
- getResponseCacheKeys(cache, luvio, resourceParams, response.body);
236
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
217
237
  return cache;
218
238
  });
219
239
  }, (response) => {
@@ -223,13 +243,533 @@ function buildNetworkSnapshot(luvio, config, options) {
223
243
  }
224
244
  const triggerOnDemandComputationAdapterFactory = (luvio) => {
225
245
  return function triggerOnDemandComputation(untrustedConfig) {
226
- const config = validateAdapterConfig(untrustedConfig, triggerOnDemandComputation_ConfigPropertyNames);
246
+ const config = validateAdapterConfig$1(untrustedConfig, triggerOnDemandComputation_ConfigPropertyNames);
227
247
  // Invalid or incomplete config
228
248
  if (config === null) {
229
249
  throw new Error('Invalid config for "triggerOnDemandComputation"');
230
250
  }
231
- return buildNetworkSnapshot(luvio, config);
251
+ return buildNetworkSnapshot$1(luvio, config);
252
+ };
253
+ };
254
+
255
+ const VERSION$2 = "91199be97a18db7eaa5aa469dcb22aa3";
256
+ function validate$2(obj, path = 'ContributingRecordFieldInfoRepresentation') {
257
+ const v_error = (() => {
258
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
259
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
260
+ }
261
+ const obj_apiName = obj.apiName;
262
+ const path_apiName = path + '.apiName';
263
+ let obj_apiName_union0 = null;
264
+ const obj_apiName_union0_error = (() => {
265
+ if (typeof obj_apiName !== 'string') {
266
+ return new TypeError('Expected "string" but received "' + typeof obj_apiName + '" (at "' + path_apiName + '")');
267
+ }
268
+ })();
269
+ if (obj_apiName_union0_error != null) {
270
+ obj_apiName_union0 = obj_apiName_union0_error.message;
271
+ }
272
+ let obj_apiName_union1 = null;
273
+ const obj_apiName_union1_error = (() => {
274
+ if (obj_apiName !== null) {
275
+ return new TypeError('Expected "null" but received "' + typeof obj_apiName + '" (at "' + path_apiName + '")');
276
+ }
277
+ })();
278
+ if (obj_apiName_union1_error != null) {
279
+ obj_apiName_union1 = obj_apiName_union1_error.message;
280
+ }
281
+ if (obj_apiName_union0 && obj_apiName_union1) {
282
+ let message = 'Object doesn\'t match union (at "' + path_apiName + '")';
283
+ message += '\n' + obj_apiName_union0.split('\n').map((line) => '\t' + line).join('\n');
284
+ message += '\n' + obj_apiName_union1.split('\n').map((line) => '\t' + line).join('\n');
285
+ return new TypeError(message);
286
+ }
287
+ const obj_label = obj.label;
288
+ const path_label = path + '.label';
289
+ let obj_label_union0 = null;
290
+ const obj_label_union0_error = (() => {
291
+ if (typeof obj_label !== 'string') {
292
+ return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
293
+ }
294
+ })();
295
+ if (obj_label_union0_error != null) {
296
+ obj_label_union0 = obj_label_union0_error.message;
297
+ }
298
+ let obj_label_union1 = null;
299
+ const obj_label_union1_error = (() => {
300
+ if (obj_label !== null) {
301
+ return new TypeError('Expected "null" but received "' + typeof obj_label + '" (at "' + path_label + '")');
302
+ }
303
+ })();
304
+ if (obj_label_union1_error != null) {
305
+ obj_label_union1 = obj_label_union1_error.message;
306
+ }
307
+ if (obj_label_union0 && obj_label_union1) {
308
+ let message = 'Object doesn\'t match union (at "' + path_label + '")';
309
+ message += '\n' + obj_label_union0.split('\n').map((line) => '\t' + line).join('\n');
310
+ message += '\n' + obj_label_union1.split('\n').map((line) => '\t' + line).join('\n');
311
+ return new TypeError(message);
312
+ }
313
+ })();
314
+ return v_error === undefined ? null : v_error;
315
+ }
316
+ const select$3 = function ContributingRecordFieldInfoRepresentationSelect() {
317
+ return {
318
+ kind: 'Fragment',
319
+ version: VERSION$2,
320
+ private: [],
321
+ selections: [
322
+ {
323
+ name: 'apiName',
324
+ kind: 'Scalar'
325
+ },
326
+ {
327
+ name: 'label',
328
+ kind: 'Scalar'
329
+ }
330
+ ]
331
+ };
332
+ };
333
+ function equals$2(existing, incoming) {
334
+ const existing_apiName = existing.apiName;
335
+ const incoming_apiName = incoming.apiName;
336
+ if (!(existing_apiName === incoming_apiName)) {
337
+ return false;
338
+ }
339
+ const existing_label = existing.label;
340
+ const incoming_label = incoming.label;
341
+ if (!(existing_label === incoming_label)) {
342
+ return false;
343
+ }
344
+ return true;
345
+ }
346
+
347
+ const VERSION$1 = "8c5503229bdac1da086155b86bcc15f7";
348
+ function validate$1(obj, path = 'ContributingRecordFieldsValueRepresentation') {
349
+ const v_error = (() => {
350
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
351
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
352
+ }
353
+ const obj_aggregationFieldValue = obj.aggregationFieldValue;
354
+ const path_aggregationFieldValue = path + '.aggregationFieldValue';
355
+ if (typeof obj_aggregationFieldValue !== 'string') {
356
+ return new TypeError('Expected "string" but received "' + typeof obj_aggregationFieldValue + '" (at "' + path_aggregationFieldValue + '")');
357
+ }
358
+ const obj_dateFilterFieldValue = obj.dateFilterFieldValue;
359
+ const path_dateFilterFieldValue = path + '.dateFilterFieldValue';
360
+ if (typeof obj_dateFilterFieldValue !== 'string') {
361
+ return new TypeError('Expected "string" but received "' + typeof obj_dateFilterFieldValue + '" (at "' + path_dateFilterFieldValue + '")');
362
+ }
363
+ const obj_displayFieldValue = obj.displayFieldValue;
364
+ const path_displayFieldValue = path + '.displayFieldValue';
365
+ if (typeof obj_displayFieldValue !== 'string') {
366
+ return new TypeError('Expected "string" but received "' + typeof obj_displayFieldValue + '" (at "' + path_displayFieldValue + '")');
367
+ }
368
+ const obj_recordId = obj.recordId;
369
+ const path_recordId = path + '.recordId';
370
+ if (typeof obj_recordId !== 'string') {
371
+ return new TypeError('Expected "string" but received "' + typeof obj_recordId + '" (at "' + path_recordId + '")');
372
+ }
373
+ })();
374
+ return v_error === undefined ? null : v_error;
375
+ }
376
+ const select$2 = function ContributingRecordFieldsValueRepresentationSelect() {
377
+ return {
378
+ kind: 'Fragment',
379
+ version: VERSION$1,
380
+ private: [],
381
+ selections: [
382
+ {
383
+ name: 'aggregationFieldValue',
384
+ kind: 'Scalar'
385
+ },
386
+ {
387
+ name: 'dateFilterFieldValue',
388
+ kind: 'Scalar'
389
+ },
390
+ {
391
+ name: 'displayFieldValue',
392
+ kind: 'Scalar'
393
+ },
394
+ {
395
+ name: 'recordId',
396
+ kind: 'Scalar'
397
+ }
398
+ ]
399
+ };
400
+ };
401
+ function equals$1(existing, incoming) {
402
+ const existing_aggregationFieldValue = existing.aggregationFieldValue;
403
+ const incoming_aggregationFieldValue = incoming.aggregationFieldValue;
404
+ if (!(existing_aggregationFieldValue === incoming_aggregationFieldValue)) {
405
+ return false;
406
+ }
407
+ const existing_dateFilterFieldValue = existing.dateFilterFieldValue;
408
+ const incoming_dateFilterFieldValue = incoming.dateFilterFieldValue;
409
+ if (!(existing_dateFilterFieldValue === incoming_dateFilterFieldValue)) {
410
+ return false;
411
+ }
412
+ const existing_displayFieldValue = existing.displayFieldValue;
413
+ const incoming_displayFieldValue = incoming.displayFieldValue;
414
+ if (!(existing_displayFieldValue === incoming_displayFieldValue)) {
415
+ return false;
416
+ }
417
+ const existing_recordId = existing.recordId;
418
+ const incoming_recordId = incoming.recordId;
419
+ if (!(existing_recordId === incoming_recordId)) {
420
+ return false;
421
+ }
422
+ return true;
423
+ }
424
+
425
+ const TTL = 5000;
426
+ const VERSION = "32f6d0b1a22cd46975c99ab34d7bc368";
427
+ function validate(obj, path = 'MilestoneProgressContributingRecordsRepresentation') {
428
+ const v_error = (() => {
429
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
430
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
431
+ }
432
+ const obj_aggregationField = obj.aggregationField;
433
+ const path_aggregationField = path + '.aggregationField';
434
+ const referencepath_aggregationFieldValidationError = validate$2(obj_aggregationField, path_aggregationField);
435
+ if (referencepath_aggregationFieldValidationError !== null) {
436
+ let message = 'Object doesn\'t match ContributingRecordFieldInfoRepresentation (at "' + path_aggregationField + '")\n';
437
+ message += referencepath_aggregationFieldValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
438
+ return new TypeError(message);
439
+ }
440
+ const obj_aggregationType = obj.aggregationType;
441
+ const path_aggregationType = path + '.aggregationType';
442
+ if (typeof obj_aggregationType !== 'string') {
443
+ return new TypeError('Expected "string" but received "' + typeof obj_aggregationType + '" (at "' + path_aggregationType + '")');
444
+ }
445
+ const obj_dateFilterField = obj.dateFilterField;
446
+ const path_dateFilterField = path + '.dateFilterField';
447
+ const referencepath_dateFilterFieldValidationError = validate$2(obj_dateFilterField, path_dateFilterField);
448
+ if (referencepath_dateFilterFieldValidationError !== null) {
449
+ let message = 'Object doesn\'t match ContributingRecordFieldInfoRepresentation (at "' + path_dateFilterField + '")\n';
450
+ message += referencepath_dateFilterFieldValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
451
+ return new TypeError(message);
452
+ }
453
+ const obj_displayField = obj.displayField;
454
+ const path_displayField = path + '.displayField';
455
+ const referencepath_displayFieldValidationError = validate$2(obj_displayField, path_displayField);
456
+ if (referencepath_displayFieldValidationError !== null) {
457
+ let message = 'Object doesn\'t match ContributingRecordFieldInfoRepresentation (at "' + path_displayField + '")\n';
458
+ message += referencepath_displayFieldValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
459
+ return new TypeError(message);
460
+ }
461
+ const obj_inaccessibleRecordCount = obj.inaccessibleRecordCount;
462
+ const path_inaccessibleRecordCount = path + '.inaccessibleRecordCount';
463
+ let obj_inaccessibleRecordCount_union0 = null;
464
+ const obj_inaccessibleRecordCount_union0_error = (() => {
465
+ if (typeof obj_inaccessibleRecordCount !== 'number' || (typeof obj_inaccessibleRecordCount === 'number' && Math.floor(obj_inaccessibleRecordCount) !== obj_inaccessibleRecordCount)) {
466
+ return new TypeError('Expected "integer" but received "' + typeof obj_inaccessibleRecordCount + '" (at "' + path_inaccessibleRecordCount + '")');
467
+ }
468
+ })();
469
+ if (obj_inaccessibleRecordCount_union0_error != null) {
470
+ obj_inaccessibleRecordCount_union0 = obj_inaccessibleRecordCount_union0_error.message;
471
+ }
472
+ let obj_inaccessibleRecordCount_union1 = null;
473
+ const obj_inaccessibleRecordCount_union1_error = (() => {
474
+ if (obj_inaccessibleRecordCount !== null) {
475
+ return new TypeError('Expected "null" but received "' + typeof obj_inaccessibleRecordCount + '" (at "' + path_inaccessibleRecordCount + '")');
476
+ }
477
+ })();
478
+ if (obj_inaccessibleRecordCount_union1_error != null) {
479
+ obj_inaccessibleRecordCount_union1 = obj_inaccessibleRecordCount_union1_error.message;
480
+ }
481
+ if (obj_inaccessibleRecordCount_union0 && obj_inaccessibleRecordCount_union1) {
482
+ let message = 'Object doesn\'t match union (at "' + path_inaccessibleRecordCount + '")';
483
+ message += '\n' + obj_inaccessibleRecordCount_union0.split('\n').map((line) => '\t' + line).join('\n');
484
+ message += '\n' + obj_inaccessibleRecordCount_union1.split('\n').map((line) => '\t' + line).join('\n');
485
+ return new TypeError(message);
486
+ }
487
+ const obj_records = obj.records;
488
+ const path_records = path + '.records';
489
+ if (!ArrayIsArray(obj_records)) {
490
+ return new TypeError('Expected "array" but received "' + typeof obj_records + '" (at "' + path_records + '")');
491
+ }
492
+ for (let i = 0; i < obj_records.length; i++) {
493
+ const obj_records_item = obj_records[i];
494
+ const path_records_item = path_records + '[' + i + ']';
495
+ const referencepath_records_itemValidationError = validate$1(obj_records_item, path_records_item);
496
+ if (referencepath_records_itemValidationError !== null) {
497
+ let message = 'Object doesn\'t match ContributingRecordFieldsValueRepresentation (at "' + path_records_item + '")\n';
498
+ message += referencepath_records_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
499
+ return new TypeError(message);
500
+ }
501
+ }
502
+ const obj_sourceObjectApiName = obj.sourceObjectApiName;
503
+ const path_sourceObjectApiName = path + '.sourceObjectApiName';
504
+ if (typeof obj_sourceObjectApiName !== 'string') {
505
+ return new TypeError('Expected "string" but received "' + typeof obj_sourceObjectApiName + '" (at "' + path_sourceObjectApiName + '")');
506
+ }
507
+ const obj_taskProgressId = obj.taskProgressId;
508
+ const path_taskProgressId = path + '.taskProgressId';
509
+ if (typeof obj_taskProgressId !== 'string') {
510
+ return new TypeError('Expected "string" but received "' + typeof obj_taskProgressId + '" (at "' + path_taskProgressId + '")');
511
+ }
512
+ })();
513
+ return v_error === undefined ? null : v_error;
514
+ }
515
+ const RepresentationType = 'MilestoneProgressContributingRecordsRepresentation';
516
+ function normalize(input, existing, path, luvio, store, timestamp) {
517
+ return input;
518
+ }
519
+ const select$1 = function MilestoneProgressContributingRecordsRepresentationSelect() {
520
+ const { selections: ContributingRecordFieldInfoRepresentation__selections, opaque: ContributingRecordFieldInfoRepresentation__opaque, } = select$3();
521
+ const { selections: ContributingRecordFieldsValueRepresentation__selections, opaque: ContributingRecordFieldsValueRepresentation__opaque, } = select$2();
522
+ return {
523
+ kind: 'Fragment',
524
+ version: VERSION,
525
+ private: [],
526
+ selections: [
527
+ {
528
+ name: 'aggregationField',
529
+ kind: 'Object',
530
+ selections: ContributingRecordFieldInfoRepresentation__selections
531
+ },
532
+ {
533
+ name: 'aggregationType',
534
+ kind: 'Scalar'
535
+ },
536
+ {
537
+ name: 'dateFilterField',
538
+ kind: 'Object',
539
+ selections: ContributingRecordFieldInfoRepresentation__selections
540
+ },
541
+ {
542
+ name: 'displayField',
543
+ kind: 'Object',
544
+ selections: ContributingRecordFieldInfoRepresentation__selections
545
+ },
546
+ {
547
+ name: 'inaccessibleRecordCount',
548
+ kind: 'Scalar'
549
+ },
550
+ {
551
+ name: 'records',
552
+ kind: 'Object',
553
+ plural: true,
554
+ selections: ContributingRecordFieldsValueRepresentation__selections
555
+ },
556
+ {
557
+ name: 'sourceObjectApiName',
558
+ kind: 'Scalar'
559
+ },
560
+ {
561
+ name: 'taskProgressId',
562
+ kind: 'Scalar'
563
+ }
564
+ ]
565
+ };
566
+ };
567
+ function equals(existing, incoming) {
568
+ const existing_aggregationType = existing.aggregationType;
569
+ const incoming_aggregationType = incoming.aggregationType;
570
+ if (!(existing_aggregationType === incoming_aggregationType)) {
571
+ return false;
572
+ }
573
+ const existing_sourceObjectApiName = existing.sourceObjectApiName;
574
+ const incoming_sourceObjectApiName = incoming.sourceObjectApiName;
575
+ if (!(existing_sourceObjectApiName === incoming_sourceObjectApiName)) {
576
+ return false;
577
+ }
578
+ const existing_taskProgressId = existing.taskProgressId;
579
+ const incoming_taskProgressId = incoming.taskProgressId;
580
+ if (!(existing_taskProgressId === incoming_taskProgressId)) {
581
+ return false;
582
+ }
583
+ const existing_aggregationField = existing.aggregationField;
584
+ const incoming_aggregationField = incoming.aggregationField;
585
+ if (!(equals$2(existing_aggregationField, incoming_aggregationField))) {
586
+ return false;
587
+ }
588
+ const existing_dateFilterField = existing.dateFilterField;
589
+ const incoming_dateFilterField = incoming.dateFilterField;
590
+ if (!(equals$2(existing_dateFilterField, incoming_dateFilterField))) {
591
+ return false;
592
+ }
593
+ const existing_displayField = existing.displayField;
594
+ const incoming_displayField = incoming.displayField;
595
+ if (!(equals$2(existing_displayField, incoming_displayField))) {
596
+ return false;
597
+ }
598
+ const existing_inaccessibleRecordCount = existing.inaccessibleRecordCount;
599
+ const incoming_inaccessibleRecordCount = incoming.inaccessibleRecordCount;
600
+ if (!(existing_inaccessibleRecordCount === incoming_inaccessibleRecordCount)) {
601
+ return false;
602
+ }
603
+ const existing_records = existing.records;
604
+ const incoming_records = incoming.records;
605
+ const equals_records_items = equalsArray(existing_records, incoming_records, (existing_records_item, incoming_records_item) => {
606
+ if (!(equals$1(existing_records_item, incoming_records_item))) {
607
+ return false;
608
+ }
609
+ });
610
+ if (equals_records_items === false) {
611
+ return false;
612
+ }
613
+ return true;
614
+ }
615
+ const ingest = function MilestoneProgressContributingRecordsRepresentationIngest(input, path, luvio, store, timestamp) {
616
+ if (process.env.NODE_ENV !== 'production') {
617
+ const validateError = validate(input);
618
+ if (validateError !== null) {
619
+ throw validateError;
620
+ }
621
+ }
622
+ const key = path.fullPath;
623
+ const ttlToUse = TTL;
624
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "EnablementMeasureConnectFamily", VERSION, RepresentationType, equals);
625
+ return createLink(key);
626
+ };
627
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
628
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
629
+ const rootKey = fullPathFactory();
630
+ rootKeySet.set(rootKey, {
631
+ namespace: keyPrefix,
632
+ representationName: RepresentationType,
633
+ mergeable: false
634
+ });
635
+ }
636
+
637
+ function select(luvio, params) {
638
+ return select$1();
639
+ }
640
+ function keyBuilder$1(luvio, params) {
641
+ return keyPrefix + '::MilestoneProgressContributingRecordsRepresentation:(' + 'taskProgressId:' + params.urlParams.taskProgressId + ')';
642
+ }
643
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
644
+ getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
645
+ }
646
+ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
647
+ const { body } = response;
648
+ const key = keyBuilder$1(luvio, resourceParams);
649
+ luvio.storeIngest(key, ingest, body);
650
+ const snapshot = luvio.storeLookup({
651
+ recordId: key,
652
+ node: select(),
653
+ variables: {},
654
+ }, snapshotRefresh);
655
+ if (process.env.NODE_ENV !== 'production') {
656
+ if (snapshot.state !== 'Fulfilled') {
657
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
658
+ }
659
+ }
660
+ deepFreeze(snapshot.data);
661
+ return snapshot;
662
+ }
663
+ function ingestError(luvio, params, error, snapshotRefresh) {
664
+ const key = keyBuilder$1(luvio, params);
665
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
666
+ const storeMetadataParams = {
667
+ ttl: TTL,
668
+ namespace: keyPrefix,
669
+ version: VERSION,
670
+ representationName: RepresentationType
671
+ };
672
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
673
+ return errorSnapshot;
674
+ }
675
+ function createResourceRequest(config) {
676
+ const headers = {};
677
+ return {
678
+ baseUri: '/services/data/v60.0',
679
+ basePath: '/connect/enablement/contributing-records/taskProgress/' + config.urlParams.taskProgressId + '',
680
+ method: 'get',
681
+ body: null,
682
+ urlParams: config.urlParams,
683
+ queryParams: {},
684
+ headers,
685
+ priority: 'normal',
686
+ };
687
+ }
688
+
689
+ const adapterName = 'getContributingRecordsInfoForMilestone';
690
+ const getContributingRecordsInfoForMilestone_ConfigPropertyMetadata = [
691
+ generateParamConfigMetadata('taskProgressId', true, 0 /* UrlParameter */, 0 /* String */),
692
+ ];
693
+ const getContributingRecordsInfoForMilestone_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getContributingRecordsInfoForMilestone_ConfigPropertyMetadata);
694
+ const createResourceParams = /*#__PURE__*/ createResourceParams$2(getContributingRecordsInfoForMilestone_ConfigPropertyMetadata);
695
+ function keyBuilder(luvio, config) {
696
+ const resourceParams = createResourceParams(config);
697
+ return keyBuilder$1(luvio, resourceParams);
698
+ }
699
+ function typeCheckConfig(untrustedConfig) {
700
+ const config = {};
701
+ typeCheckConfig$2(untrustedConfig, config, getContributingRecordsInfoForMilestone_ConfigPropertyMetadata);
702
+ return config;
703
+ }
704
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
705
+ if (!untrustedIsObject(untrustedConfig)) {
706
+ return null;
707
+ }
708
+ if (process.env.NODE_ENV !== 'production') {
709
+ validateConfig(untrustedConfig, configPropertyNames);
710
+ }
711
+ const config = typeCheckConfig(untrustedConfig);
712
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
713
+ return null;
714
+ }
715
+ return config;
716
+ }
717
+ function adapterFragment(luvio, config) {
718
+ createResourceParams(config);
719
+ return select();
720
+ }
721
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
722
+ const snapshot = ingestSuccess(luvio, resourceParams, response, {
723
+ config,
724
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
725
+ });
726
+ return luvio.storeBroadcast().then(() => snapshot);
727
+ }
728
+ function onFetchResponseError(luvio, config, resourceParams, response) {
729
+ const snapshot = ingestError(luvio, resourceParams, response, {
730
+ config,
731
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
732
+ });
733
+ return luvio.storeBroadcast().then(() => snapshot);
734
+ }
735
+ function buildNetworkSnapshot(luvio, config, options) {
736
+ const resourceParams = createResourceParams(config);
737
+ const request = createResourceRequest(resourceParams);
738
+ return luvio.dispatchResourceRequest(request, options)
739
+ .then((response) => {
740
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
741
+ const cache = new StoreKeyMap();
742
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
743
+ return cache;
744
+ });
745
+ }, (response) => {
746
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
747
+ });
748
+ }
749
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
750
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
751
+ }
752
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
753
+ const { luvio, config } = context;
754
+ const selector = {
755
+ recordId: keyBuilder(luvio, config),
756
+ node: adapterFragment(luvio, config),
757
+ variables: {},
232
758
  };
759
+ const cacheSnapshot = storeLookup(selector, {
760
+ config,
761
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
762
+ });
763
+ return cacheSnapshot;
764
+ }
765
+ const getContributingRecordsInfoForMilestoneAdapterFactory = (luvio) => function EnablementMeasureConnectFamily__getContributingRecordsInfoForMilestone(untrustedConfig, requestContext) {
766
+ const config = validateAdapterConfig(untrustedConfig, getContributingRecordsInfoForMilestone_ConfigPropertyNames);
767
+ // Invalid or incomplete config
768
+ if (config === null) {
769
+ return null;
770
+ }
771
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
772
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
233
773
  };
234
774
 
235
- export { triggerOnDemandComputationAdapterFactory };
775
+ export { getContributingRecordsInfoForMilestoneAdapterFactory, triggerOnDemandComputationAdapterFactory };