@salesforce/lds-adapters-sales-yukon 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.
Files changed (25) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/sales-yukon.js +1150 -0
  3. package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
  4. package/dist/es/es2018/types/src/generated/adapters/getYukonSurfaceNudges.d.ts +28 -0
  5. package/dist/es/es2018/types/src/generated/adapters/getYukonSurfaceNudgesMock.d.ts +30 -0
  6. package/dist/es/es2018/types/src/generated/adapters/postYukonTelemetry.d.ts +16 -0
  7. package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +3 -0
  8. package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +8 -0
  9. package/dist/es/es2018/types/src/generated/resources/getYukonSurfacesNudgesBySurfaceId.d.ts +16 -0
  10. package/dist/es/es2018/types/src/generated/resources/getYukonSurfacesNudgesMockBySurfaceId.d.ts +20 -0
  11. package/dist/es/es2018/types/src/generated/resources/postYukonTelemetry.d.ts +13 -0
  12. package/dist/es/es2018/types/src/generated/types/YukonNudgeActionEngagementRepresentation.d.ts +31 -0
  13. package/dist/es/es2018/types/src/generated/types/YukonNudgeActionStateRepresentation.d.ts +37 -0
  14. package/dist/es/es2018/types/src/generated/types/YukonNudgeInputRepresentation.d.ts +61 -0
  15. package/dist/es/es2018/types/src/generated/types/YukonNudgeOutputRepresentation.d.ts +54 -0
  16. package/dist/es/es2018/types/src/generated/types/YukonSurfaceNudgesOutputRepresentation.d.ts +47 -0
  17. package/dist/es/es2018/types/src/generated/types/YukonTelemetryInputGroupRepresentation.d.ts +29 -0
  18. package/dist/es/es2018/types/src/generated/types/YukonTelemetryInputRepresentation.d.ts +34 -0
  19. package/dist/es/es2018/types/src/generated/types/YukonTelemetryOutputRepresentation.d.ts +40 -0
  20. package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
  21. package/package.json +66 -0
  22. package/sfdc/index.d.ts +1 -0
  23. package/sfdc/index.js +1278 -0
  24. package/src/raml/api.raml +247 -0
  25. package/src/raml/luvio.raml +33 -0
package/sfdc/index.js ADDED
@@ -0,0 +1,1278 @@
1
+ /**
2
+ * Copyright (c) 2022, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ /*
8
+ * ATTENTION!
9
+ * THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
10
+ * If you would like to contribute to LDS, please follow the steps outlined in the git repo.
11
+ * Any changes made to this file in p4 will be automatically overwritten.
12
+ * *******************************************************************************************
13
+ */
14
+ /* proxy-compat-disable */
15
+ import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
16
+ import { withDefaultLuvio } from 'force/ldsEngine';
17
+ import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$2, typeCheckConfig as typeCheckConfig$3, createResourceParams as createResourceParams$3 } from 'force/luvioEngine';
18
+
19
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
20
+ const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
21
+ const { isArray: ArrayIsArray$1 } = Array;
22
+ /**
23
+ * Validates an adapter config is well-formed.
24
+ * @param config The config to validate.
25
+ * @param adapter The adapter validation configuration.
26
+ * @param oneOf The keys the config must contain at least one of.
27
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
28
+ */
29
+ function validateConfig(config, adapter, oneOf) {
30
+ const { displayName } = adapter;
31
+ const { required, optional, unsupported } = adapter.parameters;
32
+ if (config === undefined ||
33
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
34
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
35
+ }
36
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
37
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
38
+ }
39
+ if (unsupported !== undefined &&
40
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
41
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
42
+ }
43
+ const supported = required.concat(optional);
44
+ if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
45
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
46
+ }
47
+ }
48
+ function untrustedIsObject(untrusted) {
49
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
50
+ }
51
+ function areRequiredParametersPresent(config, configPropertyNames) {
52
+ return configPropertyNames.parameters.required.every(req => req in config);
53
+ }
54
+ const snapshotRefreshOptions = {
55
+ overrides: {
56
+ headers: {
57
+ 'Cache-Control': 'no-cache',
58
+ },
59
+ }
60
+ };
61
+ function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
62
+ return {
63
+ name,
64
+ required,
65
+ resourceType,
66
+ typeCheckShape,
67
+ isArrayShape,
68
+ coerceFn,
69
+ };
70
+ }
71
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
72
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
73
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
74
+ return {
75
+ displayName,
76
+ parameters: {
77
+ required,
78
+ optional,
79
+ }
80
+ };
81
+ }
82
+ const keyPrefix = 'Yukon';
83
+
84
+ const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
85
+ const { isArray: ArrayIsArray } = Array;
86
+ const { stringify: JSONStringify } = JSON;
87
+ function equalsArray(a, b, equalsItem) {
88
+ const aLength = a.length;
89
+ const bLength = b.length;
90
+ if (aLength !== bLength) {
91
+ return false;
92
+ }
93
+ for (let i = 0; i < aLength; i++) {
94
+ if (equalsItem(a[i], b[i]) === false) {
95
+ return false;
96
+ }
97
+ }
98
+ return true;
99
+ }
100
+ function equalsObject(a, b, equalsProp) {
101
+ const aKeys = ObjectKeys(a).sort();
102
+ const bKeys = ObjectKeys(b).sort();
103
+ const aKeysLength = aKeys.length;
104
+ const bKeysLength = bKeys.length;
105
+ if (aKeysLength !== bKeysLength) {
106
+ return false;
107
+ }
108
+ for (let i = 0; i < aKeys.length; i++) {
109
+ const key = aKeys[i];
110
+ if (key !== bKeys[i]) {
111
+ return false;
112
+ }
113
+ if (equalsProp(a[key], b[key]) === false) {
114
+ return false;
115
+ }
116
+ }
117
+ return true;
118
+ }
119
+ function createLink(ref) {
120
+ return {
121
+ __ref: serializeStructuredKey(ref),
122
+ };
123
+ }
124
+
125
+ const VERSION$4 = "06d910116027ee7b77989f680bfcb262";
126
+ function validate$5(obj, path = 'YukonNudgeActionEngagementRepresentation') {
127
+ const v_error = (() => {
128
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
129
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
130
+ }
131
+ if (obj.primary !== undefined) {
132
+ const obj_primary = obj.primary;
133
+ const path_primary = path + '.primary';
134
+ if (typeof obj_primary !== 'number' || (typeof obj_primary === 'number' && Math.floor(obj_primary) !== obj_primary)) {
135
+ return new TypeError('Expected "integer" but received "' + typeof obj_primary + '" (at "' + path_primary + '")');
136
+ }
137
+ }
138
+ if (obj.secondary !== undefined) {
139
+ const obj_secondary = obj.secondary;
140
+ const path_secondary = path + '.secondary';
141
+ if (typeof obj_secondary !== 'number' || (typeof obj_secondary === 'number' && Math.floor(obj_secondary) !== obj_secondary)) {
142
+ return new TypeError('Expected "integer" but received "' + typeof obj_secondary + '" (at "' + path_secondary + '")');
143
+ }
144
+ }
145
+ })();
146
+ return v_error === undefined ? null : v_error;
147
+ }
148
+ const select$7 = function YukonNudgeActionEngagementRepresentationSelect() {
149
+ return {
150
+ kind: 'Fragment',
151
+ version: VERSION$4,
152
+ private: [],
153
+ selections: [
154
+ {
155
+ name: 'primary',
156
+ kind: 'Scalar',
157
+ required: false
158
+ },
159
+ {
160
+ name: 'secondary',
161
+ kind: 'Scalar',
162
+ required: false
163
+ }
164
+ ]
165
+ };
166
+ };
167
+ function equals$4(existing, incoming) {
168
+ const existing_primary = existing.primary;
169
+ const incoming_primary = incoming.primary;
170
+ // if at least one of these optionals is defined
171
+ if (existing_primary !== undefined || incoming_primary !== undefined) {
172
+ // if one of these is not defined we know the other is defined and therefore
173
+ // not equal
174
+ if (existing_primary === undefined || incoming_primary === undefined) {
175
+ return false;
176
+ }
177
+ if (!(existing_primary === incoming_primary)) {
178
+ return false;
179
+ }
180
+ }
181
+ const existing_secondary = existing.secondary;
182
+ const incoming_secondary = incoming.secondary;
183
+ // if at least one of these optionals is defined
184
+ if (existing_secondary !== undefined || incoming_secondary !== undefined) {
185
+ // if one of these is not defined we know the other is defined and therefore
186
+ // not equal
187
+ if (existing_secondary === undefined || incoming_secondary === undefined) {
188
+ return false;
189
+ }
190
+ if (!(existing_secondary === incoming_secondary)) {
191
+ return false;
192
+ }
193
+ }
194
+ return true;
195
+ }
196
+
197
+ const VERSION$3 = "361047d69f9d5767a73f945c54a9f97d";
198
+ function validate$4(obj, path = 'YukonNudgeActionStateRepresentation') {
199
+ const v_error = (() => {
200
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
201
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
202
+ }
203
+ if (obj.engagement !== undefined) {
204
+ const obj_engagement = obj.engagement;
205
+ const path_engagement = path + '.engagement';
206
+ const referencepath_engagementValidationError = validate$5(obj_engagement, path_engagement);
207
+ if (referencepath_engagementValidationError !== null) {
208
+ let message = 'Object doesn\'t match YukonNudgeActionEngagementRepresentation (at "' + path_engagement + '")\n';
209
+ message += referencepath_engagementValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
210
+ return new TypeError(message);
211
+ }
212
+ }
213
+ if (obj.lastSeen !== undefined) {
214
+ const obj_lastSeen = obj.lastSeen;
215
+ const path_lastSeen = path + '.lastSeen';
216
+ if (typeof obj_lastSeen !== 'string') {
217
+ return new TypeError('Expected "string" but received "' + typeof obj_lastSeen + '" (at "' + path_lastSeen + '")');
218
+ }
219
+ }
220
+ if (obj.seenCount !== undefined) {
221
+ const obj_seenCount = obj.seenCount;
222
+ const path_seenCount = path + '.seenCount';
223
+ if (typeof obj_seenCount !== 'number' || (typeof obj_seenCount === 'number' && Math.floor(obj_seenCount) !== obj_seenCount)) {
224
+ return new TypeError('Expected "integer" but received "' + typeof obj_seenCount + '" (at "' + path_seenCount + '")');
225
+ }
226
+ }
227
+ if (obj.stepCount !== undefined) {
228
+ const obj_stepCount = obj.stepCount;
229
+ const path_stepCount = path + '.stepCount';
230
+ if (typeof obj_stepCount !== 'number' || (typeof obj_stepCount === 'number' && Math.floor(obj_stepCount) !== obj_stepCount)) {
231
+ return new TypeError('Expected "integer" but received "' + typeof obj_stepCount + '" (at "' + path_stepCount + '")');
232
+ }
233
+ }
234
+ })();
235
+ return v_error === undefined ? null : v_error;
236
+ }
237
+ const select$6 = function YukonNudgeActionStateRepresentationSelect() {
238
+ const { selections: YukonNudgeActionEngagementRepresentation__selections, opaque: YukonNudgeActionEngagementRepresentation__opaque, } = select$7();
239
+ return {
240
+ kind: 'Fragment',
241
+ version: VERSION$3,
242
+ private: [],
243
+ selections: [
244
+ {
245
+ name: 'engagement',
246
+ kind: 'Object',
247
+ selections: YukonNudgeActionEngagementRepresentation__selections,
248
+ required: false
249
+ },
250
+ {
251
+ name: 'lastSeen',
252
+ kind: 'Scalar',
253
+ required: false
254
+ },
255
+ {
256
+ name: 'seenCount',
257
+ kind: 'Scalar',
258
+ required: false
259
+ },
260
+ {
261
+ name: 'stepCount',
262
+ kind: 'Scalar',
263
+ required: false
264
+ }
265
+ ]
266
+ };
267
+ };
268
+ function equals$3(existing, incoming) {
269
+ const existing_seenCount = existing.seenCount;
270
+ const incoming_seenCount = incoming.seenCount;
271
+ // if at least one of these optionals is defined
272
+ if (existing_seenCount !== undefined || incoming_seenCount !== undefined) {
273
+ // if one of these is not defined we know the other is defined and therefore
274
+ // not equal
275
+ if (existing_seenCount === undefined || incoming_seenCount === undefined) {
276
+ return false;
277
+ }
278
+ if (!(existing_seenCount === incoming_seenCount)) {
279
+ return false;
280
+ }
281
+ }
282
+ const existing_stepCount = existing.stepCount;
283
+ const incoming_stepCount = incoming.stepCount;
284
+ // if at least one of these optionals is defined
285
+ if (existing_stepCount !== undefined || incoming_stepCount !== undefined) {
286
+ // if one of these is not defined we know the other is defined and therefore
287
+ // not equal
288
+ if (existing_stepCount === undefined || incoming_stepCount === undefined) {
289
+ return false;
290
+ }
291
+ if (!(existing_stepCount === incoming_stepCount)) {
292
+ return false;
293
+ }
294
+ }
295
+ const existing_lastSeen = existing.lastSeen;
296
+ const incoming_lastSeen = incoming.lastSeen;
297
+ // if at least one of these optionals is defined
298
+ if (existing_lastSeen !== undefined || incoming_lastSeen !== undefined) {
299
+ // if one of these is not defined we know the other is defined and therefore
300
+ // not equal
301
+ if (existing_lastSeen === undefined || incoming_lastSeen === undefined) {
302
+ return false;
303
+ }
304
+ if (!(existing_lastSeen === incoming_lastSeen)) {
305
+ return false;
306
+ }
307
+ }
308
+ const existing_engagement = existing.engagement;
309
+ const incoming_engagement = incoming.engagement;
310
+ // if at least one of these optionals is defined
311
+ if (existing_engagement !== undefined || incoming_engagement !== undefined) {
312
+ // if one of these is not defined we know the other is defined and therefore
313
+ // not equal
314
+ if (existing_engagement === undefined || incoming_engagement === undefined) {
315
+ return false;
316
+ }
317
+ if (!(equals$4(existing_engagement, incoming_engagement))) {
318
+ return false;
319
+ }
320
+ }
321
+ return true;
322
+ }
323
+
324
+ const VERSION$2 = "9c54ed50f042624537aa1b4fc1bc09f3";
325
+ function validate$3(obj, path = 'YukonNudgeOutputRepresentation') {
326
+ const v_error = (() => {
327
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
328
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
329
+ }
330
+ if (obj.actionState !== undefined) {
331
+ const obj_actionState = obj.actionState;
332
+ const path_actionState = path + '.actionState';
333
+ const referencepath_actionStateValidationError = validate$4(obj_actionState, path_actionState);
334
+ if (referencepath_actionStateValidationError !== null) {
335
+ let message = 'Object doesn\'t match YukonNudgeActionStateRepresentation (at "' + path_actionState + '")\n';
336
+ message += referencepath_actionStateValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
337
+ return new TypeError(message);
338
+ }
339
+ }
340
+ if (obj.contentType !== undefined) {
341
+ const obj_contentType = obj.contentType;
342
+ const path_contentType = path + '.contentType';
343
+ if (typeof obj_contentType !== 'string') {
344
+ return new TypeError('Expected "string" but received "' + typeof obj_contentType + '" (at "' + path_contentType + '")');
345
+ }
346
+ }
347
+ if (obj.endDate !== undefined) {
348
+ const obj_endDate = obj.endDate;
349
+ const path_endDate = path + '.endDate';
350
+ if (typeof obj_endDate !== 'string') {
351
+ return new TypeError('Expected "string" but received "' + typeof obj_endDate + '" (at "' + path_endDate + '")');
352
+ }
353
+ }
354
+ const obj_id = obj.id;
355
+ const path_id = path + '.id';
356
+ if (typeof obj_id !== 'string') {
357
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
358
+ }
359
+ if (obj.metadata !== undefined) {
360
+ const obj_metadata = obj.metadata;
361
+ const path_metadata = path + '.metadata';
362
+ if (typeof obj_metadata !== 'object' || ArrayIsArray(obj_metadata) || obj_metadata === null) {
363
+ return new TypeError('Expected "object" but received "' + typeof obj_metadata + '" (at "' + path_metadata + '")');
364
+ }
365
+ const obj_metadata_keys = ObjectKeys(obj_metadata);
366
+ for (let i = 0; i < obj_metadata_keys.length; i++) {
367
+ const key = obj_metadata_keys[i];
368
+ const obj_metadata_prop = obj_metadata[key];
369
+ const path_metadata_prop = path_metadata + '["' + key + '"]';
370
+ if (obj_metadata_prop === undefined) {
371
+ return new TypeError('Expected "defined" but received "' + typeof obj_metadata_prop + '" (at "' + path_metadata_prop + '")');
372
+ }
373
+ }
374
+ }
375
+ const obj_payload = obj.payload;
376
+ const path_payload = path + '.payload';
377
+ if (typeof obj_payload !== 'object' || ArrayIsArray(obj_payload) || obj_payload === null) {
378
+ return new TypeError('Expected "object" but received "' + typeof obj_payload + '" (at "' + path_payload + '")');
379
+ }
380
+ const obj_payload_keys = ObjectKeys(obj_payload);
381
+ for (let i = 0; i < obj_payload_keys.length; i++) {
382
+ const key = obj_payload_keys[i];
383
+ const obj_payload_prop = obj_payload[key];
384
+ const path_payload_prop = path_payload + '["' + key + '"]';
385
+ if (obj_payload_prop === undefined) {
386
+ return new TypeError('Expected "defined" but received "' + typeof obj_payload_prop + '" (at "' + path_payload_prop + '")');
387
+ }
388
+ }
389
+ if (obj.startDate !== undefined) {
390
+ const obj_startDate = obj.startDate;
391
+ const path_startDate = path + '.startDate';
392
+ if (typeof obj_startDate !== 'string') {
393
+ return new TypeError('Expected "string" but received "' + typeof obj_startDate + '" (at "' + path_startDate + '")');
394
+ }
395
+ }
396
+ })();
397
+ return v_error === undefined ? null : v_error;
398
+ }
399
+ const select$5 = function YukonNudgeOutputRepresentationSelect() {
400
+ const { selections: YukonNudgeActionStateRepresentation__selections, opaque: YukonNudgeActionStateRepresentation__opaque, } = select$6();
401
+ return {
402
+ kind: 'Fragment',
403
+ version: VERSION$2,
404
+ private: [],
405
+ selections: [
406
+ {
407
+ name: 'actionState',
408
+ kind: 'Object',
409
+ selections: YukonNudgeActionStateRepresentation__selections,
410
+ required: false
411
+ },
412
+ {
413
+ name: 'contentType',
414
+ kind: 'Scalar',
415
+ required: false
416
+ },
417
+ {
418
+ name: 'endDate',
419
+ kind: 'Scalar',
420
+ required: false
421
+ },
422
+ {
423
+ name: 'id',
424
+ kind: 'Scalar'
425
+ },
426
+ {
427
+ name: 'metadata',
428
+ kind: 'Object',
429
+ // any
430
+ },
431
+ {
432
+ name: 'payload',
433
+ kind: 'Object',
434
+ // any
435
+ },
436
+ {
437
+ name: 'startDate',
438
+ kind: 'Scalar',
439
+ required: false
440
+ }
441
+ ]
442
+ };
443
+ };
444
+ function equals$2(existing, incoming) {
445
+ const existing_contentType = existing.contentType;
446
+ const incoming_contentType = incoming.contentType;
447
+ // if at least one of these optionals is defined
448
+ if (existing_contentType !== undefined || incoming_contentType !== undefined) {
449
+ // if one of these is not defined we know the other is defined and therefore
450
+ // not equal
451
+ if (existing_contentType === undefined || incoming_contentType === undefined) {
452
+ return false;
453
+ }
454
+ if (!(existing_contentType === incoming_contentType)) {
455
+ return false;
456
+ }
457
+ }
458
+ const existing_endDate = existing.endDate;
459
+ const incoming_endDate = incoming.endDate;
460
+ // if at least one of these optionals is defined
461
+ if (existing_endDate !== undefined || incoming_endDate !== undefined) {
462
+ // if one of these is not defined we know the other is defined and therefore
463
+ // not equal
464
+ if (existing_endDate === undefined || incoming_endDate === undefined) {
465
+ return false;
466
+ }
467
+ if (!(existing_endDate === incoming_endDate)) {
468
+ return false;
469
+ }
470
+ }
471
+ const existing_id = existing.id;
472
+ const incoming_id = incoming.id;
473
+ if (!(existing_id === incoming_id)) {
474
+ return false;
475
+ }
476
+ const existing_startDate = existing.startDate;
477
+ const incoming_startDate = incoming.startDate;
478
+ // if at least one of these optionals is defined
479
+ if (existing_startDate !== undefined || incoming_startDate !== undefined) {
480
+ // if one of these is not defined we know the other is defined and therefore
481
+ // not equal
482
+ if (existing_startDate === undefined || incoming_startDate === undefined) {
483
+ return false;
484
+ }
485
+ if (!(existing_startDate === incoming_startDate)) {
486
+ return false;
487
+ }
488
+ }
489
+ const existing_actionState = existing.actionState;
490
+ const incoming_actionState = incoming.actionState;
491
+ // if at least one of these optionals is defined
492
+ if (existing_actionState !== undefined || incoming_actionState !== undefined) {
493
+ // if one of these is not defined we know the other is defined and therefore
494
+ // not equal
495
+ if (existing_actionState === undefined || incoming_actionState === undefined) {
496
+ return false;
497
+ }
498
+ if (!(equals$3(existing_actionState, incoming_actionState))) {
499
+ return false;
500
+ }
501
+ }
502
+ const existing_metadata = existing.metadata;
503
+ const incoming_metadata = incoming.metadata;
504
+ // if at least one of these optionals is defined
505
+ if (existing_metadata !== undefined || incoming_metadata !== undefined) {
506
+ // if one of these is not defined we know the other is defined and therefore
507
+ // not equal
508
+ if (existing_metadata === undefined || incoming_metadata === undefined) {
509
+ return false;
510
+ }
511
+ const equals_metadata_props = equalsObject(existing_metadata, incoming_metadata, (existing_metadata_prop, incoming_metadata_prop) => {
512
+ if (JSONStringify(incoming_metadata_prop) !== JSONStringify(existing_metadata_prop)) {
513
+ return false;
514
+ }
515
+ });
516
+ if (equals_metadata_props === false) {
517
+ return false;
518
+ }
519
+ }
520
+ const existing_payload = existing.payload;
521
+ const incoming_payload = incoming.payload;
522
+ const equals_payload_props = equalsObject(existing_payload, incoming_payload, (existing_payload_prop, incoming_payload_prop) => {
523
+ if (JSONStringify(incoming_payload_prop) !== JSONStringify(existing_payload_prop)) {
524
+ return false;
525
+ }
526
+ });
527
+ if (equals_payload_props === false) {
528
+ return false;
529
+ }
530
+ return true;
531
+ }
532
+
533
+ const VERSION$1 = "0a118b11a68bdb6eba86bc28ad247dd1";
534
+ function validate$2(obj, path = 'YukonSurfaceNudgesOutputRepresentation') {
535
+ const v_error = (() => {
536
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
537
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
538
+ }
539
+ if (obj.errorMessage !== undefined) {
540
+ const obj_errorMessage = obj.errorMessage;
541
+ const path_errorMessage = path + '.errorMessage';
542
+ if (typeof obj_errorMessage !== 'string') {
543
+ return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
544
+ }
545
+ }
546
+ const obj_nudges = obj.nudges;
547
+ const path_nudges = path + '.nudges';
548
+ if (!ArrayIsArray(obj_nudges)) {
549
+ return new TypeError('Expected "array" but received "' + typeof obj_nudges + '" (at "' + path_nudges + '")');
550
+ }
551
+ for (let i = 0; i < obj_nudges.length; i++) {
552
+ const obj_nudges_item = obj_nudges[i];
553
+ const path_nudges_item = path_nudges + '[' + i + ']';
554
+ const referencepath_nudges_itemValidationError = validate$3(obj_nudges_item, path_nudges_item);
555
+ if (referencepath_nudges_itemValidationError !== null) {
556
+ let message = 'Object doesn\'t match YukonNudgeOutputRepresentation (at "' + path_nudges_item + '")\n';
557
+ message += referencepath_nudges_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
558
+ return new TypeError(message);
559
+ }
560
+ }
561
+ const obj_status = obj.status;
562
+ const path_status = path + '.status';
563
+ if (typeof obj_status !== 'string') {
564
+ return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
565
+ }
566
+ const obj_surface = obj.surface;
567
+ const path_surface = path + '.surface';
568
+ if (typeof obj_surface !== 'string') {
569
+ return new TypeError('Expected "string" but received "' + typeof obj_surface + '" (at "' + path_surface + '")');
570
+ }
571
+ })();
572
+ return v_error === undefined ? null : v_error;
573
+ }
574
+ const RepresentationType$1 = 'YukonSurfaceNudgesOutputRepresentation';
575
+ function keyBuilder$5(luvio, config) {
576
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.surface;
577
+ }
578
+ function keyBuilderFromType$1(luvio, object) {
579
+ const keyParams = {
580
+ surface: object.surface
581
+ };
582
+ return keyBuilder$5(luvio, keyParams);
583
+ }
584
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
585
+ return input;
586
+ }
587
+ const select$4 = function YukonSurfaceNudgesOutputRepresentationSelect() {
588
+ const { selections: YukonNudgeOutputRepresentation__selections, opaque: YukonNudgeOutputRepresentation__opaque, } = select$5();
589
+ return {
590
+ kind: 'Fragment',
591
+ version: VERSION$1,
592
+ private: [],
593
+ selections: [
594
+ {
595
+ name: 'errorMessage',
596
+ kind: 'Scalar',
597
+ required: false
598
+ },
599
+ {
600
+ name: 'nudges',
601
+ kind: 'Object',
602
+ plural: true,
603
+ selections: YukonNudgeOutputRepresentation__selections
604
+ },
605
+ {
606
+ name: 'status',
607
+ kind: 'Scalar'
608
+ },
609
+ {
610
+ name: 'surface',
611
+ kind: 'Scalar'
612
+ }
613
+ ]
614
+ };
615
+ };
616
+ function equals$1(existing, incoming) {
617
+ const existing_errorMessage = existing.errorMessage;
618
+ const incoming_errorMessage = incoming.errorMessage;
619
+ // if at least one of these optionals is defined
620
+ if (existing_errorMessage !== undefined || incoming_errorMessage !== undefined) {
621
+ // if one of these is not defined we know the other is defined and therefore
622
+ // not equal
623
+ if (existing_errorMessage === undefined || incoming_errorMessage === undefined) {
624
+ return false;
625
+ }
626
+ if (!(existing_errorMessage === incoming_errorMessage)) {
627
+ return false;
628
+ }
629
+ }
630
+ const existing_status = existing.status;
631
+ const incoming_status = incoming.status;
632
+ if (!(existing_status === incoming_status)) {
633
+ return false;
634
+ }
635
+ const existing_surface = existing.surface;
636
+ const incoming_surface = incoming.surface;
637
+ if (!(existing_surface === incoming_surface)) {
638
+ return false;
639
+ }
640
+ const existing_nudges = existing.nudges;
641
+ const incoming_nudges = incoming.nudges;
642
+ const equals_nudges_items = equalsArray(existing_nudges, incoming_nudges, (existing_nudges_item, incoming_nudges_item) => {
643
+ if (!(equals$2(existing_nudges_item, incoming_nudges_item))) {
644
+ return false;
645
+ }
646
+ });
647
+ if (equals_nudges_items === false) {
648
+ return false;
649
+ }
650
+ return true;
651
+ }
652
+ const ingest$1 = function YukonSurfaceNudgesOutputRepresentationIngest(input, path, luvio, store, timestamp) {
653
+ if (process.env.NODE_ENV !== 'production') {
654
+ const validateError = validate$2(input);
655
+ if (validateError !== null) {
656
+ throw validateError;
657
+ }
658
+ }
659
+ const key = keyBuilderFromType$1(luvio, input);
660
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 30000;
661
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "Yukon", VERSION$1, RepresentationType$1, equals$1);
662
+ return createLink(key);
663
+ };
664
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
665
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
666
+ const rootKey = keyBuilderFromType$1(luvio, input);
667
+ rootKeySet.set(rootKey, {
668
+ namespace: keyPrefix,
669
+ representationName: RepresentationType$1,
670
+ mergeable: false
671
+ });
672
+ }
673
+
674
+ function select$3(luvio, params) {
675
+ return select$4();
676
+ }
677
+ function keyBuilder$4(luvio, params) {
678
+ return keyBuilder$5(luvio, {
679
+ surface: params.urlParams.surfaceId
680
+ });
681
+ }
682
+ function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
683
+ getTypeCacheKeys$1(storeKeyMap, luvio, response);
684
+ }
685
+ function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
686
+ const { body } = response;
687
+ const key = keyBuilder$4(luvio, resourceParams);
688
+ luvio.storeIngest(key, ingest$1, body);
689
+ const snapshot = luvio.storeLookup({
690
+ recordId: key,
691
+ node: select$3(),
692
+ variables: {},
693
+ }, snapshotRefresh);
694
+ if (process.env.NODE_ENV !== 'production') {
695
+ if (snapshot.state !== 'Fulfilled') {
696
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
697
+ }
698
+ }
699
+ deepFreeze(snapshot.data);
700
+ return snapshot;
701
+ }
702
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
703
+ const key = keyBuilder$4(luvio, params);
704
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
705
+ luvio.storeIngestError(key, errorSnapshot);
706
+ return errorSnapshot;
707
+ }
708
+ function createResourceRequest$2(config) {
709
+ const headers = {};
710
+ return {
711
+ baseUri: '/services/data/v66.0',
712
+ basePath: '/yukon/surfaces/' + config.urlParams.surfaceId + '/nudges',
713
+ method: 'get',
714
+ body: null,
715
+ urlParams: config.urlParams,
716
+ queryParams: {},
717
+ headers,
718
+ priority: 'normal',
719
+ };
720
+ }
721
+ function createResourceRequestFromRepresentation$1(representation) {
722
+ const config = {
723
+ urlParams: {},
724
+ };
725
+ config.urlParams.surfaceId = representation.surface;
726
+ return createResourceRequest$2(config);
727
+ }
728
+
729
+ const adapterName$2 = 'getYukonSurfaceNudges';
730
+ const getYukonSurfaceNudges_ConfigPropertyMetadata = [
731
+ generateParamConfigMetadata('surfaceId', true, 0 /* UrlParameter */, 0 /* String */),
732
+ ];
733
+ const getYukonSurfaceNudges_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getYukonSurfaceNudges_ConfigPropertyMetadata);
734
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(getYukonSurfaceNudges_ConfigPropertyMetadata);
735
+ function keyBuilder$3(luvio, config) {
736
+ const resourceParams = createResourceParams$2(config);
737
+ return keyBuilder$4(luvio, resourceParams);
738
+ }
739
+ function typeCheckConfig$2(untrustedConfig) {
740
+ const config = {};
741
+ typeCheckConfig$3(untrustedConfig, config, getYukonSurfaceNudges_ConfigPropertyMetadata);
742
+ return config;
743
+ }
744
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
745
+ if (!untrustedIsObject(untrustedConfig)) {
746
+ return null;
747
+ }
748
+ if (process.env.NODE_ENV !== 'production') {
749
+ validateConfig(untrustedConfig, configPropertyNames);
750
+ }
751
+ const config = typeCheckConfig$2(untrustedConfig);
752
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
753
+ return null;
754
+ }
755
+ return config;
756
+ }
757
+ function adapterFragment$1(luvio, config) {
758
+ createResourceParams$2(config);
759
+ return select$3();
760
+ }
761
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
762
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
763
+ config,
764
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
765
+ });
766
+ return luvio.storeBroadcast().then(() => snapshot);
767
+ }
768
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
769
+ const snapshot = ingestError$1(luvio, resourceParams, response, {
770
+ config,
771
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
772
+ });
773
+ return luvio.storeBroadcast().then(() => snapshot);
774
+ }
775
+ function buildNetworkSnapshot$2(luvio, config, options) {
776
+ const resourceParams = createResourceParams$2(config);
777
+ const request = createResourceRequest$2(resourceParams);
778
+ return luvio.dispatchResourceRequest(request, options)
779
+ .then((response) => {
780
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
781
+ const cache = new StoreKeyMap();
782
+ getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
783
+ return cache;
784
+ });
785
+ }, (response) => {
786
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
787
+ });
788
+ }
789
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
790
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
791
+ }
792
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
793
+ const { luvio, config } = context;
794
+ const selector = {
795
+ recordId: keyBuilder$3(luvio, config),
796
+ node: adapterFragment$1(luvio, config),
797
+ variables: {},
798
+ };
799
+ const cacheSnapshot = storeLookup(selector, {
800
+ config,
801
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
802
+ });
803
+ return cacheSnapshot;
804
+ }
805
+ const getYukonSurfaceNudgesAdapterFactory = (luvio) => function Yukon__getYukonSurfaceNudges(untrustedConfig, requestContext) {
806
+ const config = validateAdapterConfig$2(untrustedConfig, getYukonSurfaceNudges_ConfigPropertyNames);
807
+ // Invalid or incomplete config
808
+ if (config === null) {
809
+ return null;
810
+ }
811
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
812
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
813
+ };
814
+ const notifyChangeFactory$1 = (luvio, options) => {
815
+ return function getYukonSurfacesNudgesBySurfaceIdNotifyChange(configs) {
816
+ const keys = configs.map(c => keyBuilder$5(luvio, c));
817
+ luvio.getNotifyChangeStoreEntries(keys).then(entries => {
818
+ for (let i = 0, len = entries.length; i < len; i++) {
819
+ const { key, record: val } = entries[i];
820
+ const refreshRequest = createResourceRequestFromRepresentation$1(val);
821
+ luvio.dispatchResourceRequest(refreshRequest, options)
822
+ .then((response) => {
823
+ return luvio.handleSuccessResponse(() => {
824
+ const { body } = response;
825
+ luvio.storeIngest(key, ingest$1, body);
826
+ return luvio.storeBroadcast();
827
+ }, () => {
828
+ const cache = new StoreKeyMap();
829
+ getTypeCacheKeys$1(cache, luvio, response.body);
830
+ return cache;
831
+ });
832
+ }, (error) => {
833
+ return luvio.handleErrorResponse(() => {
834
+ const errorSnapshot = luvio.errorSnapshot(error);
835
+ luvio.storeIngestError(key, errorSnapshot, undefined);
836
+ return luvio.storeBroadcast().then(() => errorSnapshot);
837
+ });
838
+ });
839
+ }
840
+ });
841
+ };
842
+ };
843
+
844
+ function select$2(luvio, params) {
845
+ return select$4();
846
+ }
847
+ function keyBuilder$2(luvio, params) {
848
+ return keyBuilder$5(luvio, {
849
+ surface: params.urlParams.surfaceId
850
+ });
851
+ }
852
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
853
+ getTypeCacheKeys$1(storeKeyMap, luvio, response);
854
+ }
855
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
856
+ const { body } = response;
857
+ const key = keyBuilder$2(luvio, resourceParams);
858
+ luvio.storeIngest(key, ingest$1, body);
859
+ const snapshot = luvio.storeLookup({
860
+ recordId: key,
861
+ node: select$2(),
862
+ variables: {},
863
+ }, snapshotRefresh);
864
+ if (process.env.NODE_ENV !== 'production') {
865
+ if (snapshot.state !== 'Fulfilled') {
866
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
867
+ }
868
+ }
869
+ deepFreeze(snapshot.data);
870
+ return snapshot;
871
+ }
872
+ function ingestError(luvio, params, error, snapshotRefresh) {
873
+ const key = keyBuilder$2(luvio, params);
874
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
875
+ luvio.storeIngestError(key, errorSnapshot);
876
+ return errorSnapshot;
877
+ }
878
+ function createResourceRequest$1(config) {
879
+ const headers = {};
880
+ return {
881
+ baseUri: '/services/data/v66.0',
882
+ basePath: '/yukon/surfaces/' + config.urlParams.surfaceId + '/nudges/mock',
883
+ method: 'get',
884
+ body: null,
885
+ urlParams: config.urlParams,
886
+ queryParams: config.queryParams,
887
+ headers,
888
+ priority: 'normal',
889
+ };
890
+ }
891
+ function createResourceRequestFromRepresentation(representation) {
892
+ const config = {
893
+ urlParams: {},
894
+ queryParams: {},
895
+ };
896
+ config.urlParams.surfaceId = representation.surface;
897
+ return createResourceRequest$1(config);
898
+ }
899
+
900
+ const adapterName$1 = 'getYukonSurfaceNudgesMock';
901
+ const getYukonSurfaceNudgesMock_ConfigPropertyMetadata = [
902
+ generateParamConfigMetadata('surfaceId', true, 0 /* UrlParameter */, 0 /* String */),
903
+ generateParamConfigMetadata('mockWith', false, 1 /* QueryParameter */, 0 /* String */),
904
+ generateParamConfigMetadata('size', false, 1 /* QueryParameter */, 3 /* Integer */),
905
+ ];
906
+ const getYukonSurfaceNudgesMock_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getYukonSurfaceNudgesMock_ConfigPropertyMetadata);
907
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(getYukonSurfaceNudgesMock_ConfigPropertyMetadata);
908
+ function keyBuilder$1(luvio, config) {
909
+ const resourceParams = createResourceParams$1(config);
910
+ return keyBuilder$2(luvio, resourceParams);
911
+ }
912
+ function typeCheckConfig$1(untrustedConfig) {
913
+ const config = {};
914
+ typeCheckConfig$3(untrustedConfig, config, getYukonSurfaceNudgesMock_ConfigPropertyMetadata);
915
+ return config;
916
+ }
917
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
918
+ if (!untrustedIsObject(untrustedConfig)) {
919
+ return null;
920
+ }
921
+ if (process.env.NODE_ENV !== 'production') {
922
+ validateConfig(untrustedConfig, configPropertyNames);
923
+ }
924
+ const config = typeCheckConfig$1(untrustedConfig);
925
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
926
+ return null;
927
+ }
928
+ return config;
929
+ }
930
+ function adapterFragment(luvio, config) {
931
+ createResourceParams$1(config);
932
+ return select$2();
933
+ }
934
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
935
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
936
+ config,
937
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
938
+ });
939
+ return luvio.storeBroadcast().then(() => snapshot);
940
+ }
941
+ function onFetchResponseError(luvio, config, resourceParams, response) {
942
+ const snapshot = ingestError(luvio, resourceParams, response, {
943
+ config,
944
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
945
+ });
946
+ return luvio.storeBroadcast().then(() => snapshot);
947
+ }
948
+ function buildNetworkSnapshot$1(luvio, config, options) {
949
+ const resourceParams = createResourceParams$1(config);
950
+ const request = createResourceRequest$1(resourceParams);
951
+ return luvio.dispatchResourceRequest(request, options)
952
+ .then((response) => {
953
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
954
+ const cache = new StoreKeyMap();
955
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
956
+ return cache;
957
+ });
958
+ }, (response) => {
959
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
960
+ });
961
+ }
962
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
963
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
964
+ }
965
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
966
+ const { luvio, config } = context;
967
+ const selector = {
968
+ recordId: keyBuilder$1(luvio, config),
969
+ node: adapterFragment(luvio, config),
970
+ variables: {},
971
+ };
972
+ const cacheSnapshot = storeLookup(selector, {
973
+ config,
974
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
975
+ });
976
+ return cacheSnapshot;
977
+ }
978
+ const getYukonSurfaceNudgesMockAdapterFactory = (luvio) => function Yukon__getYukonSurfaceNudgesMock(untrustedConfig, requestContext) {
979
+ const config = validateAdapterConfig$1(untrustedConfig, getYukonSurfaceNudgesMock_ConfigPropertyNames);
980
+ // Invalid or incomplete config
981
+ if (config === null) {
982
+ return null;
983
+ }
984
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
985
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
986
+ };
987
+ const notifyChangeFactory = (luvio, options) => {
988
+ return function getYukonSurfacesNudgesMockBySurfaceIdNotifyChange(configs) {
989
+ const keys = configs.map(c => keyBuilder$5(luvio, c));
990
+ luvio.getNotifyChangeStoreEntries(keys).then(entries => {
991
+ for (let i = 0, len = entries.length; i < len; i++) {
992
+ const { key, record: val } = entries[i];
993
+ const refreshRequest = createResourceRequestFromRepresentation(val);
994
+ luvio.dispatchResourceRequest(refreshRequest, options)
995
+ .then((response) => {
996
+ return luvio.handleSuccessResponse(() => {
997
+ const { body } = response;
998
+ luvio.storeIngest(key, ingest$1, body);
999
+ return luvio.storeBroadcast();
1000
+ }, () => {
1001
+ const cache = new StoreKeyMap();
1002
+ getTypeCacheKeys$1(cache, luvio, response.body);
1003
+ return cache;
1004
+ });
1005
+ }, (error) => {
1006
+ return luvio.handleErrorResponse(() => {
1007
+ const errorSnapshot = luvio.errorSnapshot(error);
1008
+ luvio.storeIngestError(key, errorSnapshot, undefined);
1009
+ return luvio.storeBroadcast().then(() => errorSnapshot);
1010
+ });
1011
+ });
1012
+ }
1013
+ });
1014
+ };
1015
+ };
1016
+
1017
+ function validate$1(obj, path = 'YukonTelemetryInputRepresentation') {
1018
+ const v_error = (() => {
1019
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1020
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1021
+ }
1022
+ const obj_actionType = obj.actionType;
1023
+ const path_actionType = path + '.actionType';
1024
+ if (typeof obj_actionType !== 'string') {
1025
+ return new TypeError('Expected "string" but received "' + typeof obj_actionType + '" (at "' + path_actionType + '")');
1026
+ }
1027
+ const obj_nudgeUniqueName = obj.nudgeUniqueName;
1028
+ const path_nudgeUniqueName = path + '.nudgeUniqueName';
1029
+ if (typeof obj_nudgeUniqueName !== 'string') {
1030
+ return new TypeError('Expected "string" but received "' + typeof obj_nudgeUniqueName + '" (at "' + path_nudgeUniqueName + '")');
1031
+ }
1032
+ obj.timestamp;
1033
+ })();
1034
+ return v_error === undefined ? null : v_error;
1035
+ }
1036
+
1037
+ const VERSION = "e7558ad301657c3ee704a2c236e9f427";
1038
+ function validate(obj, path = 'YukonTelemetryOutputRepresentation') {
1039
+ const v_error = (() => {
1040
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1041
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1042
+ }
1043
+ if (obj.errorMessage !== undefined) {
1044
+ const obj_errorMessage = obj.errorMessage;
1045
+ const path_errorMessage = path + '.errorMessage';
1046
+ if (typeof obj_errorMessage !== 'string') {
1047
+ return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
1048
+ }
1049
+ }
1050
+ const obj_status = obj.status;
1051
+ const path_status = path + '.status';
1052
+ if (typeof obj_status !== 'string') {
1053
+ return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
1054
+ }
1055
+ })();
1056
+ return v_error === undefined ? null : v_error;
1057
+ }
1058
+ const RepresentationType = 'YukonTelemetryOutputRepresentation';
1059
+ function keyBuilder(luvio, config) {
1060
+ return keyPrefix + '::' + RepresentationType + ':' + config.id;
1061
+ }
1062
+ function keyBuilderFromType(luvio, object) {
1063
+ const keyParams = {
1064
+ id: object.status
1065
+ };
1066
+ return keyBuilder(luvio, keyParams);
1067
+ }
1068
+ function normalize(input, existing, path, luvio, store, timestamp) {
1069
+ return input;
1070
+ }
1071
+ const select$1 = function YukonTelemetryOutputRepresentationSelect() {
1072
+ return {
1073
+ kind: 'Fragment',
1074
+ version: VERSION,
1075
+ private: [],
1076
+ selections: [
1077
+ {
1078
+ name: 'errorMessage',
1079
+ kind: 'Scalar',
1080
+ required: false
1081
+ },
1082
+ {
1083
+ name: 'status',
1084
+ kind: 'Scalar'
1085
+ }
1086
+ ]
1087
+ };
1088
+ };
1089
+ function equals(existing, incoming) {
1090
+ const existing_errorMessage = existing.errorMessage;
1091
+ const incoming_errorMessage = incoming.errorMessage;
1092
+ // if at least one of these optionals is defined
1093
+ if (existing_errorMessage !== undefined || incoming_errorMessage !== undefined) {
1094
+ // if one of these is not defined we know the other is defined and therefore
1095
+ // not equal
1096
+ if (existing_errorMessage === undefined || incoming_errorMessage === undefined) {
1097
+ return false;
1098
+ }
1099
+ if (!(existing_errorMessage === incoming_errorMessage)) {
1100
+ return false;
1101
+ }
1102
+ }
1103
+ const existing_status = existing.status;
1104
+ const incoming_status = incoming.status;
1105
+ if (!(existing_status === incoming_status)) {
1106
+ return false;
1107
+ }
1108
+ return true;
1109
+ }
1110
+ const ingest = function YukonTelemetryOutputRepresentationIngest(input, path, luvio, store, timestamp) {
1111
+ if (process.env.NODE_ENV !== 'production') {
1112
+ const validateError = validate(input);
1113
+ if (validateError !== null) {
1114
+ throw validateError;
1115
+ }
1116
+ }
1117
+ const key = keyBuilderFromType(luvio, input);
1118
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 30000;
1119
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "Yukon", VERSION, RepresentationType, equals);
1120
+ return createLink(key);
1121
+ };
1122
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
1123
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1124
+ const rootKey = keyBuilderFromType(luvio, input);
1125
+ rootKeySet.set(rootKey, {
1126
+ namespace: keyPrefix,
1127
+ representationName: RepresentationType,
1128
+ mergeable: false
1129
+ });
1130
+ }
1131
+
1132
+ function select(luvio, params) {
1133
+ return select$1();
1134
+ }
1135
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
1136
+ getTypeCacheKeys(storeKeyMap, luvio, response);
1137
+ }
1138
+ function ingestSuccess(luvio, resourceParams, response) {
1139
+ const { body } = response;
1140
+ const key = keyBuilderFromType(luvio, body);
1141
+ luvio.storeIngest(key, ingest, body);
1142
+ const snapshot = luvio.storeLookup({
1143
+ recordId: key,
1144
+ node: select(),
1145
+ variables: {},
1146
+ });
1147
+ if (process.env.NODE_ENV !== 'production') {
1148
+ if (snapshot.state !== 'Fulfilled') {
1149
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1150
+ }
1151
+ }
1152
+ deepFreeze(snapshot.data);
1153
+ return snapshot;
1154
+ }
1155
+ function createResourceRequest(config) {
1156
+ const headers = {};
1157
+ return {
1158
+ baseUri: '/services/data/v66.0',
1159
+ basePath: '/yukon/telemetry',
1160
+ method: 'post',
1161
+ body: config.body,
1162
+ urlParams: {},
1163
+ queryParams: {},
1164
+ headers,
1165
+ priority: 'normal',
1166
+ };
1167
+ }
1168
+
1169
+ const adapterName = 'postYukonTelemetry';
1170
+ const postYukonTelemetry_ConfigPropertyMetadata = [
1171
+ generateParamConfigMetadata('actions', true, 2 /* Body */, 4 /* Unsupported */, true),
1172
+ ];
1173
+ const postYukonTelemetry_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, postYukonTelemetry_ConfigPropertyMetadata);
1174
+ const createResourceParams = /*#__PURE__*/ createResourceParams$3(postYukonTelemetry_ConfigPropertyMetadata);
1175
+ function typeCheckConfig(untrustedConfig) {
1176
+ const config = {};
1177
+ const untrustedConfig_actions = untrustedConfig.actions;
1178
+ if (ArrayIsArray$1(untrustedConfig_actions)) {
1179
+ const untrustedConfig_actions_array = [];
1180
+ for (let i = 0, arrayLength = untrustedConfig_actions.length; i < arrayLength; i++) {
1181
+ const untrustedConfig_actions_item = untrustedConfig_actions[i];
1182
+ const referenceYukonTelemetryInputRepresentationValidationError = validate$1(untrustedConfig_actions_item);
1183
+ if (referenceYukonTelemetryInputRepresentationValidationError === null) {
1184
+ untrustedConfig_actions_array.push(untrustedConfig_actions_item);
1185
+ }
1186
+ }
1187
+ config.actions = untrustedConfig_actions_array;
1188
+ }
1189
+ return config;
1190
+ }
1191
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
1192
+ if (!untrustedIsObject(untrustedConfig)) {
1193
+ return null;
1194
+ }
1195
+ if (process.env.NODE_ENV !== 'production') {
1196
+ validateConfig(untrustedConfig, configPropertyNames);
1197
+ }
1198
+ const config = typeCheckConfig(untrustedConfig);
1199
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1200
+ return null;
1201
+ }
1202
+ return config;
1203
+ }
1204
+ function buildNetworkSnapshot(luvio, config, options) {
1205
+ const resourceParams = createResourceParams(config);
1206
+ const request = createResourceRequest(resourceParams);
1207
+ return luvio.dispatchResourceRequest(request, options)
1208
+ .then((response) => {
1209
+ return luvio.handleSuccessResponse(() => {
1210
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
1211
+ return luvio.storeBroadcast().then(() => snapshot);
1212
+ }, () => {
1213
+ const cache = new StoreKeyMap();
1214
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
1215
+ return cache;
1216
+ });
1217
+ }, (response) => {
1218
+ deepFreeze(response);
1219
+ throw response;
1220
+ });
1221
+ }
1222
+ const postYukonTelemetryAdapterFactory = (luvio) => {
1223
+ return function postYukonTelemetry(untrustedConfig) {
1224
+ const config = validateAdapterConfig(untrustedConfig, postYukonTelemetry_ConfigPropertyNames);
1225
+ // Invalid or incomplete config
1226
+ if (config === null) {
1227
+ throw new Error('Invalid config for "postYukonTelemetry"');
1228
+ }
1229
+ return buildNetworkSnapshot(luvio, config);
1230
+ };
1231
+ };
1232
+
1233
+ let getYukonSurfaceNudges;
1234
+ let getYukonSurfaceNudgesMock;
1235
+ let getYukonSurfaceNudgesMockNotifyChange;
1236
+ let getYukonSurfaceNudgesNotifyChange;
1237
+ let postYukonTelemetry;
1238
+ // Imperative GET Adapters
1239
+ let getYukonSurfaceNudges_imperative;
1240
+ let getYukonSurfaceNudgesMock_imperative;
1241
+ // Adapter Metadata
1242
+ const getYukonSurfaceNudgesMetadata = { apiFamily: 'Yukon', name: 'getYukonSurfaceNudges' };
1243
+ const getYukonSurfaceNudgesMockMetadata = { apiFamily: 'Yukon', name: 'getYukonSurfaceNudgesMock' };
1244
+ // Notify Update Available
1245
+ function bindExportsTo(luvio) {
1246
+ // LDS Adapters
1247
+ const getYukonSurfaceNudges_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getYukonSurfaceNudges', getYukonSurfaceNudgesAdapterFactory), getYukonSurfaceNudgesMetadata);
1248
+ const getYukonSurfaceNudgesMock_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getYukonSurfaceNudgesMock', getYukonSurfaceNudgesMockAdapterFactory), getYukonSurfaceNudgesMockMetadata);
1249
+ function unwrapSnapshotData(factory) {
1250
+ const adapter = factory(luvio);
1251
+ return (config) => adapter(config).then((snapshot) => snapshot.data);
1252
+ }
1253
+ return {
1254
+ getYukonSurfaceNudges: createWireAdapterConstructor(luvio, getYukonSurfaceNudges_ldsAdapter, getYukonSurfaceNudgesMetadata),
1255
+ getYukonSurfaceNudgesMock: createWireAdapterConstructor(luvio, getYukonSurfaceNudgesMock_ldsAdapter, getYukonSurfaceNudgesMockMetadata),
1256
+ getYukonSurfaceNudgesMockNotifyChange: createLDSAdapter(luvio, 'getYukonSurfaceNudgesMockNotifyChange', notifyChangeFactory),
1257
+ getYukonSurfaceNudgesNotifyChange: createLDSAdapter(luvio, 'getYukonSurfaceNudgesNotifyChange', notifyChangeFactory$1),
1258
+ postYukonTelemetry: unwrapSnapshotData(postYukonTelemetryAdapterFactory),
1259
+ // Imperative GET Adapters
1260
+ getYukonSurfaceNudges_imperative: createImperativeAdapter(luvio, getYukonSurfaceNudges_ldsAdapter, getYukonSurfaceNudgesMetadata),
1261
+ getYukonSurfaceNudgesMock_imperative: createImperativeAdapter(luvio, getYukonSurfaceNudgesMock_ldsAdapter, getYukonSurfaceNudgesMockMetadata),
1262
+ // Notify Update Availables
1263
+ };
1264
+ }
1265
+ withDefaultLuvio((luvio) => {
1266
+ ({
1267
+ getYukonSurfaceNudges,
1268
+ getYukonSurfaceNudgesMock,
1269
+ getYukonSurfaceNudgesMockNotifyChange,
1270
+ getYukonSurfaceNudgesNotifyChange,
1271
+ postYukonTelemetry,
1272
+ getYukonSurfaceNudges_imperative,
1273
+ getYukonSurfaceNudgesMock_imperative,
1274
+ } = bindExportsTo(luvio));
1275
+ });
1276
+
1277
+ export { getYukonSurfaceNudges, getYukonSurfaceNudgesMock, getYukonSurfaceNudgesMockNotifyChange, getYukonSurfaceNudgesMock_imperative, getYukonSurfaceNudgesNotifyChange, getYukonSurfaceNudges_imperative, postYukonTelemetry };
1278
+ // version: 0.1.0-dev1-c978a7b010