@salesforce/lds-adapters-service-salesforcejourney 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 (48) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/service-salesforcejourney.js +3495 -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/createContactUsLeadRequest.d.ts +17 -0
  5. package/dist/es/es2018/types/src/generated/adapters/getCapabilities.d.ts +29 -0
  6. package/dist/es/es2018/types/src/generated/adapters/getCapabilityContentDocument.d.ts +27 -0
  7. package/dist/es/es2018/types/src/generated/adapters/getCapabilitySearchResult.d.ts +28 -0
  8. package/dist/es/es2018/types/src/generated/adapters/getCategoriesMetadata.d.ts +27 -0
  9. package/dist/es/es2018/types/src/generated/adapters/getInitiatives.d.ts +29 -0
  10. package/dist/es/es2018/types/src/generated/adapters/getJourneyMapMetadata.d.ts +27 -0
  11. package/dist/es/es2018/types/src/generated/adapters/upsertCapabilityUserPreference.d.ts +20 -0
  12. package/dist/es/es2018/types/src/generated/adapters/upsertInitiativeUserPreference.d.ts +18 -0
  13. package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +9 -0
  14. package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +16 -0
  15. package/dist/es/es2018/types/src/generated/resources/getConnectSalesforceJourneyCapabilityContentByCapabilityContentId.d.ts +15 -0
  16. package/dist/es/es2018/types/src/generated/resources/getConnectSalesforceJourneyCapabilitySearchByCloudOwnership.d.ts +18 -0
  17. package/dist/es/es2018/types/src/generated/resources/getConnectSalesforceJourneyCategoriesByCloudOwnership.d.ts +15 -0
  18. package/dist/es/es2018/types/src/generated/resources/getConnectSalesforceJourneyJourneyMapMetadataByCloudOwnership.d.ts +15 -0
  19. package/dist/es/es2018/types/src/generated/resources/postConnectSalesforceJourneyCapabilitiesByCloudOwnership.d.ts +19 -0
  20. package/dist/es/es2018/types/src/generated/resources/postConnectSalesforceJourneyCapabilityUserPreference.d.ts +17 -0
  21. package/dist/es/es2018/types/src/generated/resources/postConnectSalesforceJourneyContactUs.d.ts +14 -0
  22. package/dist/es/es2018/types/src/generated/resources/postConnectSalesforceJourneyJourneyMapInitiativesByCloudOwnership.d.ts +19 -0
  23. package/dist/es/es2018/types/src/generated/resources/postConnectSalesforceJourneyJourneyMapInitiativesUserPreference.d.ts +15 -0
  24. package/dist/es/es2018/types/src/generated/types/CapabilitiesCollectionOutputRepresentation.d.ts +38 -0
  25. package/dist/es/es2018/types/src/generated/types/CapabilityContactUsInputRepresentation.d.ts +34 -0
  26. package/dist/es/es2018/types/src/generated/types/CapabilityContactUsOutputRepresentation.d.ts +38 -0
  27. package/dist/es/es2018/types/src/generated/types/CapabilityContentOutputRepresentation.d.ts +82 -0
  28. package/dist/es/es2018/types/src/generated/types/CapabilityOutputRepresentation.d.ts +58 -0
  29. package/dist/es/es2018/types/src/generated/types/CapabilitySearchInputRepresentation.d.ts +28 -0
  30. package/dist/es/es2018/types/src/generated/types/CapabilitySearchResultOutputRepresentation.d.ts +28 -0
  31. package/dist/es/es2018/types/src/generated/types/CapabilityUserPreferenceInputRepresentation.d.ts +43 -0
  32. package/dist/es/es2018/types/src/generated/types/CategoriesMetadataOutputRepresentation.d.ts +45 -0
  33. package/dist/es/es2018/types/src/generated/types/CategoryTreeNodeOutputRepresentation.d.ts +34 -0
  34. package/dist/es/es2018/types/src/generated/types/FilterConditionCollectionInputRepresentation.d.ts +29 -0
  35. package/dist/es/es2018/types/src/generated/types/FilterConditionInputRepresentation.d.ts +31 -0
  36. package/dist/es/es2018/types/src/generated/types/InitiativeOutputRepresentation.d.ts +61 -0
  37. package/dist/es/es2018/types/src/generated/types/InitiativeUserPreferenceInputRepresentation.d.ts +37 -0
  38. package/dist/es/es2018/types/src/generated/types/InitiativesCollectionOutputRepresentation.d.ts +38 -0
  39. package/dist/es/es2018/types/src/generated/types/JourneyMapMetadataOutputRepresentation.d.ts +38 -0
  40. package/dist/es/es2018/types/src/generated/types/MyCapabilityOutputRepresentation.d.ts +52 -0
  41. package/dist/es/es2018/types/src/generated/types/MyInitiativeOutputRepresentation.d.ts +46 -0
  42. package/dist/es/es2018/types/src/generated/types/TermOutputRepresentation.d.ts +31 -0
  43. package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
  44. package/package.json +68 -0
  45. package/sfdc/index.d.ts +1 -0
  46. package/sfdc/index.js +3593 -0
  47. package/src/raml/api.raml +554 -0
  48. package/src/raml/luvio.raml +61 -0
package/sfdc/index.js ADDED
@@ -0,0 +1,3593 @@
1
+ /**
2
+ * Copyright (c) 2022, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ /*
8
+ * ATTENTION!
9
+ * THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
10
+ * If you would like to contribute to LDS, please follow the steps outlined in the git repo.
11
+ * Any changes made to this file in p4 will be automatically overwritten.
12
+ * *******************************************************************************************
13
+ */
14
+ /* proxy-compat-disable */
15
+ import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
16
+ import { withDefaultLuvio } from 'force/ldsEngine';
17
+ import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$9, typeCheckConfig as typeCheckConfig$9, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$6 } 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 = 'salesforceJourney';
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 TTL = 100;
126
+ const VERSION$c = "191aae5d435797bc27fc428e7485cf77";
127
+ function validate$d(obj, path = 'CapabilityContactUsOutputRepresentation') {
128
+ const v_error = (() => {
129
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
130
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
131
+ }
132
+ const obj_isSuccess = obj.isSuccess;
133
+ const path_isSuccess = path + '.isSuccess';
134
+ if (typeof obj_isSuccess !== 'boolean') {
135
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
136
+ }
137
+ })();
138
+ return v_error === undefined ? null : v_error;
139
+ }
140
+ const RepresentationType$a = 'CapabilityContactUsOutputRepresentation';
141
+ function keyBuilder$e(luvio, config) {
142
+ return keyPrefix + '::' + RepresentationType$a + ':' + config.isSuccess;
143
+ }
144
+ function keyBuilderFromType$2(luvio, object) {
145
+ const keyParams = {
146
+ isSuccess: object.isSuccess
147
+ };
148
+ return keyBuilder$e(luvio, keyParams);
149
+ }
150
+ function normalize$a(input, existing, path, luvio, store, timestamp) {
151
+ return input;
152
+ }
153
+ const select$l = function CapabilityContactUsOutputRepresentationSelect() {
154
+ return {
155
+ kind: 'Fragment',
156
+ version: VERSION$c,
157
+ private: [],
158
+ selections: [
159
+ {
160
+ name: 'isSuccess',
161
+ kind: 'Scalar'
162
+ }
163
+ ]
164
+ };
165
+ };
166
+ function equals$c(existing, incoming) {
167
+ const existing_isSuccess = existing.isSuccess;
168
+ const incoming_isSuccess = incoming.isSuccess;
169
+ if (!(existing_isSuccess === incoming_isSuccess)) {
170
+ return false;
171
+ }
172
+ return true;
173
+ }
174
+ const ingest$a = function CapabilityContactUsOutputRepresentationIngest(input, path, luvio, store, timestamp) {
175
+ if (process.env.NODE_ENV !== 'production') {
176
+ const validateError = validate$d(input);
177
+ if (validateError !== null) {
178
+ throw validateError;
179
+ }
180
+ }
181
+ const key = keyBuilderFromType$2(luvio, input);
182
+ const ttlToUse = TTL;
183
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$a, "salesforceJourney", VERSION$c, RepresentationType$a, equals$c);
184
+ return createLink(key);
185
+ };
186
+ function getTypeCacheKeys$a(rootKeySet, luvio, input, fullPathFactory) {
187
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
188
+ const rootKey = keyBuilderFromType$2(luvio, input);
189
+ rootKeySet.set(rootKey, {
190
+ namespace: keyPrefix,
191
+ representationName: RepresentationType$a,
192
+ mergeable: false
193
+ });
194
+ }
195
+
196
+ function select$k(luvio, params) {
197
+ return select$l();
198
+ }
199
+ function getResponseCacheKeys$8(storeKeyMap, luvio, resourceParams, response) {
200
+ getTypeCacheKeys$a(storeKeyMap, luvio, response);
201
+ }
202
+ function ingestSuccess$8(luvio, resourceParams, response) {
203
+ const { body } = response;
204
+ const key = keyBuilderFromType$2(luvio, body);
205
+ luvio.storeIngest(key, ingest$a, body);
206
+ const snapshot = luvio.storeLookup({
207
+ recordId: key,
208
+ node: select$k(),
209
+ variables: {},
210
+ });
211
+ if (process.env.NODE_ENV !== 'production') {
212
+ if (snapshot.state !== 'Fulfilled') {
213
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
214
+ }
215
+ }
216
+ deepFreeze(snapshot.data);
217
+ return snapshot;
218
+ }
219
+ function createResourceRequest$8(config) {
220
+ const headers = {};
221
+ return {
222
+ baseUri: '/services/data/v66.0',
223
+ basePath: '/connect/salesforce-journey/contact-us',
224
+ method: 'post',
225
+ body: config.body,
226
+ urlParams: {},
227
+ queryParams: {},
228
+ headers,
229
+ priority: 'normal',
230
+ };
231
+ }
232
+
233
+ const adapterName$8 = 'createContactUsLeadRequest';
234
+ const createContactUsLeadRequest_ConfigPropertyMetadata = [
235
+ generateParamConfigMetadata('capabilityId', true, 2 /* Body */, 0 /* String */),
236
+ generateParamConfigMetadata('notes', true, 2 /* Body */, 0 /* String */),
237
+ generateParamConfigMetadata('reason', true, 2 /* Body */, 0 /* String */),
238
+ ];
239
+ const createContactUsLeadRequest_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$8, createContactUsLeadRequest_ConfigPropertyMetadata);
240
+ const createResourceParams$8 = /*#__PURE__*/ createResourceParams$9(createContactUsLeadRequest_ConfigPropertyMetadata);
241
+ function typeCheckConfig$8(untrustedConfig) {
242
+ const config = {};
243
+ typeCheckConfig$9(untrustedConfig, config, createContactUsLeadRequest_ConfigPropertyMetadata);
244
+ return config;
245
+ }
246
+ function validateAdapterConfig$8(untrustedConfig, configPropertyNames) {
247
+ if (!untrustedIsObject(untrustedConfig)) {
248
+ return null;
249
+ }
250
+ if (process.env.NODE_ENV !== 'production') {
251
+ validateConfig(untrustedConfig, configPropertyNames);
252
+ }
253
+ const config = typeCheckConfig$8(untrustedConfig);
254
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
255
+ return null;
256
+ }
257
+ return config;
258
+ }
259
+ function buildNetworkSnapshot$8(luvio, config, options) {
260
+ const resourceParams = createResourceParams$8(config);
261
+ const request = createResourceRequest$8(resourceParams);
262
+ return luvio.dispatchResourceRequest(request, options)
263
+ .then((response) => {
264
+ return luvio.handleSuccessResponse(() => {
265
+ const snapshot = ingestSuccess$8(luvio, resourceParams, response);
266
+ return luvio.storeBroadcast().then(() => snapshot);
267
+ }, () => {
268
+ const cache = new StoreKeyMap();
269
+ getResponseCacheKeys$8(cache, luvio, resourceParams, response.body);
270
+ return cache;
271
+ });
272
+ }, (response) => {
273
+ deepFreeze(response);
274
+ throw response;
275
+ });
276
+ }
277
+ const createContactUsLeadRequestAdapterFactory = (luvio) => {
278
+ return function createContactUsLeadRequest(untrustedConfig) {
279
+ const config = validateAdapterConfig$8(untrustedConfig, createContactUsLeadRequest_ConfigPropertyNames);
280
+ // Invalid or incomplete config
281
+ if (config === null) {
282
+ throw new Error('Invalid config for "createContactUsLeadRequest"');
283
+ }
284
+ return buildNetworkSnapshot$8(luvio, config);
285
+ };
286
+ };
287
+
288
+ function validate$c(obj, path = 'FilterConditionInputRepresentation') {
289
+ const v_error = (() => {
290
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
291
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
292
+ }
293
+ const obj_filterType = obj.filterType;
294
+ const path_filterType = path + '.filterType';
295
+ if (typeof obj_filterType !== 'string') {
296
+ return new TypeError('Expected "string" but received "' + typeof obj_filterType + '" (at "' + path_filterType + '")');
297
+ }
298
+ const obj_values = obj.values;
299
+ const path_values = path + '.values';
300
+ if (!ArrayIsArray(obj_values)) {
301
+ return new TypeError('Expected "array" but received "' + typeof obj_values + '" (at "' + path_values + '")');
302
+ }
303
+ for (let i = 0; i < obj_values.length; i++) {
304
+ const obj_values_item = obj_values[i];
305
+ const path_values_item = path_values + '[' + i + ']';
306
+ if (typeof obj_values_item !== 'string') {
307
+ return new TypeError('Expected "string" but received "' + typeof obj_values_item + '" (at "' + path_values_item + '")');
308
+ }
309
+ }
310
+ })();
311
+ return v_error === undefined ? null : v_error;
312
+ }
313
+
314
+ const VERSION$b = "74d02ec7765d64e9cc3b496335a46435";
315
+ function validate$b(obj, path = 'TermOutputRepresentation') {
316
+ const v_error = (() => {
317
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
318
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
319
+ }
320
+ const obj_label = obj.label;
321
+ const path_label = path + '.label';
322
+ let obj_label_union0 = null;
323
+ const obj_label_union0_error = (() => {
324
+ if (typeof obj_label !== 'string') {
325
+ return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
326
+ }
327
+ })();
328
+ if (obj_label_union0_error != null) {
329
+ obj_label_union0 = obj_label_union0_error.message;
330
+ }
331
+ let obj_label_union1 = null;
332
+ const obj_label_union1_error = (() => {
333
+ if (obj_label !== null) {
334
+ return new TypeError('Expected "null" but received "' + typeof obj_label + '" (at "' + path_label + '")');
335
+ }
336
+ })();
337
+ if (obj_label_union1_error != null) {
338
+ obj_label_union1 = obj_label_union1_error.message;
339
+ }
340
+ if (obj_label_union0 && obj_label_union1) {
341
+ let message = 'Object doesn\'t match union (at "' + path_label + '")';
342
+ message += '\n' + obj_label_union0.split('\n').map((line) => '\t' + line).join('\n');
343
+ message += '\n' + obj_label_union1.split('\n').map((line) => '\t' + line).join('\n');
344
+ return new TypeError(message);
345
+ }
346
+ const obj_value = obj.value;
347
+ const path_value = path + '.value';
348
+ if (typeof obj_value !== 'string') {
349
+ return new TypeError('Expected "string" but received "' + typeof obj_value + '" (at "' + path_value + '")');
350
+ }
351
+ })();
352
+ return v_error === undefined ? null : v_error;
353
+ }
354
+ const select$j = function TermOutputRepresentationSelect() {
355
+ return {
356
+ kind: 'Fragment',
357
+ version: VERSION$b,
358
+ private: [],
359
+ selections: [
360
+ {
361
+ name: 'label',
362
+ kind: 'Scalar'
363
+ },
364
+ {
365
+ name: 'value',
366
+ kind: 'Scalar'
367
+ }
368
+ ]
369
+ };
370
+ };
371
+ function equals$b(existing, incoming) {
372
+ const existing_value = existing.value;
373
+ const incoming_value = incoming.value;
374
+ if (!(existing_value === incoming_value)) {
375
+ return false;
376
+ }
377
+ const existing_label = existing.label;
378
+ const incoming_label = incoming.label;
379
+ if (!(existing_label === incoming_label)) {
380
+ return false;
381
+ }
382
+ return true;
383
+ }
384
+
385
+ const VERSION$a = "00ce1551ead91d6323ff2e7e11a457af";
386
+ function validate$a(obj, path = 'CategoryTreeNodeOutputRepresentation') {
387
+ const v_error = (() => {
388
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
389
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
390
+ }
391
+ const obj_children = obj.children;
392
+ const path_children = path + '.children';
393
+ if (!ArrayIsArray(obj_children)) {
394
+ return new TypeError('Expected "array" but received "' + typeof obj_children + '" (at "' + path_children + '")');
395
+ }
396
+ for (let i = 0; i < obj_children.length; i++) {
397
+ const obj_children_item = obj_children[i];
398
+ const path_children_item = path_children + '[' + i + ']';
399
+ if (obj_children_item === undefined) {
400
+ return new TypeError('Expected "defined" but received "' + typeof obj_children_item + '" (at "' + path_children_item + '")');
401
+ }
402
+ }
403
+ const obj_parents = obj.parents;
404
+ const path_parents = path + '.parents';
405
+ if (!ArrayIsArray(obj_parents)) {
406
+ return new TypeError('Expected "array" but received "' + typeof obj_parents + '" (at "' + path_parents + '")');
407
+ }
408
+ for (let i = 0; i < obj_parents.length; i++) {
409
+ const obj_parents_item = obj_parents[i];
410
+ const path_parents_item = path_parents + '[' + i + ']';
411
+ if (obj_parents_item === undefined) {
412
+ return new TypeError('Expected "defined" but received "' + typeof obj_parents_item + '" (at "' + path_parents_item + '")');
413
+ }
414
+ }
415
+ const obj_term = obj.term;
416
+ const path_term = path + '.term';
417
+ const referencepath_termValidationError = validate$b(obj_term, path_term);
418
+ if (referencepath_termValidationError !== null) {
419
+ let message = 'Object doesn\'t match TermOutputRepresentation (at "' + path_term + '")\n';
420
+ message += referencepath_termValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
421
+ return new TypeError(message);
422
+ }
423
+ })();
424
+ return v_error === undefined ? null : v_error;
425
+ }
426
+ const select$i = function CategoryTreeNodeOutputRepresentationSelect() {
427
+ const { selections: TermOutputRepresentation__selections, opaque: TermOutputRepresentation__opaque, } = select$j();
428
+ return {
429
+ kind: 'Fragment',
430
+ version: VERSION$a,
431
+ private: [],
432
+ selections: [
433
+ {
434
+ name: 'children',
435
+ kind: 'Object',
436
+ // any
437
+ },
438
+ {
439
+ name: 'parents',
440
+ kind: 'Object',
441
+ // any
442
+ },
443
+ {
444
+ name: 'term',
445
+ kind: 'Object',
446
+ selections: TermOutputRepresentation__selections
447
+ }
448
+ ]
449
+ };
450
+ };
451
+ function equals$a(existing, incoming) {
452
+ const existing_children = existing.children;
453
+ const incoming_children = incoming.children;
454
+ const equals_children_items = equalsArray(existing_children, incoming_children, (existing_children_item, incoming_children_item) => {
455
+ if (JSONStringify(incoming_children_item) !== JSONStringify(existing_children_item)) {
456
+ return false;
457
+ }
458
+ });
459
+ if (equals_children_items === false) {
460
+ return false;
461
+ }
462
+ const existing_parents = existing.parents;
463
+ const incoming_parents = incoming.parents;
464
+ const equals_parents_items = equalsArray(existing_parents, incoming_parents, (existing_parents_item, incoming_parents_item) => {
465
+ if (JSONStringify(incoming_parents_item) !== JSONStringify(existing_parents_item)) {
466
+ return false;
467
+ }
468
+ });
469
+ if (equals_parents_items === false) {
470
+ return false;
471
+ }
472
+ const existing_term = existing.term;
473
+ const incoming_term = incoming.term;
474
+ if (!(equals$b(existing_term, incoming_term))) {
475
+ return false;
476
+ }
477
+ return true;
478
+ }
479
+
480
+ const VERSION$9 = "0a964d4e5258861ae7e70daf7d878af8";
481
+ function validate$9(obj, path = 'MyCapabilityOutputRepresentation') {
482
+ const v_error = (() => {
483
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
484
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
485
+ }
486
+ const obj_contentDurableId = obj.contentDurableId;
487
+ const path_contentDurableId = path + '.contentDurableId';
488
+ if (typeof obj_contentDurableId !== 'string') {
489
+ return new TypeError('Expected "string" but received "' + typeof obj_contentDurableId + '" (at "' + path_contentDurableId + '")');
490
+ }
491
+ const obj_id = obj.id;
492
+ const path_id = path + '.id';
493
+ if (typeof obj_id !== 'string') {
494
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
495
+ }
496
+ const obj_lastContactRequestDate = obj.lastContactRequestDate;
497
+ const path_lastContactRequestDate = path + '.lastContactRequestDate';
498
+ let obj_lastContactRequestDate_union0 = null;
499
+ const obj_lastContactRequestDate_union0_error = (() => {
500
+ if (typeof obj_lastContactRequestDate !== 'string') {
501
+ return new TypeError('Expected "string" but received "' + typeof obj_lastContactRequestDate + '" (at "' + path_lastContactRequestDate + '")');
502
+ }
503
+ })();
504
+ if (obj_lastContactRequestDate_union0_error != null) {
505
+ obj_lastContactRequestDate_union0 = obj_lastContactRequestDate_union0_error.message;
506
+ }
507
+ let obj_lastContactRequestDate_union1 = null;
508
+ const obj_lastContactRequestDate_union1_error = (() => {
509
+ if (obj_lastContactRequestDate !== null) {
510
+ return new TypeError('Expected "null" but received "' + typeof obj_lastContactRequestDate + '" (at "' + path_lastContactRequestDate + '")');
511
+ }
512
+ })();
513
+ if (obj_lastContactRequestDate_union1_error != null) {
514
+ obj_lastContactRequestDate_union1 = obj_lastContactRequestDate_union1_error.message;
515
+ }
516
+ if (obj_lastContactRequestDate_union0 && obj_lastContactRequestDate_union1) {
517
+ let message = 'Object doesn\'t match union (at "' + path_lastContactRequestDate + '")';
518
+ message += '\n' + obj_lastContactRequestDate_union0.split('\n').map((line) => '\t' + line).join('\n');
519
+ message += '\n' + obj_lastContactRequestDate_union1.split('\n').map((line) => '\t' + line).join('\n');
520
+ return new TypeError(message);
521
+ }
522
+ const obj_stage = obj.stage;
523
+ const path_stage = path + '.stage';
524
+ if (typeof obj_stage !== 'string') {
525
+ return new TypeError('Expected "string" but received "' + typeof obj_stage + '" (at "' + path_stage + '")');
526
+ }
527
+ const obj_starred = obj.starred;
528
+ const path_starred = path + '.starred';
529
+ if (typeof obj_starred !== 'boolean') {
530
+ return new TypeError('Expected "boolean" but received "' + typeof obj_starred + '" (at "' + path_starred + '")');
531
+ }
532
+ const obj_status = obj.status;
533
+ const path_status = path + '.status';
534
+ if (typeof obj_status !== 'string') {
535
+ return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
536
+ }
537
+ })();
538
+ return v_error === undefined ? null : v_error;
539
+ }
540
+ const RepresentationType$9 = 'MyCapabilityOutputRepresentation';
541
+ function keyBuilder$d(luvio, config) {
542
+ return keyPrefix + '::' + RepresentationType$9 + ':' + config.id;
543
+ }
544
+ function keyBuilderFromType$1(luvio, object) {
545
+ const keyParams = {
546
+ id: object.id
547
+ };
548
+ return keyBuilder$d(luvio, keyParams);
549
+ }
550
+ function normalize$9(input, existing, path, luvio, store, timestamp) {
551
+ return input;
552
+ }
553
+ const select$h = function MyCapabilityOutputRepresentationSelect() {
554
+ return {
555
+ kind: 'Fragment',
556
+ version: VERSION$9,
557
+ private: [],
558
+ selections: [
559
+ {
560
+ name: 'contentDurableId',
561
+ kind: 'Scalar'
562
+ },
563
+ {
564
+ name: 'id',
565
+ kind: 'Scalar'
566
+ },
567
+ {
568
+ name: 'lastContactRequestDate',
569
+ kind: 'Scalar'
570
+ },
571
+ {
572
+ name: 'stage',
573
+ kind: 'Scalar'
574
+ },
575
+ {
576
+ name: 'starred',
577
+ kind: 'Scalar'
578
+ },
579
+ {
580
+ name: 'status',
581
+ kind: 'Scalar'
582
+ }
583
+ ]
584
+ };
585
+ };
586
+ function equals$9(existing, incoming) {
587
+ const existing_starred = existing.starred;
588
+ const incoming_starred = incoming.starred;
589
+ if (!(existing_starred === incoming_starred)) {
590
+ return false;
591
+ }
592
+ const existing_contentDurableId = existing.contentDurableId;
593
+ const incoming_contentDurableId = incoming.contentDurableId;
594
+ if (!(existing_contentDurableId === incoming_contentDurableId)) {
595
+ return false;
596
+ }
597
+ const existing_id = existing.id;
598
+ const incoming_id = incoming.id;
599
+ if (!(existing_id === incoming_id)) {
600
+ return false;
601
+ }
602
+ const existing_stage = existing.stage;
603
+ const incoming_stage = incoming.stage;
604
+ if (!(existing_stage === incoming_stage)) {
605
+ return false;
606
+ }
607
+ const existing_status = existing.status;
608
+ const incoming_status = incoming.status;
609
+ if (!(existing_status === incoming_status)) {
610
+ return false;
611
+ }
612
+ const existing_lastContactRequestDate = existing.lastContactRequestDate;
613
+ const incoming_lastContactRequestDate = incoming.lastContactRequestDate;
614
+ if (!(existing_lastContactRequestDate === incoming_lastContactRequestDate)) {
615
+ return false;
616
+ }
617
+ return true;
618
+ }
619
+ const ingest$9 = function MyCapabilityOutputRepresentationIngest(input, path, luvio, store, timestamp) {
620
+ if (process.env.NODE_ENV !== 'production') {
621
+ const validateError = validate$9(input);
622
+ if (validateError !== null) {
623
+ throw validateError;
624
+ }
625
+ }
626
+ const key = keyBuilderFromType$1(luvio, input);
627
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 200;
628
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$9, "salesforceJourney", VERSION$9, RepresentationType$9, equals$9);
629
+ return createLink(key);
630
+ };
631
+ function getTypeCacheKeys$9(rootKeySet, luvio, input, fullPathFactory) {
632
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
633
+ const rootKey = keyBuilderFromType$1(luvio, input);
634
+ rootKeySet.set(rootKey, {
635
+ namespace: keyPrefix,
636
+ representationName: RepresentationType$9,
637
+ mergeable: false
638
+ });
639
+ }
640
+
641
+ const VERSION$8 = "942087683d30f79257141b2153ac8bbf";
642
+ function validate$8(obj, path = 'CapabilityOutputRepresentation') {
643
+ const v_error = (() => {
644
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
645
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
646
+ }
647
+ const obj_businessGoals = obj.businessGoals;
648
+ const path_businessGoals = path + '.businessGoals';
649
+ if (!ArrayIsArray(obj_businessGoals)) {
650
+ return new TypeError('Expected "array" but received "' + typeof obj_businessGoals + '" (at "' + path_businessGoals + '")');
651
+ }
652
+ for (let i = 0; i < obj_businessGoals.length; i++) {
653
+ const obj_businessGoals_item = obj_businessGoals[i];
654
+ const path_businessGoals_item = path_businessGoals + '[' + i + ']';
655
+ const referencepath_businessGoals_itemValidationError = validate$b(obj_businessGoals_item, path_businessGoals_item);
656
+ if (referencepath_businessGoals_itemValidationError !== null) {
657
+ let message = 'Object doesn\'t match TermOutputRepresentation (at "' + path_businessGoals_item + '")\n';
658
+ message += referencepath_businessGoals_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
659
+ return new TypeError(message);
660
+ }
661
+ }
662
+ const obj_categoryParents = obj.categoryParents;
663
+ const path_categoryParents = path + '.categoryParents';
664
+ if (!ArrayIsArray(obj_categoryParents)) {
665
+ return new TypeError('Expected "array" but received "' + typeof obj_categoryParents + '" (at "' + path_categoryParents + '")');
666
+ }
667
+ for (let i = 0; i < obj_categoryParents.length; i++) {
668
+ const obj_categoryParents_item = obj_categoryParents[i];
669
+ const path_categoryParents_item = path_categoryParents + '[' + i + ']';
670
+ const referencepath_categoryParents_itemValidationError = validate$a(obj_categoryParents_item, path_categoryParents_item);
671
+ if (referencepath_categoryParents_itemValidationError !== null) {
672
+ let message = 'Object doesn\'t match CategoryTreeNodeOutputRepresentation (at "' + path_categoryParents_item + '")\n';
673
+ message += referencepath_categoryParents_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
674
+ return new TypeError(message);
675
+ }
676
+ }
677
+ const obj_contentDurableId = obj.contentDurableId;
678
+ const path_contentDurableId = path + '.contentDurableId';
679
+ if (typeof obj_contentDurableId !== 'string') {
680
+ return new TypeError('Expected "string" but received "' + typeof obj_contentDurableId + '" (at "' + path_contentDurableId + '")');
681
+ }
682
+ const obj_description = obj.description;
683
+ const path_description = path + '.description';
684
+ if (typeof obj_description !== 'string') {
685
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
686
+ }
687
+ const obj_myCapability = obj.myCapability;
688
+ const path_myCapability = path + '.myCapability';
689
+ let obj_myCapability_union0 = null;
690
+ const obj_myCapability_union0_error = (() => {
691
+ if (typeof obj_myCapability !== 'object' || Array.isArray(obj_myCapability)) {
692
+ return new TypeError('Expected "object" but received "' + typeof obj_myCapability + '" (at "' + path_myCapability + '")');
693
+ }
694
+ })();
695
+ if (obj_myCapability_union0_error != null) {
696
+ obj_myCapability_union0 = obj_myCapability_union0_error.message;
697
+ }
698
+ let obj_myCapability_union1 = null;
699
+ const obj_myCapability_union1_error = (() => {
700
+ if (obj_myCapability !== null) {
701
+ return new TypeError('Expected "null" but received "' + typeof obj_myCapability + '" (at "' + path_myCapability + '")');
702
+ }
703
+ })();
704
+ if (obj_myCapability_union1_error != null) {
705
+ obj_myCapability_union1 = obj_myCapability_union1_error.message;
706
+ }
707
+ if (obj_myCapability_union0 && obj_myCapability_union1) {
708
+ let message = 'Object doesn\'t match union (at "' + path_myCapability + '")';
709
+ message += '\n' + obj_myCapability_union0.split('\n').map((line) => '\t' + line).join('\n');
710
+ message += '\n' + obj_myCapability_union1.split('\n').map((line) => '\t' + line).join('\n');
711
+ return new TypeError(message);
712
+ }
713
+ const obj_name = obj.name;
714
+ const path_name = path + '.name';
715
+ if (typeof obj_name !== 'string') {
716
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
717
+ }
718
+ const obj_tags = obj.tags;
719
+ const path_tags = path + '.tags';
720
+ if (!ArrayIsArray(obj_tags)) {
721
+ return new TypeError('Expected "array" but received "' + typeof obj_tags + '" (at "' + path_tags + '")');
722
+ }
723
+ for (let i = 0; i < obj_tags.length; i++) {
724
+ const obj_tags_item = obj_tags[i];
725
+ const path_tags_item = path_tags + '[' + i + ']';
726
+ const referencepath_tags_itemValidationError = validate$b(obj_tags_item, path_tags_item);
727
+ if (referencepath_tags_itemValidationError !== null) {
728
+ let message = 'Object doesn\'t match TermOutputRepresentation (at "' + path_tags_item + '")\n';
729
+ message += referencepath_tags_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
730
+ return new TypeError(message);
731
+ }
732
+ }
733
+ })();
734
+ return v_error === undefined ? null : v_error;
735
+ }
736
+ const RepresentationType$8 = 'CapabilityOutputRepresentation';
737
+ function normalize$8(input, existing, path, luvio, store, timestamp) {
738
+ const input_myCapability = input.myCapability;
739
+ const input_myCapability_id = path.fullPath + '__myCapability';
740
+ if (!Array.isArray(input_myCapability) && input_myCapability !== null && typeof input_myCapability === 'object') {
741
+ input.myCapability = ingest$9(input_myCapability, {
742
+ fullPath: input_myCapability_id,
743
+ propertyName: 'myCapability',
744
+ parent: {
745
+ data: input,
746
+ key: path.fullPath,
747
+ existing: existing,
748
+ },
749
+ ttl: path.ttl
750
+ }, luvio, store, timestamp);
751
+ }
752
+ return input;
753
+ }
754
+ const select$g = function CapabilityOutputRepresentationSelect() {
755
+ const { selections: TermOutputRepresentation__selections, opaque: TermOutputRepresentation__opaque, } = select$j();
756
+ const { selections: CategoryTreeNodeOutputRepresentation__selections, opaque: CategoryTreeNodeOutputRepresentation__opaque, } = select$i();
757
+ return {
758
+ kind: 'Fragment',
759
+ version: VERSION$8,
760
+ private: [],
761
+ selections: [
762
+ {
763
+ name: 'businessGoals',
764
+ kind: 'Object',
765
+ plural: true,
766
+ selections: TermOutputRepresentation__selections
767
+ },
768
+ {
769
+ name: 'categoryParents',
770
+ kind: 'Object',
771
+ plural: true,
772
+ selections: CategoryTreeNodeOutputRepresentation__selections
773
+ },
774
+ {
775
+ name: 'contentDurableId',
776
+ kind: 'Scalar'
777
+ },
778
+ {
779
+ name: 'description',
780
+ kind: 'Scalar'
781
+ },
782
+ {
783
+ name: 'myCapability',
784
+ kind: 'Link',
785
+ nullable: true,
786
+ fragment: select$h()
787
+ },
788
+ {
789
+ name: 'name',
790
+ kind: 'Scalar'
791
+ },
792
+ {
793
+ name: 'tags',
794
+ kind: 'Object',
795
+ plural: true,
796
+ selections: TermOutputRepresentation__selections
797
+ }
798
+ ]
799
+ };
800
+ };
801
+ function equals$8(existing, incoming) {
802
+ const existing_contentDurableId = existing.contentDurableId;
803
+ const incoming_contentDurableId = incoming.contentDurableId;
804
+ if (!(existing_contentDurableId === incoming_contentDurableId)) {
805
+ return false;
806
+ }
807
+ const existing_description = existing.description;
808
+ const incoming_description = incoming.description;
809
+ if (!(existing_description === incoming_description)) {
810
+ return false;
811
+ }
812
+ const existing_name = existing.name;
813
+ const incoming_name = incoming.name;
814
+ if (!(existing_name === incoming_name)) {
815
+ return false;
816
+ }
817
+ const existing_businessGoals = existing.businessGoals;
818
+ const incoming_businessGoals = incoming.businessGoals;
819
+ const equals_businessGoals_items = equalsArray(existing_businessGoals, incoming_businessGoals, (existing_businessGoals_item, incoming_businessGoals_item) => {
820
+ if (!(equals$b(existing_businessGoals_item, incoming_businessGoals_item))) {
821
+ return false;
822
+ }
823
+ });
824
+ if (equals_businessGoals_items === false) {
825
+ return false;
826
+ }
827
+ const existing_categoryParents = existing.categoryParents;
828
+ const incoming_categoryParents = incoming.categoryParents;
829
+ const equals_categoryParents_items = equalsArray(existing_categoryParents, incoming_categoryParents, (existing_categoryParents_item, incoming_categoryParents_item) => {
830
+ if (!(equals$a(existing_categoryParents_item, incoming_categoryParents_item))) {
831
+ return false;
832
+ }
833
+ });
834
+ if (equals_categoryParents_items === false) {
835
+ return false;
836
+ }
837
+ const existing_myCapability = existing.myCapability;
838
+ const incoming_myCapability = incoming.myCapability;
839
+ if (!(existing_myCapability === incoming_myCapability
840
+ || (existing_myCapability != null &&
841
+ incoming_myCapability != null &&
842
+ existing_myCapability.__ref != null &&
843
+ incoming_myCapability.__ref != null &&
844
+ existing_myCapability.__ref === incoming_myCapability.__ref))) {
845
+ return false;
846
+ }
847
+ const existing_tags = existing.tags;
848
+ const incoming_tags = incoming.tags;
849
+ const equals_tags_items = equalsArray(existing_tags, incoming_tags, (existing_tags_item, incoming_tags_item) => {
850
+ if (!(equals$b(existing_tags_item, incoming_tags_item))) {
851
+ return false;
852
+ }
853
+ });
854
+ if (equals_tags_items === false) {
855
+ return false;
856
+ }
857
+ return true;
858
+ }
859
+ const ingest$8 = function CapabilityOutputRepresentationIngest(input, path, luvio, store, timestamp) {
860
+ if (process.env.NODE_ENV !== 'production') {
861
+ const validateError = validate$8(input);
862
+ if (validateError !== null) {
863
+ throw validateError;
864
+ }
865
+ }
866
+ const key = path.fullPath;
867
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 200;
868
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$8, "salesforceJourney", VERSION$8, RepresentationType$8, equals$8);
869
+ return createLink(key);
870
+ };
871
+ function getTypeCacheKeys$8(rootKeySet, luvio, input, fullPathFactory) {
872
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
873
+ const rootKey = fullPathFactory();
874
+ rootKeySet.set(rootKey, {
875
+ namespace: keyPrefix,
876
+ representationName: RepresentationType$8,
877
+ mergeable: false
878
+ });
879
+ if (!Array.isArray(input.myCapability) && input.myCapability !== null && typeof input.myCapability === 'object') {
880
+ getTypeCacheKeys$9(rootKeySet, luvio, input.myCapability);
881
+ }
882
+ }
883
+
884
+ const VERSION$7 = "5c87ba4bc021f580a30069e6fa243b20";
885
+ function validate$7(obj, path = 'CapabilitiesCollectionOutputRepresentation') {
886
+ const v_error = (() => {
887
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
888
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
889
+ }
890
+ const obj_capabilities = obj.capabilities;
891
+ const path_capabilities = path + '.capabilities';
892
+ if (!ArrayIsArray(obj_capabilities)) {
893
+ return new TypeError('Expected "array" but received "' + typeof obj_capabilities + '" (at "' + path_capabilities + '")');
894
+ }
895
+ for (let i = 0; i < obj_capabilities.length; i++) {
896
+ const obj_capabilities_item = obj_capabilities[i];
897
+ const path_capabilities_item = path_capabilities + '[' + i + ']';
898
+ if (typeof obj_capabilities_item !== 'object' || Array.isArray(obj_capabilities_item)) {
899
+ return new TypeError('Expected "object" but received "' + typeof obj_capabilities_item + '" (at "' + path_capabilities_item + '")');
900
+ }
901
+ }
902
+ })();
903
+ return v_error === undefined ? null : v_error;
904
+ }
905
+ const RepresentationType$7 = 'CapabilitiesCollectionOutputRepresentation';
906
+ function normalize$7(input, existing, path, luvio, store, timestamp) {
907
+ const input_capabilities = input.capabilities;
908
+ const input_capabilities_id = path.fullPath + '__capabilities';
909
+ for (let i = 0; i < input_capabilities.length; i++) {
910
+ const input_capabilities_item = input_capabilities[i];
911
+ let input_capabilities_item_id = input_capabilities_id + '__' + i;
912
+ input_capabilities[i] = ingest$8(input_capabilities_item, {
913
+ fullPath: input_capabilities_item_id,
914
+ propertyName: i,
915
+ parent: {
916
+ data: input,
917
+ key: path.fullPath,
918
+ existing: existing,
919
+ },
920
+ ttl: path.ttl
921
+ }, luvio, store, timestamp);
922
+ }
923
+ return input;
924
+ }
925
+ const select$f = function CapabilitiesCollectionOutputRepresentationSelect() {
926
+ return {
927
+ kind: 'Fragment',
928
+ version: VERSION$7,
929
+ private: [],
930
+ selections: [
931
+ {
932
+ name: 'capabilities',
933
+ kind: 'Link',
934
+ plural: true,
935
+ fragment: select$g()
936
+ }
937
+ ]
938
+ };
939
+ };
940
+ function equals$7(existing, incoming) {
941
+ const existing_capabilities = existing.capabilities;
942
+ const incoming_capabilities = incoming.capabilities;
943
+ const equals_capabilities_items = equalsArray(existing_capabilities, incoming_capabilities, (existing_capabilities_item, incoming_capabilities_item) => {
944
+ if (!(existing_capabilities_item.__ref === incoming_capabilities_item.__ref)) {
945
+ return false;
946
+ }
947
+ });
948
+ if (equals_capabilities_items === false) {
949
+ return false;
950
+ }
951
+ return true;
952
+ }
953
+ const ingest$7 = function CapabilitiesCollectionOutputRepresentationIngest(input, path, luvio, store, timestamp) {
954
+ if (process.env.NODE_ENV !== 'production') {
955
+ const validateError = validate$7(input);
956
+ if (validateError !== null) {
957
+ throw validateError;
958
+ }
959
+ }
960
+ const key = path.fullPath;
961
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 200;
962
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$7, "salesforceJourney", VERSION$7, RepresentationType$7, equals$7);
963
+ return createLink(key);
964
+ };
965
+ function getTypeCacheKeys$7(rootKeySet, luvio, input, fullPathFactory) {
966
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
967
+ const rootKey = fullPathFactory();
968
+ rootKeySet.set(rootKey, {
969
+ namespace: keyPrefix,
970
+ representationName: RepresentationType$7,
971
+ mergeable: false
972
+ });
973
+ const input_capabilities_length = input.capabilities.length;
974
+ for (let i = 0; i < input_capabilities_length; i++) {
975
+ getTypeCacheKeys$8(rootKeySet, luvio, input.capabilities[i], () => '');
976
+ }
977
+ }
978
+
979
+ function select$e(luvio, params) {
980
+ return select$f();
981
+ }
982
+ function keyBuilder$c(luvio, params) {
983
+ return keyPrefix + '::CapabilitiesCollectionOutputRepresentation:(' + 'cloudOwnership:' + params.urlParams.cloudOwnership + ',' + '[' + params.body.filterConditions.map(element => 'filterConditions.filterType:' + element.filterType + '::' + 'filterConditions.values:' + element.values).join(',') + ']' + ')';
984
+ }
985
+ function getResponseCacheKeys$7(storeKeyMap, luvio, resourceParams, response) {
986
+ getTypeCacheKeys$7(storeKeyMap, luvio, response, () => keyBuilder$c(luvio, resourceParams));
987
+ }
988
+ function ingestSuccess$7(luvio, resourceParams, response, snapshotRefresh) {
989
+ const { body } = response;
990
+ const key = keyBuilder$c(luvio, resourceParams);
991
+ luvio.storeIngest(key, ingest$7, body);
992
+ const snapshot = luvio.storeLookup({
993
+ recordId: key,
994
+ node: select$e(),
995
+ variables: {},
996
+ }, snapshotRefresh);
997
+ if (process.env.NODE_ENV !== 'production') {
998
+ if (snapshot.state !== 'Fulfilled') {
999
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1000
+ }
1001
+ }
1002
+ deepFreeze(snapshot.data);
1003
+ return snapshot;
1004
+ }
1005
+ function ingestError$5(luvio, params, error, snapshotRefresh) {
1006
+ const key = keyBuilder$c(luvio, params);
1007
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1008
+ luvio.storeIngestError(key, errorSnapshot);
1009
+ return errorSnapshot;
1010
+ }
1011
+ function createResourceRequest$7(config) {
1012
+ const headers = {};
1013
+ return {
1014
+ baseUri: '/services/data/v66.0',
1015
+ basePath: '/connect/salesforce-journey/' + config.urlParams.cloudOwnership + '/capabilities',
1016
+ method: 'post',
1017
+ body: config.body,
1018
+ urlParams: config.urlParams,
1019
+ queryParams: {},
1020
+ headers,
1021
+ priority: 'normal',
1022
+ };
1023
+ }
1024
+
1025
+ const adapterName$7 = 'getCapabilities';
1026
+ const getCapabilities_ConfigPropertyMetadata = [
1027
+ generateParamConfigMetadata('cloudOwnership', true, 0 /* UrlParameter */, 0 /* String */),
1028
+ generateParamConfigMetadata('filterConditions', true, 2 /* Body */, 4 /* Unsupported */, true),
1029
+ ];
1030
+ const getCapabilities_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$7, getCapabilities_ConfigPropertyMetadata);
1031
+ const createResourceParams$7 = /*#__PURE__*/ createResourceParams$9(getCapabilities_ConfigPropertyMetadata);
1032
+ function keyBuilder$b(luvio, config) {
1033
+ const resourceParams = createResourceParams$7(config);
1034
+ return keyBuilder$c(luvio, resourceParams);
1035
+ }
1036
+ function typeCheckConfig$7(untrustedConfig) {
1037
+ const config = {};
1038
+ typeCheckConfig$9(untrustedConfig, config, getCapabilities_ConfigPropertyMetadata);
1039
+ const untrustedConfig_filterConditions = untrustedConfig.filterConditions;
1040
+ if (ArrayIsArray$1(untrustedConfig_filterConditions)) {
1041
+ const untrustedConfig_filterConditions_array = [];
1042
+ for (let i = 0, arrayLength = untrustedConfig_filterConditions.length; i < arrayLength; i++) {
1043
+ const untrustedConfig_filterConditions_item = untrustedConfig_filterConditions[i];
1044
+ const referenceFilterConditionInputRepresentationValidationError = validate$c(untrustedConfig_filterConditions_item);
1045
+ if (referenceFilterConditionInputRepresentationValidationError === null) {
1046
+ untrustedConfig_filterConditions_array.push(untrustedConfig_filterConditions_item);
1047
+ }
1048
+ }
1049
+ config.filterConditions = untrustedConfig_filterConditions_array;
1050
+ }
1051
+ return config;
1052
+ }
1053
+ function validateAdapterConfig$7(untrustedConfig, configPropertyNames) {
1054
+ if (!untrustedIsObject(untrustedConfig)) {
1055
+ return null;
1056
+ }
1057
+ if (process.env.NODE_ENV !== 'production') {
1058
+ validateConfig(untrustedConfig, configPropertyNames);
1059
+ }
1060
+ const config = typeCheckConfig$7(untrustedConfig);
1061
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1062
+ return null;
1063
+ }
1064
+ return config;
1065
+ }
1066
+ function adapterFragment$5(luvio, config) {
1067
+ createResourceParams$7(config);
1068
+ return select$e();
1069
+ }
1070
+ function onFetchResponseSuccess$5(luvio, config, resourceParams, response) {
1071
+ const snapshot = ingestSuccess$7(luvio, resourceParams, response, {
1072
+ config,
1073
+ resolve: () => buildNetworkSnapshot$7(luvio, config, snapshotRefreshOptions)
1074
+ });
1075
+ return luvio.storeBroadcast().then(() => snapshot);
1076
+ }
1077
+ function onFetchResponseError$5(luvio, config, resourceParams, response) {
1078
+ const snapshot = ingestError$5(luvio, resourceParams, response, {
1079
+ config,
1080
+ resolve: () => buildNetworkSnapshot$7(luvio, config, snapshotRefreshOptions)
1081
+ });
1082
+ return luvio.storeBroadcast().then(() => snapshot);
1083
+ }
1084
+ function buildNetworkSnapshot$7(luvio, config, options) {
1085
+ const resourceParams = createResourceParams$7(config);
1086
+ const request = createResourceRequest$7(resourceParams);
1087
+ return luvio.dispatchResourceRequest(request, options)
1088
+ .then((response) => {
1089
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$5(luvio, config, resourceParams, response), () => {
1090
+ const cache = new StoreKeyMap();
1091
+ getResponseCacheKeys$7(cache, luvio, resourceParams, response.body);
1092
+ return cache;
1093
+ });
1094
+ }, (response) => {
1095
+ return luvio.handleErrorResponse(() => onFetchResponseError$5(luvio, config, resourceParams, response));
1096
+ });
1097
+ }
1098
+ function buildNetworkSnapshotCachePolicy$5(context, coercedAdapterRequestContext) {
1099
+ return buildNetworkSnapshotCachePolicy$6(context, coercedAdapterRequestContext, buildNetworkSnapshot$7, 'get', false);
1100
+ }
1101
+ function buildCachedSnapshotCachePolicy$5(context, storeLookup) {
1102
+ const { luvio, config } = context;
1103
+ const selector = {
1104
+ recordId: keyBuilder$b(luvio, config),
1105
+ node: adapterFragment$5(luvio, config),
1106
+ variables: {},
1107
+ };
1108
+ const cacheSnapshot = storeLookup(selector, {
1109
+ config,
1110
+ resolve: () => buildNetworkSnapshot$7(luvio, config, snapshotRefreshOptions)
1111
+ });
1112
+ return cacheSnapshot;
1113
+ }
1114
+ const getCapabilitiesAdapterFactory = (luvio) => function salesforceJourney__getCapabilities(untrustedConfig, requestContext) {
1115
+ const config = validateAdapterConfig$7(untrustedConfig, getCapabilities_ConfigPropertyNames);
1116
+ // Invalid or incomplete config
1117
+ if (config === null) {
1118
+ return null;
1119
+ }
1120
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1121
+ buildCachedSnapshotCachePolicy$5, buildNetworkSnapshotCachePolicy$5);
1122
+ };
1123
+
1124
+ const VERSION$6 = "9f13171170f7684474c123b60cb94074";
1125
+ function validate$6(obj, path = 'CapabilityContentOutputRepresentation') {
1126
+ const v_error = (() => {
1127
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1128
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1129
+ }
1130
+ const obj_addonRequired = obj.addonRequired;
1131
+ const path_addonRequired = path + '.addonRequired';
1132
+ let obj_addonRequired_union0 = null;
1133
+ const obj_addonRequired_union0_error = (() => {
1134
+ if (typeof obj_addonRequired !== 'boolean') {
1135
+ return new TypeError('Expected "boolean" but received "' + typeof obj_addonRequired + '" (at "' + path_addonRequired + '")');
1136
+ }
1137
+ })();
1138
+ if (obj_addonRequired_union0_error != null) {
1139
+ obj_addonRequired_union0 = obj_addonRequired_union0_error.message;
1140
+ }
1141
+ let obj_addonRequired_union1 = null;
1142
+ const obj_addonRequired_union1_error = (() => {
1143
+ if (obj_addonRequired !== null) {
1144
+ return new TypeError('Expected "null" but received "' + typeof obj_addonRequired + '" (at "' + path_addonRequired + '")');
1145
+ }
1146
+ })();
1147
+ if (obj_addonRequired_union1_error != null) {
1148
+ obj_addonRequired_union1 = obj_addonRequired_union1_error.message;
1149
+ }
1150
+ if (obj_addonRequired_union0 && obj_addonRequired_union1) {
1151
+ let message = 'Object doesn\'t match union (at "' + path_addonRequired + '")';
1152
+ message += '\n' + obj_addonRequired_union0.split('\n').map((line) => '\t' + line).join('\n');
1153
+ message += '\n' + obj_addonRequired_union1.split('\n').map((line) => '\t' + line).join('\n');
1154
+ return new TypeError(message);
1155
+ }
1156
+ const obj_businessGoals = obj.businessGoals;
1157
+ const path_businessGoals = path + '.businessGoals';
1158
+ if (!ArrayIsArray(obj_businessGoals)) {
1159
+ return new TypeError('Expected "array" but received "' + typeof obj_businessGoals + '" (at "' + path_businessGoals + '")');
1160
+ }
1161
+ for (let i = 0; i < obj_businessGoals.length; i++) {
1162
+ const obj_businessGoals_item = obj_businessGoals[i];
1163
+ const path_businessGoals_item = path_businessGoals + '[' + i + ']';
1164
+ const referencepath_businessGoals_itemValidationError = validate$b(obj_businessGoals_item, path_businessGoals_item);
1165
+ if (referencepath_businessGoals_itemValidationError !== null) {
1166
+ let message = 'Object doesn\'t match TermOutputRepresentation (at "' + path_businessGoals_item + '")\n';
1167
+ message += referencepath_businessGoals_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1168
+ return new TypeError(message);
1169
+ }
1170
+ }
1171
+ const obj_complete = obj.complete;
1172
+ const path_complete = path + '.complete';
1173
+ if (typeof obj_complete !== 'boolean') {
1174
+ return new TypeError('Expected "boolean" but received "' + typeof obj_complete + '" (at "' + path_complete + '")');
1175
+ }
1176
+ const obj_description = obj.description;
1177
+ const path_description = path + '.description';
1178
+ if (typeof obj_description !== 'string') {
1179
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
1180
+ }
1181
+ const obj_implBestPractices = obj.implBestPractices;
1182
+ const path_implBestPractices = path + '.implBestPractices';
1183
+ let obj_implBestPractices_union0 = null;
1184
+ const obj_implBestPractices_union0_error = (() => {
1185
+ if (typeof obj_implBestPractices !== 'string') {
1186
+ return new TypeError('Expected "string" but received "' + typeof obj_implBestPractices + '" (at "' + path_implBestPractices + '")');
1187
+ }
1188
+ })();
1189
+ if (obj_implBestPractices_union0_error != null) {
1190
+ obj_implBestPractices_union0 = obj_implBestPractices_union0_error.message;
1191
+ }
1192
+ let obj_implBestPractices_union1 = null;
1193
+ const obj_implBestPractices_union1_error = (() => {
1194
+ if (obj_implBestPractices !== null) {
1195
+ return new TypeError('Expected "null" but received "' + typeof obj_implBestPractices + '" (at "' + path_implBestPractices + '")');
1196
+ }
1197
+ })();
1198
+ if (obj_implBestPractices_union1_error != null) {
1199
+ obj_implBestPractices_union1 = obj_implBestPractices_union1_error.message;
1200
+ }
1201
+ if (obj_implBestPractices_union0 && obj_implBestPractices_union1) {
1202
+ let message = 'Object doesn\'t match union (at "' + path_implBestPractices + '")';
1203
+ message += '\n' + obj_implBestPractices_union0.split('\n').map((line) => '\t' + line).join('\n');
1204
+ message += '\n' + obj_implBestPractices_union1.split('\n').map((line) => '\t' + line).join('\n');
1205
+ return new TypeError(message);
1206
+ }
1207
+ const obj_measures = obj.measures;
1208
+ const path_measures = path + '.measures';
1209
+ let obj_measures_union0 = null;
1210
+ const obj_measures_union0_error = (() => {
1211
+ if (typeof obj_measures !== 'string') {
1212
+ return new TypeError('Expected "string" but received "' + typeof obj_measures + '" (at "' + path_measures + '")');
1213
+ }
1214
+ })();
1215
+ if (obj_measures_union0_error != null) {
1216
+ obj_measures_union0 = obj_measures_union0_error.message;
1217
+ }
1218
+ let obj_measures_union1 = null;
1219
+ const obj_measures_union1_error = (() => {
1220
+ if (obj_measures !== null) {
1221
+ return new TypeError('Expected "null" but received "' + typeof obj_measures + '" (at "' + path_measures + '")');
1222
+ }
1223
+ })();
1224
+ if (obj_measures_union1_error != null) {
1225
+ obj_measures_union1 = obj_measures_union1_error.message;
1226
+ }
1227
+ if (obj_measures_union0 && obj_measures_union1) {
1228
+ let message = 'Object doesn\'t match union (at "' + path_measures + '")';
1229
+ message += '\n' + obj_measures_union0.split('\n').map((line) => '\t' + line).join('\n');
1230
+ message += '\n' + obj_measures_union1.split('\n').map((line) => '\t' + line).join('\n');
1231
+ return new TypeError(message);
1232
+ }
1233
+ const obj_minimumEdition = obj.minimumEdition;
1234
+ const path_minimumEdition = path + '.minimumEdition';
1235
+ let obj_minimumEdition_union0 = null;
1236
+ const obj_minimumEdition_union0_error = (() => {
1237
+ const referencepath_minimumEditionValidationError = validate$b(obj_minimumEdition, path_minimumEdition);
1238
+ if (referencepath_minimumEditionValidationError !== null) {
1239
+ let message = 'Object doesn\'t match TermOutputRepresentation (at "' + path_minimumEdition + '")\n';
1240
+ message += referencepath_minimumEditionValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1241
+ return new TypeError(message);
1242
+ }
1243
+ })();
1244
+ if (obj_minimumEdition_union0_error != null) {
1245
+ obj_minimumEdition_union0 = obj_minimumEdition_union0_error.message;
1246
+ }
1247
+ let obj_minimumEdition_union1 = null;
1248
+ const obj_minimumEdition_union1_error = (() => {
1249
+ if (obj_minimumEdition !== null) {
1250
+ return new TypeError('Expected "null" but received "' + typeof obj_minimumEdition + '" (at "' + path_minimumEdition + '")');
1251
+ }
1252
+ })();
1253
+ if (obj_minimumEdition_union1_error != null) {
1254
+ obj_minimumEdition_union1 = obj_minimumEdition_union1_error.message;
1255
+ }
1256
+ if (obj_minimumEdition_union0 && obj_minimumEdition_union1) {
1257
+ let message = 'Object doesn\'t match union (at "' + path_minimumEdition + '")';
1258
+ message += '\n' + obj_minimumEdition_union0.split('\n').map((line) => '\t' + line).join('\n');
1259
+ message += '\n' + obj_minimumEdition_union1.split('\n').map((line) => '\t' + line).join('\n');
1260
+ return new TypeError(message);
1261
+ }
1262
+ const obj_productAndLicensing = obj.productAndLicensing;
1263
+ const path_productAndLicensing = path + '.productAndLicensing';
1264
+ let obj_productAndLicensing_union0 = null;
1265
+ const obj_productAndLicensing_union0_error = (() => {
1266
+ if (typeof obj_productAndLicensing !== 'string') {
1267
+ return new TypeError('Expected "string" but received "' + typeof obj_productAndLicensing + '" (at "' + path_productAndLicensing + '")');
1268
+ }
1269
+ })();
1270
+ if (obj_productAndLicensing_union0_error != null) {
1271
+ obj_productAndLicensing_union0 = obj_productAndLicensing_union0_error.message;
1272
+ }
1273
+ let obj_productAndLicensing_union1 = null;
1274
+ const obj_productAndLicensing_union1_error = (() => {
1275
+ if (obj_productAndLicensing !== null) {
1276
+ return new TypeError('Expected "null" but received "' + typeof obj_productAndLicensing + '" (at "' + path_productAndLicensing + '")');
1277
+ }
1278
+ })();
1279
+ if (obj_productAndLicensing_union1_error != null) {
1280
+ obj_productAndLicensing_union1 = obj_productAndLicensing_union1_error.message;
1281
+ }
1282
+ if (obj_productAndLicensing_union0 && obj_productAndLicensing_union1) {
1283
+ let message = 'Object doesn\'t match union (at "' + path_productAndLicensing + '")';
1284
+ message += '\n' + obj_productAndLicensing_union0.split('\n').map((line) => '\t' + line).join('\n');
1285
+ message += '\n' + obj_productAndLicensing_union1.split('\n').map((line) => '\t' + line).join('\n');
1286
+ return new TypeError(message);
1287
+ }
1288
+ const obj_release = obj.release;
1289
+ const path_release = path + '.release';
1290
+ let obj_release_union0 = null;
1291
+ const obj_release_union0_error = (() => {
1292
+ if (typeof obj_release !== 'string') {
1293
+ return new TypeError('Expected "string" but received "' + typeof obj_release + '" (at "' + path_release + '")');
1294
+ }
1295
+ })();
1296
+ if (obj_release_union0_error != null) {
1297
+ obj_release_union0 = obj_release_union0_error.message;
1298
+ }
1299
+ let obj_release_union1 = null;
1300
+ const obj_release_union1_error = (() => {
1301
+ if (obj_release !== null) {
1302
+ return new TypeError('Expected "null" but received "' + typeof obj_release + '" (at "' + path_release + '")');
1303
+ }
1304
+ })();
1305
+ if (obj_release_union1_error != null) {
1306
+ obj_release_union1 = obj_release_union1_error.message;
1307
+ }
1308
+ if (obj_release_union0 && obj_release_union1) {
1309
+ let message = 'Object doesn\'t match union (at "' + path_release + '")';
1310
+ message += '\n' + obj_release_union0.split('\n').map((line) => '\t' + line).join('\n');
1311
+ message += '\n' + obj_release_union1.split('\n').map((line) => '\t' + line).join('\n');
1312
+ return new TypeError(message);
1313
+ }
1314
+ const obj_resources = obj.resources;
1315
+ const path_resources = path + '.resources';
1316
+ if (!ArrayIsArray(obj_resources)) {
1317
+ return new TypeError('Expected "array" but received "' + typeof obj_resources + '" (at "' + path_resources + '")');
1318
+ }
1319
+ for (let i = 0; i < obj_resources.length; i++) {
1320
+ const obj_resources_item = obj_resources[i];
1321
+ const path_resources_item = path_resources + '[' + i + ']';
1322
+ if (typeof obj_resources_item !== 'object' || ArrayIsArray(obj_resources_item) || obj_resources_item === null) {
1323
+ return new TypeError('Expected "object" but received "' + typeof obj_resources_item + '" (at "' + path_resources_item + '")');
1324
+ }
1325
+ const obj_resources_item_keys = ObjectKeys(obj_resources_item);
1326
+ for (let i = 0; i < obj_resources_item_keys.length; i++) {
1327
+ const key = obj_resources_item_keys[i];
1328
+ const obj_resources_item_prop = obj_resources_item[key];
1329
+ const path_resources_item_prop = path_resources_item + '["' + key + '"]';
1330
+ if (obj_resources_item_prop === undefined) {
1331
+ return new TypeError('Expected "defined" but received "' + typeof obj_resources_item_prop + '" (at "' + path_resources_item_prop + '")');
1332
+ }
1333
+ }
1334
+ }
1335
+ const obj_salesforceCloud = obj.salesforceCloud;
1336
+ const path_salesforceCloud = path + '.salesforceCloud';
1337
+ let obj_salesforceCloud_union0 = null;
1338
+ const obj_salesforceCloud_union0_error = (() => {
1339
+ if (typeof obj_salesforceCloud !== 'string') {
1340
+ return new TypeError('Expected "string" but received "' + typeof obj_salesforceCloud + '" (at "' + path_salesforceCloud + '")');
1341
+ }
1342
+ })();
1343
+ if (obj_salesforceCloud_union0_error != null) {
1344
+ obj_salesforceCloud_union0 = obj_salesforceCloud_union0_error.message;
1345
+ }
1346
+ let obj_salesforceCloud_union1 = null;
1347
+ const obj_salesforceCloud_union1_error = (() => {
1348
+ if (obj_salesforceCloud !== null) {
1349
+ return new TypeError('Expected "null" but received "' + typeof obj_salesforceCloud + '" (at "' + path_salesforceCloud + '")');
1350
+ }
1351
+ })();
1352
+ if (obj_salesforceCloud_union1_error != null) {
1353
+ obj_salesforceCloud_union1 = obj_salesforceCloud_union1_error.message;
1354
+ }
1355
+ if (obj_salesforceCloud_union0 && obj_salesforceCloud_union1) {
1356
+ let message = 'Object doesn\'t match union (at "' + path_salesforceCloud + '")';
1357
+ message += '\n' + obj_salesforceCloud_union0.split('\n').map((line) => '\t' + line).join('\n');
1358
+ message += '\n' + obj_salesforceCloud_union1.split('\n').map((line) => '\t' + line).join('\n');
1359
+ return new TypeError(message);
1360
+ }
1361
+ const obj_salesforceGoLinks = obj.salesforceGoLinks;
1362
+ const path_salesforceGoLinks = path + '.salesforceGoLinks';
1363
+ if (!ArrayIsArray(obj_salesforceGoLinks)) {
1364
+ return new TypeError('Expected "array" but received "' + typeof obj_salesforceGoLinks + '" (at "' + path_salesforceGoLinks + '")');
1365
+ }
1366
+ for (let i = 0; i < obj_salesforceGoLinks.length; i++) {
1367
+ const obj_salesforceGoLinks_item = obj_salesforceGoLinks[i];
1368
+ const path_salesforceGoLinks_item = path_salesforceGoLinks + '[' + i + ']';
1369
+ if (typeof obj_salesforceGoLinks_item !== 'object' || ArrayIsArray(obj_salesforceGoLinks_item) || obj_salesforceGoLinks_item === null) {
1370
+ return new TypeError('Expected "object" but received "' + typeof obj_salesforceGoLinks_item + '" (at "' + path_salesforceGoLinks_item + '")');
1371
+ }
1372
+ const obj_salesforceGoLinks_item_keys = ObjectKeys(obj_salesforceGoLinks_item);
1373
+ for (let i = 0; i < obj_salesforceGoLinks_item_keys.length; i++) {
1374
+ const key = obj_salesforceGoLinks_item_keys[i];
1375
+ const obj_salesforceGoLinks_item_prop = obj_salesforceGoLinks_item[key];
1376
+ const path_salesforceGoLinks_item_prop = path_salesforceGoLinks_item + '["' + key + '"]';
1377
+ if (obj_salesforceGoLinks_item_prop === undefined) {
1378
+ return new TypeError('Expected "defined" but received "' + typeof obj_salesforceGoLinks_item_prop + '" (at "' + path_salesforceGoLinks_item_prop + '")');
1379
+ }
1380
+ }
1381
+ }
1382
+ const obj_tags = obj.tags;
1383
+ const path_tags = path + '.tags';
1384
+ if (!ArrayIsArray(obj_tags)) {
1385
+ return new TypeError('Expected "array" but received "' + typeof obj_tags + '" (at "' + path_tags + '")');
1386
+ }
1387
+ for (let i = 0; i < obj_tags.length; i++) {
1388
+ const obj_tags_item = obj_tags[i];
1389
+ const path_tags_item = path_tags + '[' + i + ']';
1390
+ const referencepath_tags_itemValidationError = validate$b(obj_tags_item, path_tags_item);
1391
+ if (referencepath_tags_itemValidationError !== null) {
1392
+ let message = 'Object doesn\'t match TermOutputRepresentation (at "' + path_tags_item + '")\n';
1393
+ message += referencepath_tags_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1394
+ return new TypeError(message);
1395
+ }
1396
+ }
1397
+ const obj_title = obj.title;
1398
+ const path_title = path + '.title';
1399
+ if (typeof obj_title !== 'string') {
1400
+ return new TypeError('Expected "string" but received "' + typeof obj_title + '" (at "' + path_title + '")');
1401
+ }
1402
+ const obj_usageBestPractices = obj.usageBestPractices;
1403
+ const path_usageBestPractices = path + '.usageBestPractices';
1404
+ let obj_usageBestPractices_union0 = null;
1405
+ const obj_usageBestPractices_union0_error = (() => {
1406
+ if (typeof obj_usageBestPractices !== 'string') {
1407
+ return new TypeError('Expected "string" but received "' + typeof obj_usageBestPractices + '" (at "' + path_usageBestPractices + '")');
1408
+ }
1409
+ })();
1410
+ if (obj_usageBestPractices_union0_error != null) {
1411
+ obj_usageBestPractices_union0 = obj_usageBestPractices_union0_error.message;
1412
+ }
1413
+ let obj_usageBestPractices_union1 = null;
1414
+ const obj_usageBestPractices_union1_error = (() => {
1415
+ if (obj_usageBestPractices !== null) {
1416
+ return new TypeError('Expected "null" but received "' + typeof obj_usageBestPractices + '" (at "' + path_usageBestPractices + '")');
1417
+ }
1418
+ })();
1419
+ if (obj_usageBestPractices_union1_error != null) {
1420
+ obj_usageBestPractices_union1 = obj_usageBestPractices_union1_error.message;
1421
+ }
1422
+ if (obj_usageBestPractices_union0 && obj_usageBestPractices_union1) {
1423
+ let message = 'Object doesn\'t match union (at "' + path_usageBestPractices + '")';
1424
+ message += '\n' + obj_usageBestPractices_union0.split('\n').map((line) => '\t' + line).join('\n');
1425
+ message += '\n' + obj_usageBestPractices_union1.split('\n').map((line) => '\t' + line).join('\n');
1426
+ return new TypeError(message);
1427
+ }
1428
+ const obj_videoLink = obj.videoLink;
1429
+ const path_videoLink = path + '.videoLink';
1430
+ let obj_videoLink_union0 = null;
1431
+ const obj_videoLink_union0_error = (() => {
1432
+ if (typeof obj_videoLink !== 'string') {
1433
+ return new TypeError('Expected "string" but received "' + typeof obj_videoLink + '" (at "' + path_videoLink + '")');
1434
+ }
1435
+ })();
1436
+ if (obj_videoLink_union0_error != null) {
1437
+ obj_videoLink_union0 = obj_videoLink_union0_error.message;
1438
+ }
1439
+ let obj_videoLink_union1 = null;
1440
+ const obj_videoLink_union1_error = (() => {
1441
+ if (obj_videoLink !== null) {
1442
+ return new TypeError('Expected "null" but received "' + typeof obj_videoLink + '" (at "' + path_videoLink + '")');
1443
+ }
1444
+ })();
1445
+ if (obj_videoLink_union1_error != null) {
1446
+ obj_videoLink_union1 = obj_videoLink_union1_error.message;
1447
+ }
1448
+ if (obj_videoLink_union0 && obj_videoLink_union1) {
1449
+ let message = 'Object doesn\'t match union (at "' + path_videoLink + '")';
1450
+ message += '\n' + obj_videoLink_union0.split('\n').map((line) => '\t' + line).join('\n');
1451
+ message += '\n' + obj_videoLink_union1.split('\n').map((line) => '\t' + line).join('\n');
1452
+ return new TypeError(message);
1453
+ }
1454
+ })();
1455
+ return v_error === undefined ? null : v_error;
1456
+ }
1457
+ const RepresentationType$6 = 'CapabilityContentOutputRepresentation';
1458
+ function normalize$6(input, existing, path, luvio, store, timestamp) {
1459
+ return input;
1460
+ }
1461
+ const select$d = function CapabilityContentOutputRepresentationSelect() {
1462
+ const { selections: TermOutputRepresentation__selections, opaque: TermOutputRepresentation__opaque, } = select$j();
1463
+ return {
1464
+ kind: 'Fragment',
1465
+ version: VERSION$6,
1466
+ private: [],
1467
+ selections: [
1468
+ {
1469
+ name: 'addonRequired',
1470
+ kind: 'Scalar'
1471
+ },
1472
+ {
1473
+ name: 'businessGoals',
1474
+ kind: 'Object',
1475
+ plural: true,
1476
+ selections: TermOutputRepresentation__selections
1477
+ },
1478
+ {
1479
+ name: 'complete',
1480
+ kind: 'Scalar'
1481
+ },
1482
+ {
1483
+ name: 'description',
1484
+ kind: 'Scalar'
1485
+ },
1486
+ {
1487
+ name: 'implBestPractices',
1488
+ kind: 'Scalar'
1489
+ },
1490
+ {
1491
+ name: 'measures',
1492
+ kind: 'Scalar'
1493
+ },
1494
+ {
1495
+ name: 'minimumEdition',
1496
+ kind: 'Object',
1497
+ nullable: true,
1498
+ selections: TermOutputRepresentation__selections
1499
+ },
1500
+ {
1501
+ name: 'productAndLicensing',
1502
+ kind: 'Scalar'
1503
+ },
1504
+ {
1505
+ name: 'release',
1506
+ kind: 'Scalar'
1507
+ },
1508
+ {
1509
+ name: 'resources',
1510
+ kind: 'Object',
1511
+ // any
1512
+ },
1513
+ {
1514
+ name: 'salesforceCloud',
1515
+ kind: 'Scalar'
1516
+ },
1517
+ {
1518
+ name: 'salesforceGoLinks',
1519
+ kind: 'Object',
1520
+ // any
1521
+ },
1522
+ {
1523
+ name: 'tags',
1524
+ kind: 'Object',
1525
+ plural: true,
1526
+ selections: TermOutputRepresentation__selections
1527
+ },
1528
+ {
1529
+ name: 'title',
1530
+ kind: 'Scalar'
1531
+ },
1532
+ {
1533
+ name: 'usageBestPractices',
1534
+ kind: 'Scalar'
1535
+ },
1536
+ {
1537
+ name: 'videoLink',
1538
+ kind: 'Scalar'
1539
+ }
1540
+ ]
1541
+ };
1542
+ };
1543
+ function equals$6(existing, incoming) {
1544
+ const existing_complete = existing.complete;
1545
+ const incoming_complete = incoming.complete;
1546
+ if (!(existing_complete === incoming_complete)) {
1547
+ return false;
1548
+ }
1549
+ const existing_description = existing.description;
1550
+ const incoming_description = incoming.description;
1551
+ if (!(existing_description === incoming_description)) {
1552
+ return false;
1553
+ }
1554
+ const existing_title = existing.title;
1555
+ const incoming_title = incoming.title;
1556
+ if (!(existing_title === incoming_title)) {
1557
+ return false;
1558
+ }
1559
+ const existing_addonRequired = existing.addonRequired;
1560
+ const incoming_addonRequired = incoming.addonRequired;
1561
+ if (!(existing_addonRequired === incoming_addonRequired)) {
1562
+ return false;
1563
+ }
1564
+ const existing_businessGoals = existing.businessGoals;
1565
+ const incoming_businessGoals = incoming.businessGoals;
1566
+ const equals_businessGoals_items = equalsArray(existing_businessGoals, incoming_businessGoals, (existing_businessGoals_item, incoming_businessGoals_item) => {
1567
+ if (!(equals$b(existing_businessGoals_item, incoming_businessGoals_item))) {
1568
+ return false;
1569
+ }
1570
+ });
1571
+ if (equals_businessGoals_items === false) {
1572
+ return false;
1573
+ }
1574
+ const existing_implBestPractices = existing.implBestPractices;
1575
+ const incoming_implBestPractices = incoming.implBestPractices;
1576
+ if (!(existing_implBestPractices === incoming_implBestPractices)) {
1577
+ return false;
1578
+ }
1579
+ const existing_measures = existing.measures;
1580
+ const incoming_measures = incoming.measures;
1581
+ if (!(existing_measures === incoming_measures)) {
1582
+ return false;
1583
+ }
1584
+ const existing_minimumEdition = existing.minimumEdition;
1585
+ const incoming_minimumEdition = incoming.minimumEdition;
1586
+ if (!(existing_minimumEdition === incoming_minimumEdition
1587
+ || (existing_minimumEdition != null &&
1588
+ incoming_minimumEdition != null &&
1589
+ equals$b(existing_minimumEdition, incoming_minimumEdition)))) {
1590
+ return false;
1591
+ }
1592
+ const existing_productAndLicensing = existing.productAndLicensing;
1593
+ const incoming_productAndLicensing = incoming.productAndLicensing;
1594
+ if (!(existing_productAndLicensing === incoming_productAndLicensing)) {
1595
+ return false;
1596
+ }
1597
+ const existing_release = existing.release;
1598
+ const incoming_release = incoming.release;
1599
+ if (!(existing_release === incoming_release)) {
1600
+ return false;
1601
+ }
1602
+ const existing_resources = existing.resources;
1603
+ const incoming_resources = incoming.resources;
1604
+ const equals_resources_items = equalsArray(existing_resources, incoming_resources, (existing_resources_item, incoming_resources_item) => {
1605
+ const equals_resources_items_props = equalsObject(existing_resources_item, incoming_resources_item, (existing_resources_item_prop, incoming_resources_item_prop) => {
1606
+ if (JSONStringify(incoming_resources_item_prop) !== JSONStringify(existing_resources_item_prop)) {
1607
+ return false;
1608
+ }
1609
+ });
1610
+ if (equals_resources_items_props === false) {
1611
+ return false;
1612
+ }
1613
+ });
1614
+ if (equals_resources_items === false) {
1615
+ return false;
1616
+ }
1617
+ const existing_salesforceCloud = existing.salesforceCloud;
1618
+ const incoming_salesforceCloud = incoming.salesforceCloud;
1619
+ if (!(existing_salesforceCloud === incoming_salesforceCloud)) {
1620
+ return false;
1621
+ }
1622
+ const existing_salesforceGoLinks = existing.salesforceGoLinks;
1623
+ const incoming_salesforceGoLinks = incoming.salesforceGoLinks;
1624
+ const equals_salesforceGoLinks_items = equalsArray(existing_salesforceGoLinks, incoming_salesforceGoLinks, (existing_salesforceGoLinks_item, incoming_salesforceGoLinks_item) => {
1625
+ const equals_salesforceGoLinks_items_props = equalsObject(existing_salesforceGoLinks_item, incoming_salesforceGoLinks_item, (existing_salesforceGoLinks_item_prop, incoming_salesforceGoLinks_item_prop) => {
1626
+ if (JSONStringify(incoming_salesforceGoLinks_item_prop) !== JSONStringify(existing_salesforceGoLinks_item_prop)) {
1627
+ return false;
1628
+ }
1629
+ });
1630
+ if (equals_salesforceGoLinks_items_props === false) {
1631
+ return false;
1632
+ }
1633
+ });
1634
+ if (equals_salesforceGoLinks_items === false) {
1635
+ return false;
1636
+ }
1637
+ const existing_tags = existing.tags;
1638
+ const incoming_tags = incoming.tags;
1639
+ const equals_tags_items = equalsArray(existing_tags, incoming_tags, (existing_tags_item, incoming_tags_item) => {
1640
+ if (!(equals$b(existing_tags_item, incoming_tags_item))) {
1641
+ return false;
1642
+ }
1643
+ });
1644
+ if (equals_tags_items === false) {
1645
+ return false;
1646
+ }
1647
+ const existing_usageBestPractices = existing.usageBestPractices;
1648
+ const incoming_usageBestPractices = incoming.usageBestPractices;
1649
+ if (!(existing_usageBestPractices === incoming_usageBestPractices)) {
1650
+ return false;
1651
+ }
1652
+ const existing_videoLink = existing.videoLink;
1653
+ const incoming_videoLink = incoming.videoLink;
1654
+ if (!(existing_videoLink === incoming_videoLink)) {
1655
+ return false;
1656
+ }
1657
+ return true;
1658
+ }
1659
+ const ingest$6 = function CapabilityContentOutputRepresentationIngest(input, path, luvio, store, timestamp) {
1660
+ if (process.env.NODE_ENV !== 'production') {
1661
+ const validateError = validate$6(input);
1662
+ if (validateError !== null) {
1663
+ throw validateError;
1664
+ }
1665
+ }
1666
+ const key = path.fullPath;
1667
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 200;
1668
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$6, "salesforceJourney", VERSION$6, RepresentationType$6, equals$6);
1669
+ return createLink(key);
1670
+ };
1671
+ function getTypeCacheKeys$6(rootKeySet, luvio, input, fullPathFactory) {
1672
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1673
+ const rootKey = fullPathFactory();
1674
+ rootKeySet.set(rootKey, {
1675
+ namespace: keyPrefix,
1676
+ representationName: RepresentationType$6,
1677
+ mergeable: false
1678
+ });
1679
+ }
1680
+
1681
+ function select$c(luvio, params) {
1682
+ return select$d();
1683
+ }
1684
+ function keyBuilder$a(luvio, params) {
1685
+ return keyPrefix + '::CapabilityContentOutputRepresentation:(' + 'capabilityContentId:' + params.urlParams.capabilityContentId + ')';
1686
+ }
1687
+ function getResponseCacheKeys$6(storeKeyMap, luvio, resourceParams, response) {
1688
+ getTypeCacheKeys$6(storeKeyMap, luvio, response, () => keyBuilder$a(luvio, resourceParams));
1689
+ }
1690
+ function ingestSuccess$6(luvio, resourceParams, response, snapshotRefresh) {
1691
+ const { body } = response;
1692
+ const key = keyBuilder$a(luvio, resourceParams);
1693
+ luvio.storeIngest(key, ingest$6, body);
1694
+ const snapshot = luvio.storeLookup({
1695
+ recordId: key,
1696
+ node: select$c(),
1697
+ variables: {},
1698
+ }, snapshotRefresh);
1699
+ if (process.env.NODE_ENV !== 'production') {
1700
+ if (snapshot.state !== 'Fulfilled') {
1701
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1702
+ }
1703
+ }
1704
+ deepFreeze(snapshot.data);
1705
+ return snapshot;
1706
+ }
1707
+ function ingestError$4(luvio, params, error, snapshotRefresh) {
1708
+ const key = keyBuilder$a(luvio, params);
1709
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1710
+ luvio.storeIngestError(key, errorSnapshot);
1711
+ return errorSnapshot;
1712
+ }
1713
+ function createResourceRequest$6(config) {
1714
+ const headers = {};
1715
+ return {
1716
+ baseUri: '/services/data/v66.0',
1717
+ basePath: '/connect/salesforce-journey/capability-content/' + config.urlParams.capabilityContentId + '',
1718
+ method: 'get',
1719
+ body: null,
1720
+ urlParams: config.urlParams,
1721
+ queryParams: {},
1722
+ headers,
1723
+ priority: 'normal',
1724
+ };
1725
+ }
1726
+
1727
+ const adapterName$6 = 'getCapabilityContentDocument';
1728
+ const getCapabilityContentDocument_ConfigPropertyMetadata = [
1729
+ generateParamConfigMetadata('capabilityContentId', true, 0 /* UrlParameter */, 0 /* String */),
1730
+ ];
1731
+ const getCapabilityContentDocument_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$6, getCapabilityContentDocument_ConfigPropertyMetadata);
1732
+ const createResourceParams$6 = /*#__PURE__*/ createResourceParams$9(getCapabilityContentDocument_ConfigPropertyMetadata);
1733
+ function keyBuilder$9(luvio, config) {
1734
+ const resourceParams = createResourceParams$6(config);
1735
+ return keyBuilder$a(luvio, resourceParams);
1736
+ }
1737
+ function typeCheckConfig$6(untrustedConfig) {
1738
+ const config = {};
1739
+ typeCheckConfig$9(untrustedConfig, config, getCapabilityContentDocument_ConfigPropertyMetadata);
1740
+ return config;
1741
+ }
1742
+ function validateAdapterConfig$6(untrustedConfig, configPropertyNames) {
1743
+ if (!untrustedIsObject(untrustedConfig)) {
1744
+ return null;
1745
+ }
1746
+ if (process.env.NODE_ENV !== 'production') {
1747
+ validateConfig(untrustedConfig, configPropertyNames);
1748
+ }
1749
+ const config = typeCheckConfig$6(untrustedConfig);
1750
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1751
+ return null;
1752
+ }
1753
+ return config;
1754
+ }
1755
+ function adapterFragment$4(luvio, config) {
1756
+ createResourceParams$6(config);
1757
+ return select$c();
1758
+ }
1759
+ function onFetchResponseSuccess$4(luvio, config, resourceParams, response) {
1760
+ const snapshot = ingestSuccess$6(luvio, resourceParams, response, {
1761
+ config,
1762
+ resolve: () => buildNetworkSnapshot$6(luvio, config, snapshotRefreshOptions)
1763
+ });
1764
+ return luvio.storeBroadcast().then(() => snapshot);
1765
+ }
1766
+ function onFetchResponseError$4(luvio, config, resourceParams, response) {
1767
+ const snapshot = ingestError$4(luvio, resourceParams, response, {
1768
+ config,
1769
+ resolve: () => buildNetworkSnapshot$6(luvio, config, snapshotRefreshOptions)
1770
+ });
1771
+ return luvio.storeBroadcast().then(() => snapshot);
1772
+ }
1773
+ function buildNetworkSnapshot$6(luvio, config, options) {
1774
+ const resourceParams = createResourceParams$6(config);
1775
+ const request = createResourceRequest$6(resourceParams);
1776
+ return luvio.dispatchResourceRequest(request, options)
1777
+ .then((response) => {
1778
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$4(luvio, config, resourceParams, response), () => {
1779
+ const cache = new StoreKeyMap();
1780
+ getResponseCacheKeys$6(cache, luvio, resourceParams, response.body);
1781
+ return cache;
1782
+ });
1783
+ }, (response) => {
1784
+ return luvio.handleErrorResponse(() => onFetchResponseError$4(luvio, config, resourceParams, response));
1785
+ });
1786
+ }
1787
+ function buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext) {
1788
+ return buildNetworkSnapshotCachePolicy$6(context, coercedAdapterRequestContext, buildNetworkSnapshot$6, undefined, false);
1789
+ }
1790
+ function buildCachedSnapshotCachePolicy$4(context, storeLookup) {
1791
+ const { luvio, config } = context;
1792
+ const selector = {
1793
+ recordId: keyBuilder$9(luvio, config),
1794
+ node: adapterFragment$4(luvio, config),
1795
+ variables: {},
1796
+ };
1797
+ const cacheSnapshot = storeLookup(selector, {
1798
+ config,
1799
+ resolve: () => buildNetworkSnapshot$6(luvio, config, snapshotRefreshOptions)
1800
+ });
1801
+ return cacheSnapshot;
1802
+ }
1803
+ const getCapabilityContentDocumentAdapterFactory = (luvio) => function salesforceJourney__getCapabilityContentDocument(untrustedConfig, requestContext) {
1804
+ const config = validateAdapterConfig$6(untrustedConfig, getCapabilityContentDocument_ConfigPropertyNames);
1805
+ // Invalid or incomplete config
1806
+ if (config === null) {
1807
+ return null;
1808
+ }
1809
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1810
+ buildCachedSnapshotCachePolicy$4, buildNetworkSnapshotCachePolicy$4);
1811
+ };
1812
+
1813
+ const VERSION$5 = "0aaacbc550970554716e5d15e3ba9550";
1814
+ function validate$5(obj, path = 'CapabilitySearchResultOutputRepresentation') {
1815
+ const v_error = (() => {
1816
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1817
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1818
+ }
1819
+ const obj_contentDurableIds = obj.contentDurableIds;
1820
+ const path_contentDurableIds = path + '.contentDurableIds';
1821
+ if (!ArrayIsArray(obj_contentDurableIds)) {
1822
+ return new TypeError('Expected "array" but received "' + typeof obj_contentDurableIds + '" (at "' + path_contentDurableIds + '")');
1823
+ }
1824
+ for (let i = 0; i < obj_contentDurableIds.length; i++) {
1825
+ const obj_contentDurableIds_item = obj_contentDurableIds[i];
1826
+ const path_contentDurableIds_item = path_contentDurableIds + '[' + i + ']';
1827
+ if (typeof obj_contentDurableIds_item !== 'string') {
1828
+ return new TypeError('Expected "string" but received "' + typeof obj_contentDurableIds_item + '" (at "' + path_contentDurableIds_item + '")');
1829
+ }
1830
+ }
1831
+ })();
1832
+ return v_error === undefined ? null : v_error;
1833
+ }
1834
+ const RepresentationType$5 = 'CapabilitySearchResultOutputRepresentation';
1835
+ function normalize$5(input, existing, path, luvio, store, timestamp) {
1836
+ return input;
1837
+ }
1838
+ const select$b = function CapabilitySearchResultOutputRepresentationSelect() {
1839
+ return {
1840
+ kind: 'Fragment',
1841
+ version: VERSION$5,
1842
+ private: [],
1843
+ selections: [
1844
+ {
1845
+ name: 'contentDurableIds',
1846
+ kind: 'Scalar',
1847
+ plural: true
1848
+ }
1849
+ ]
1850
+ };
1851
+ };
1852
+ function equals$5(existing, incoming) {
1853
+ const existing_contentDurableIds = existing.contentDurableIds;
1854
+ const incoming_contentDurableIds = incoming.contentDurableIds;
1855
+ const equals_contentDurableIds_items = equalsArray(existing_contentDurableIds, incoming_contentDurableIds, (existing_contentDurableIds_item, incoming_contentDurableIds_item) => {
1856
+ if (!(existing_contentDurableIds_item === incoming_contentDurableIds_item)) {
1857
+ return false;
1858
+ }
1859
+ });
1860
+ if (equals_contentDurableIds_items === false) {
1861
+ return false;
1862
+ }
1863
+ return true;
1864
+ }
1865
+ const ingest$5 = function CapabilitySearchResultOutputRepresentationIngest(input, path, luvio, store, timestamp) {
1866
+ if (process.env.NODE_ENV !== 'production') {
1867
+ const validateError = validate$5(input);
1868
+ if (validateError !== null) {
1869
+ throw validateError;
1870
+ }
1871
+ }
1872
+ const key = path.fullPath;
1873
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 200;
1874
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$5, "salesforceJourney", VERSION$5, RepresentationType$5, equals$5);
1875
+ return createLink(key);
1876
+ };
1877
+ function getTypeCacheKeys$5(rootKeySet, luvio, input, fullPathFactory) {
1878
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1879
+ const rootKey = fullPathFactory();
1880
+ rootKeySet.set(rootKey, {
1881
+ namespace: keyPrefix,
1882
+ representationName: RepresentationType$5,
1883
+ mergeable: false
1884
+ });
1885
+ }
1886
+
1887
+ function select$a(luvio, params) {
1888
+ return select$b();
1889
+ }
1890
+ function keyBuilder$8(luvio, params) {
1891
+ return keyPrefix + '::CapabilitySearchResultOutputRepresentation:(' + 'searchTerm:' + params.queryParams.searchTerm + ',' + 'cloudOwnership:' + params.urlParams.cloudOwnership + ')';
1892
+ }
1893
+ function getResponseCacheKeys$5(storeKeyMap, luvio, resourceParams, response) {
1894
+ getTypeCacheKeys$5(storeKeyMap, luvio, response, () => keyBuilder$8(luvio, resourceParams));
1895
+ }
1896
+ function ingestSuccess$5(luvio, resourceParams, response, snapshotRefresh) {
1897
+ const { body } = response;
1898
+ const key = keyBuilder$8(luvio, resourceParams);
1899
+ luvio.storeIngest(key, ingest$5, body);
1900
+ const snapshot = luvio.storeLookup({
1901
+ recordId: key,
1902
+ node: select$a(),
1903
+ variables: {},
1904
+ }, snapshotRefresh);
1905
+ if (process.env.NODE_ENV !== 'production') {
1906
+ if (snapshot.state !== 'Fulfilled') {
1907
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1908
+ }
1909
+ }
1910
+ deepFreeze(snapshot.data);
1911
+ return snapshot;
1912
+ }
1913
+ function ingestError$3(luvio, params, error, snapshotRefresh) {
1914
+ const key = keyBuilder$8(luvio, params);
1915
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1916
+ luvio.storeIngestError(key, errorSnapshot);
1917
+ return errorSnapshot;
1918
+ }
1919
+ function createResourceRequest$5(config) {
1920
+ const headers = {};
1921
+ return {
1922
+ baseUri: '/services/data/v66.0',
1923
+ basePath: '/connect/salesforce-journey/' + config.urlParams.cloudOwnership + '/capability-search',
1924
+ method: 'get',
1925
+ body: null,
1926
+ urlParams: config.urlParams,
1927
+ queryParams: config.queryParams,
1928
+ headers,
1929
+ priority: 'normal',
1930
+ };
1931
+ }
1932
+
1933
+ const adapterName$5 = 'getCapabilitySearchResult';
1934
+ const getCapabilitySearchResult_ConfigPropertyMetadata = [
1935
+ generateParamConfigMetadata('cloudOwnership', true, 0 /* UrlParameter */, 0 /* String */),
1936
+ generateParamConfigMetadata('searchTerm', false, 1 /* QueryParameter */, 0 /* String */),
1937
+ ];
1938
+ const getCapabilitySearchResult_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$5, getCapabilitySearchResult_ConfigPropertyMetadata);
1939
+ const createResourceParams$5 = /*#__PURE__*/ createResourceParams$9(getCapabilitySearchResult_ConfigPropertyMetadata);
1940
+ function keyBuilder$7(luvio, config) {
1941
+ const resourceParams = createResourceParams$5(config);
1942
+ return keyBuilder$8(luvio, resourceParams);
1943
+ }
1944
+ function typeCheckConfig$5(untrustedConfig) {
1945
+ const config = {};
1946
+ typeCheckConfig$9(untrustedConfig, config, getCapabilitySearchResult_ConfigPropertyMetadata);
1947
+ return config;
1948
+ }
1949
+ function validateAdapterConfig$5(untrustedConfig, configPropertyNames) {
1950
+ if (!untrustedIsObject(untrustedConfig)) {
1951
+ return null;
1952
+ }
1953
+ if (process.env.NODE_ENV !== 'production') {
1954
+ validateConfig(untrustedConfig, configPropertyNames);
1955
+ }
1956
+ const config = typeCheckConfig$5(untrustedConfig);
1957
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1958
+ return null;
1959
+ }
1960
+ return config;
1961
+ }
1962
+ function adapterFragment$3(luvio, config) {
1963
+ createResourceParams$5(config);
1964
+ return select$a();
1965
+ }
1966
+ function onFetchResponseSuccess$3(luvio, config, resourceParams, response) {
1967
+ const snapshot = ingestSuccess$5(luvio, resourceParams, response, {
1968
+ config,
1969
+ resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
1970
+ });
1971
+ return luvio.storeBroadcast().then(() => snapshot);
1972
+ }
1973
+ function onFetchResponseError$3(luvio, config, resourceParams, response) {
1974
+ const snapshot = ingestError$3(luvio, resourceParams, response, {
1975
+ config,
1976
+ resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
1977
+ });
1978
+ return luvio.storeBroadcast().then(() => snapshot);
1979
+ }
1980
+ function buildNetworkSnapshot$5(luvio, config, options) {
1981
+ const resourceParams = createResourceParams$5(config);
1982
+ const request = createResourceRequest$5(resourceParams);
1983
+ return luvio.dispatchResourceRequest(request, options)
1984
+ .then((response) => {
1985
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$3(luvio, config, resourceParams, response), () => {
1986
+ const cache = new StoreKeyMap();
1987
+ getResponseCacheKeys$5(cache, luvio, resourceParams, response.body);
1988
+ return cache;
1989
+ });
1990
+ }, (response) => {
1991
+ return luvio.handleErrorResponse(() => onFetchResponseError$3(luvio, config, resourceParams, response));
1992
+ });
1993
+ }
1994
+ function buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext) {
1995
+ return buildNetworkSnapshotCachePolicy$6(context, coercedAdapterRequestContext, buildNetworkSnapshot$5, undefined, false);
1996
+ }
1997
+ function buildCachedSnapshotCachePolicy$3(context, storeLookup) {
1998
+ const { luvio, config } = context;
1999
+ const selector = {
2000
+ recordId: keyBuilder$7(luvio, config),
2001
+ node: adapterFragment$3(luvio, config),
2002
+ variables: {},
2003
+ };
2004
+ const cacheSnapshot = storeLookup(selector, {
2005
+ config,
2006
+ resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
2007
+ });
2008
+ return cacheSnapshot;
2009
+ }
2010
+ const getCapabilitySearchResultAdapterFactory = (luvio) => function salesforceJourney__getCapabilitySearchResult(untrustedConfig, requestContext) {
2011
+ const config = validateAdapterConfig$5(untrustedConfig, getCapabilitySearchResult_ConfigPropertyNames);
2012
+ // Invalid or incomplete config
2013
+ if (config === null) {
2014
+ return null;
2015
+ }
2016
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
2017
+ buildCachedSnapshotCachePolicy$3, buildNetworkSnapshotCachePolicy$3);
2018
+ };
2019
+
2020
+ const VERSION$4 = "8d1d823f5c53e9cc5543947a80740ff8";
2021
+ function validate$4(obj, path = 'CategoriesMetadataOutputRepresentation') {
2022
+ const v_error = (() => {
2023
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
2024
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
2025
+ }
2026
+ const obj_businessGoals = obj.businessGoals;
2027
+ const path_businessGoals = path + '.businessGoals';
2028
+ if (!ArrayIsArray(obj_businessGoals)) {
2029
+ return new TypeError('Expected "array" but received "' + typeof obj_businessGoals + '" (at "' + path_businessGoals + '")');
2030
+ }
2031
+ for (let i = 0; i < obj_businessGoals.length; i++) {
2032
+ const obj_businessGoals_item = obj_businessGoals[i];
2033
+ const path_businessGoals_item = path_businessGoals + '[' + i + ']';
2034
+ const referencepath_businessGoals_itemValidationError = validate$b(obj_businessGoals_item, path_businessGoals_item);
2035
+ if (referencepath_businessGoals_itemValidationError !== null) {
2036
+ let message = 'Object doesn\'t match TermOutputRepresentation (at "' + path_businessGoals_item + '")\n';
2037
+ message += referencepath_businessGoals_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2038
+ return new TypeError(message);
2039
+ }
2040
+ }
2041
+ const obj_categories = obj.categories;
2042
+ const path_categories = path + '.categories';
2043
+ if (!ArrayIsArray(obj_categories)) {
2044
+ return new TypeError('Expected "array" but received "' + typeof obj_categories + '" (at "' + path_categories + '")');
2045
+ }
2046
+ for (let i = 0; i < obj_categories.length; i++) {
2047
+ const obj_categories_item = obj_categories[i];
2048
+ const path_categories_item = path_categories + '[' + i + ']';
2049
+ const referencepath_categories_itemValidationError = validate$a(obj_categories_item, path_categories_item);
2050
+ if (referencepath_categories_itemValidationError !== null) {
2051
+ let message = 'Object doesn\'t match CategoryTreeNodeOutputRepresentation (at "' + path_categories_item + '")\n';
2052
+ message += referencepath_categories_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2053
+ return new TypeError(message);
2054
+ }
2055
+ }
2056
+ const obj_editions = obj.editions;
2057
+ const path_editions = path + '.editions';
2058
+ if (!ArrayIsArray(obj_editions)) {
2059
+ return new TypeError('Expected "array" but received "' + typeof obj_editions + '" (at "' + path_editions + '")');
2060
+ }
2061
+ for (let i = 0; i < obj_editions.length; i++) {
2062
+ const obj_editions_item = obj_editions[i];
2063
+ const path_editions_item = path_editions + '[' + i + ']';
2064
+ const referencepath_editions_itemValidationError = validate$b(obj_editions_item, path_editions_item);
2065
+ if (referencepath_editions_itemValidationError !== null) {
2066
+ let message = 'Object doesn\'t match TermOutputRepresentation (at "' + path_editions_item + '")\n';
2067
+ message += referencepath_editions_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2068
+ return new TypeError(message);
2069
+ }
2070
+ }
2071
+ const obj_stages = obj.stages;
2072
+ const path_stages = path + '.stages';
2073
+ if (!ArrayIsArray(obj_stages)) {
2074
+ return new TypeError('Expected "array" but received "' + typeof obj_stages + '" (at "' + path_stages + '")');
2075
+ }
2076
+ for (let i = 0; i < obj_stages.length; i++) {
2077
+ const obj_stages_item = obj_stages[i];
2078
+ const path_stages_item = path_stages + '[' + i + ']';
2079
+ const referencepath_stages_itemValidationError = validate$b(obj_stages_item, path_stages_item);
2080
+ if (referencepath_stages_itemValidationError !== null) {
2081
+ let message = 'Object doesn\'t match TermOutputRepresentation (at "' + path_stages_item + '")\n';
2082
+ message += referencepath_stages_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2083
+ return new TypeError(message);
2084
+ }
2085
+ }
2086
+ const obj_statuses = obj.statuses;
2087
+ const path_statuses = path + '.statuses';
2088
+ if (!ArrayIsArray(obj_statuses)) {
2089
+ return new TypeError('Expected "array" but received "' + typeof obj_statuses + '" (at "' + path_statuses + '")');
2090
+ }
2091
+ for (let i = 0; i < obj_statuses.length; i++) {
2092
+ const obj_statuses_item = obj_statuses[i];
2093
+ const path_statuses_item = path_statuses + '[' + i + ']';
2094
+ const referencepath_statuses_itemValidationError = validate$b(obj_statuses_item, path_statuses_item);
2095
+ if (referencepath_statuses_itemValidationError !== null) {
2096
+ let message = 'Object doesn\'t match TermOutputRepresentation (at "' + path_statuses_item + '")\n';
2097
+ message += referencepath_statuses_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2098
+ return new TypeError(message);
2099
+ }
2100
+ }
2101
+ const obj_tags = obj.tags;
2102
+ const path_tags = path + '.tags';
2103
+ if (!ArrayIsArray(obj_tags)) {
2104
+ return new TypeError('Expected "array" but received "' + typeof obj_tags + '" (at "' + path_tags + '")');
2105
+ }
2106
+ for (let i = 0; i < obj_tags.length; i++) {
2107
+ const obj_tags_item = obj_tags[i];
2108
+ const path_tags_item = path_tags + '[' + i + ']';
2109
+ const referencepath_tags_itemValidationError = validate$b(obj_tags_item, path_tags_item);
2110
+ if (referencepath_tags_itemValidationError !== null) {
2111
+ let message = 'Object doesn\'t match TermOutputRepresentation (at "' + path_tags_item + '")\n';
2112
+ message += referencepath_tags_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2113
+ return new TypeError(message);
2114
+ }
2115
+ }
2116
+ })();
2117
+ return v_error === undefined ? null : v_error;
2118
+ }
2119
+ const RepresentationType$4 = 'CategoriesMetadataOutputRepresentation';
2120
+ function normalize$4(input, existing, path, luvio, store, timestamp) {
2121
+ return input;
2122
+ }
2123
+ const select$9 = function CategoriesMetadataOutputRepresentationSelect() {
2124
+ const { selections: TermOutputRepresentation__selections, opaque: TermOutputRepresentation__opaque, } = select$j();
2125
+ const { selections: CategoryTreeNodeOutputRepresentation__selections, opaque: CategoryTreeNodeOutputRepresentation__opaque, } = select$i();
2126
+ return {
2127
+ kind: 'Fragment',
2128
+ version: VERSION$4,
2129
+ private: [],
2130
+ selections: [
2131
+ {
2132
+ name: 'businessGoals',
2133
+ kind: 'Object',
2134
+ plural: true,
2135
+ selections: TermOutputRepresentation__selections
2136
+ },
2137
+ {
2138
+ name: 'categories',
2139
+ kind: 'Object',
2140
+ plural: true,
2141
+ selections: CategoryTreeNodeOutputRepresentation__selections
2142
+ },
2143
+ {
2144
+ name: 'editions',
2145
+ kind: 'Object',
2146
+ plural: true,
2147
+ selections: TermOutputRepresentation__selections
2148
+ },
2149
+ {
2150
+ name: 'stages',
2151
+ kind: 'Object',
2152
+ plural: true,
2153
+ selections: TermOutputRepresentation__selections
2154
+ },
2155
+ {
2156
+ name: 'statuses',
2157
+ kind: 'Object',
2158
+ plural: true,
2159
+ selections: TermOutputRepresentation__selections
2160
+ },
2161
+ {
2162
+ name: 'tags',
2163
+ kind: 'Object',
2164
+ plural: true,
2165
+ selections: TermOutputRepresentation__selections
2166
+ }
2167
+ ]
2168
+ };
2169
+ };
2170
+ function equals$4(existing, incoming) {
2171
+ const existing_businessGoals = existing.businessGoals;
2172
+ const incoming_businessGoals = incoming.businessGoals;
2173
+ const equals_businessGoals_items = equalsArray(existing_businessGoals, incoming_businessGoals, (existing_businessGoals_item, incoming_businessGoals_item) => {
2174
+ if (!(equals$b(existing_businessGoals_item, incoming_businessGoals_item))) {
2175
+ return false;
2176
+ }
2177
+ });
2178
+ if (equals_businessGoals_items === false) {
2179
+ return false;
2180
+ }
2181
+ const existing_categories = existing.categories;
2182
+ const incoming_categories = incoming.categories;
2183
+ const equals_categories_items = equalsArray(existing_categories, incoming_categories, (existing_categories_item, incoming_categories_item) => {
2184
+ if (!(equals$a(existing_categories_item, incoming_categories_item))) {
2185
+ return false;
2186
+ }
2187
+ });
2188
+ if (equals_categories_items === false) {
2189
+ return false;
2190
+ }
2191
+ const existing_editions = existing.editions;
2192
+ const incoming_editions = incoming.editions;
2193
+ const equals_editions_items = equalsArray(existing_editions, incoming_editions, (existing_editions_item, incoming_editions_item) => {
2194
+ if (!(equals$b(existing_editions_item, incoming_editions_item))) {
2195
+ return false;
2196
+ }
2197
+ });
2198
+ if (equals_editions_items === false) {
2199
+ return false;
2200
+ }
2201
+ const existing_stages = existing.stages;
2202
+ const incoming_stages = incoming.stages;
2203
+ const equals_stages_items = equalsArray(existing_stages, incoming_stages, (existing_stages_item, incoming_stages_item) => {
2204
+ if (!(equals$b(existing_stages_item, incoming_stages_item))) {
2205
+ return false;
2206
+ }
2207
+ });
2208
+ if (equals_stages_items === false) {
2209
+ return false;
2210
+ }
2211
+ const existing_statuses = existing.statuses;
2212
+ const incoming_statuses = incoming.statuses;
2213
+ const equals_statuses_items = equalsArray(existing_statuses, incoming_statuses, (existing_statuses_item, incoming_statuses_item) => {
2214
+ if (!(equals$b(existing_statuses_item, incoming_statuses_item))) {
2215
+ return false;
2216
+ }
2217
+ });
2218
+ if (equals_statuses_items === false) {
2219
+ return false;
2220
+ }
2221
+ const existing_tags = existing.tags;
2222
+ const incoming_tags = incoming.tags;
2223
+ const equals_tags_items = equalsArray(existing_tags, incoming_tags, (existing_tags_item, incoming_tags_item) => {
2224
+ if (!(equals$b(existing_tags_item, incoming_tags_item))) {
2225
+ return false;
2226
+ }
2227
+ });
2228
+ if (equals_tags_items === false) {
2229
+ return false;
2230
+ }
2231
+ return true;
2232
+ }
2233
+ const ingest$4 = function CategoriesMetadataOutputRepresentationIngest(input, path, luvio, store, timestamp) {
2234
+ if (process.env.NODE_ENV !== 'production') {
2235
+ const validateError = validate$4(input);
2236
+ if (validateError !== null) {
2237
+ throw validateError;
2238
+ }
2239
+ }
2240
+ const key = path.fullPath;
2241
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 200;
2242
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$4, "salesforceJourney", VERSION$4, RepresentationType$4, equals$4);
2243
+ return createLink(key);
2244
+ };
2245
+ function getTypeCacheKeys$4(rootKeySet, luvio, input, fullPathFactory) {
2246
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
2247
+ const rootKey = fullPathFactory();
2248
+ rootKeySet.set(rootKey, {
2249
+ namespace: keyPrefix,
2250
+ representationName: RepresentationType$4,
2251
+ mergeable: false
2252
+ });
2253
+ }
2254
+
2255
+ function select$8(luvio, params) {
2256
+ return select$9();
2257
+ }
2258
+ function keyBuilder$6(luvio, params) {
2259
+ return keyPrefix + '::CategoriesMetadataOutputRepresentation:(' + 'cloudOwnership:' + params.urlParams.cloudOwnership + ')';
2260
+ }
2261
+ function getResponseCacheKeys$4(storeKeyMap, luvio, resourceParams, response) {
2262
+ getTypeCacheKeys$4(storeKeyMap, luvio, response, () => keyBuilder$6(luvio, resourceParams));
2263
+ }
2264
+ function ingestSuccess$4(luvio, resourceParams, response, snapshotRefresh) {
2265
+ const { body } = response;
2266
+ const key = keyBuilder$6(luvio, resourceParams);
2267
+ luvio.storeIngest(key, ingest$4, body);
2268
+ const snapshot = luvio.storeLookup({
2269
+ recordId: key,
2270
+ node: select$8(),
2271
+ variables: {},
2272
+ }, snapshotRefresh);
2273
+ if (process.env.NODE_ENV !== 'production') {
2274
+ if (snapshot.state !== 'Fulfilled') {
2275
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
2276
+ }
2277
+ }
2278
+ deepFreeze(snapshot.data);
2279
+ return snapshot;
2280
+ }
2281
+ function ingestError$2(luvio, params, error, snapshotRefresh) {
2282
+ const key = keyBuilder$6(luvio, params);
2283
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
2284
+ luvio.storeIngestError(key, errorSnapshot);
2285
+ return errorSnapshot;
2286
+ }
2287
+ function createResourceRequest$4(config) {
2288
+ const headers = {};
2289
+ return {
2290
+ baseUri: '/services/data/v66.0',
2291
+ basePath: '/connect/salesforce-journey/' + config.urlParams.cloudOwnership + '/categories',
2292
+ method: 'get',
2293
+ body: null,
2294
+ urlParams: config.urlParams,
2295
+ queryParams: {},
2296
+ headers,
2297
+ priority: 'normal',
2298
+ };
2299
+ }
2300
+
2301
+ const adapterName$4 = 'getCategoriesMetadata';
2302
+ const getCategoriesMetadata_ConfigPropertyMetadata = [
2303
+ generateParamConfigMetadata('cloudOwnership', true, 0 /* UrlParameter */, 0 /* String */),
2304
+ ];
2305
+ const getCategoriesMetadata_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$4, getCategoriesMetadata_ConfigPropertyMetadata);
2306
+ const createResourceParams$4 = /*#__PURE__*/ createResourceParams$9(getCategoriesMetadata_ConfigPropertyMetadata);
2307
+ function keyBuilder$5(luvio, config) {
2308
+ const resourceParams = createResourceParams$4(config);
2309
+ return keyBuilder$6(luvio, resourceParams);
2310
+ }
2311
+ function typeCheckConfig$4(untrustedConfig) {
2312
+ const config = {};
2313
+ typeCheckConfig$9(untrustedConfig, config, getCategoriesMetadata_ConfigPropertyMetadata);
2314
+ return config;
2315
+ }
2316
+ function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
2317
+ if (!untrustedIsObject(untrustedConfig)) {
2318
+ return null;
2319
+ }
2320
+ if (process.env.NODE_ENV !== 'production') {
2321
+ validateConfig(untrustedConfig, configPropertyNames);
2322
+ }
2323
+ const config = typeCheckConfig$4(untrustedConfig);
2324
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
2325
+ return null;
2326
+ }
2327
+ return config;
2328
+ }
2329
+ function adapterFragment$2(luvio, config) {
2330
+ createResourceParams$4(config);
2331
+ return select$8();
2332
+ }
2333
+ function onFetchResponseSuccess$2(luvio, config, resourceParams, response) {
2334
+ const snapshot = ingestSuccess$4(luvio, resourceParams, response, {
2335
+ config,
2336
+ resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
2337
+ });
2338
+ return luvio.storeBroadcast().then(() => snapshot);
2339
+ }
2340
+ function onFetchResponseError$2(luvio, config, resourceParams, response) {
2341
+ const snapshot = ingestError$2(luvio, resourceParams, response, {
2342
+ config,
2343
+ resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
2344
+ });
2345
+ return luvio.storeBroadcast().then(() => snapshot);
2346
+ }
2347
+ function buildNetworkSnapshot$4(luvio, config, options) {
2348
+ const resourceParams = createResourceParams$4(config);
2349
+ const request = createResourceRequest$4(resourceParams);
2350
+ return luvio.dispatchResourceRequest(request, options)
2351
+ .then((response) => {
2352
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$2(luvio, config, resourceParams, response), () => {
2353
+ const cache = new StoreKeyMap();
2354
+ getResponseCacheKeys$4(cache, luvio, resourceParams, response.body);
2355
+ return cache;
2356
+ });
2357
+ }, (response) => {
2358
+ return luvio.handleErrorResponse(() => onFetchResponseError$2(luvio, config, resourceParams, response));
2359
+ });
2360
+ }
2361
+ function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
2362
+ return buildNetworkSnapshotCachePolicy$6(context, coercedAdapterRequestContext, buildNetworkSnapshot$4, undefined, false);
2363
+ }
2364
+ function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
2365
+ const { luvio, config } = context;
2366
+ const selector = {
2367
+ recordId: keyBuilder$5(luvio, config),
2368
+ node: adapterFragment$2(luvio, config),
2369
+ variables: {},
2370
+ };
2371
+ const cacheSnapshot = storeLookup(selector, {
2372
+ config,
2373
+ resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
2374
+ });
2375
+ return cacheSnapshot;
2376
+ }
2377
+ const getCategoriesMetadataAdapterFactory = (luvio) => function salesforceJourney__getCategoriesMetadata(untrustedConfig, requestContext) {
2378
+ const config = validateAdapterConfig$4(untrustedConfig, getCategoriesMetadata_ConfigPropertyNames);
2379
+ // Invalid or incomplete config
2380
+ if (config === null) {
2381
+ return null;
2382
+ }
2383
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
2384
+ buildCachedSnapshotCachePolicy$2, buildNetworkSnapshotCachePolicy$2);
2385
+ };
2386
+
2387
+ const VERSION$3 = "f9cd12205faea5e28934cfb50bf0c016";
2388
+ function validate$3(obj, path = 'MyInitiativeOutputRepresentation') {
2389
+ const v_error = (() => {
2390
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
2391
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
2392
+ }
2393
+ const obj_contentDurableId = obj.contentDurableId;
2394
+ const path_contentDurableId = path + '.contentDurableId';
2395
+ if (typeof obj_contentDurableId !== 'string') {
2396
+ return new TypeError('Expected "string" but received "' + typeof obj_contentDurableId + '" (at "' + path_contentDurableId + '")');
2397
+ }
2398
+ const obj_id = obj.id;
2399
+ const path_id = path + '.id';
2400
+ if (typeof obj_id !== 'string') {
2401
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
2402
+ }
2403
+ const obj_stage = obj.stage;
2404
+ const path_stage = path + '.stage';
2405
+ if (typeof obj_stage !== 'string') {
2406
+ return new TypeError('Expected "string" but received "' + typeof obj_stage + '" (at "' + path_stage + '")');
2407
+ }
2408
+ const obj_status = obj.status;
2409
+ const path_status = path + '.status';
2410
+ if (typeof obj_status !== 'string') {
2411
+ return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
2412
+ }
2413
+ })();
2414
+ return v_error === undefined ? null : v_error;
2415
+ }
2416
+ const RepresentationType$3 = 'MyInitiativeOutputRepresentation';
2417
+ function keyBuilder$4(luvio, config) {
2418
+ return keyPrefix + '::' + RepresentationType$3 + ':' + config.id;
2419
+ }
2420
+ function keyBuilderFromType(luvio, object) {
2421
+ const keyParams = {
2422
+ id: object.id
2423
+ };
2424
+ return keyBuilder$4(luvio, keyParams);
2425
+ }
2426
+ function normalize$3(input, existing, path, luvio, store, timestamp) {
2427
+ return input;
2428
+ }
2429
+ const select$7 = function MyInitiativeOutputRepresentationSelect() {
2430
+ return {
2431
+ kind: 'Fragment',
2432
+ version: VERSION$3,
2433
+ private: [],
2434
+ selections: [
2435
+ {
2436
+ name: 'contentDurableId',
2437
+ kind: 'Scalar'
2438
+ },
2439
+ {
2440
+ name: 'id',
2441
+ kind: 'Scalar'
2442
+ },
2443
+ {
2444
+ name: 'stage',
2445
+ kind: 'Scalar'
2446
+ },
2447
+ {
2448
+ name: 'status',
2449
+ kind: 'Scalar'
2450
+ }
2451
+ ]
2452
+ };
2453
+ };
2454
+ function equals$3(existing, incoming) {
2455
+ const existing_contentDurableId = existing.contentDurableId;
2456
+ const incoming_contentDurableId = incoming.contentDurableId;
2457
+ if (!(existing_contentDurableId === incoming_contentDurableId)) {
2458
+ return false;
2459
+ }
2460
+ const existing_id = existing.id;
2461
+ const incoming_id = incoming.id;
2462
+ if (!(existing_id === incoming_id)) {
2463
+ return false;
2464
+ }
2465
+ const existing_stage = existing.stage;
2466
+ const incoming_stage = incoming.stage;
2467
+ if (!(existing_stage === incoming_stage)) {
2468
+ return false;
2469
+ }
2470
+ const existing_status = existing.status;
2471
+ const incoming_status = incoming.status;
2472
+ if (!(existing_status === incoming_status)) {
2473
+ return false;
2474
+ }
2475
+ return true;
2476
+ }
2477
+ const ingest$3 = function MyInitiativeOutputRepresentationIngest(input, path, luvio, store, timestamp) {
2478
+ if (process.env.NODE_ENV !== 'production') {
2479
+ const validateError = validate$3(input);
2480
+ if (validateError !== null) {
2481
+ throw validateError;
2482
+ }
2483
+ }
2484
+ const key = keyBuilderFromType(luvio, input);
2485
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 200;
2486
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "salesforceJourney", VERSION$3, RepresentationType$3, equals$3);
2487
+ return createLink(key);
2488
+ };
2489
+ function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
2490
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
2491
+ const rootKey = keyBuilderFromType(luvio, input);
2492
+ rootKeySet.set(rootKey, {
2493
+ namespace: keyPrefix,
2494
+ representationName: RepresentationType$3,
2495
+ mergeable: false
2496
+ });
2497
+ }
2498
+
2499
+ const VERSION$2 = "9822c8db7cc8e91ee1d5c02960464232";
2500
+ function validate$2(obj, path = 'InitiativeOutputRepresentation') {
2501
+ const v_error = (() => {
2502
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
2503
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
2504
+ }
2505
+ const obj_businessGoals = obj.businessGoals;
2506
+ const path_businessGoals = path + '.businessGoals';
2507
+ if (!ArrayIsArray(obj_businessGoals)) {
2508
+ return new TypeError('Expected "array" but received "' + typeof obj_businessGoals + '" (at "' + path_businessGoals + '")');
2509
+ }
2510
+ for (let i = 0; i < obj_businessGoals.length; i++) {
2511
+ const obj_businessGoals_item = obj_businessGoals[i];
2512
+ const path_businessGoals_item = path_businessGoals + '[' + i + ']';
2513
+ const referencepath_businessGoals_itemValidationError = validate$b(obj_businessGoals_item, path_businessGoals_item);
2514
+ if (referencepath_businessGoals_itemValidationError !== null) {
2515
+ let message = 'Object doesn\'t match TermOutputRepresentation (at "' + path_businessGoals_item + '")\n';
2516
+ message += referencepath_businessGoals_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2517
+ return new TypeError(message);
2518
+ }
2519
+ }
2520
+ const obj_category = obj.category;
2521
+ const path_category = path + '.category';
2522
+ const referencepath_categoryValidationError = validate$b(obj_category, path_category);
2523
+ if (referencepath_categoryValidationError !== null) {
2524
+ let message = 'Object doesn\'t match TermOutputRepresentation (at "' + path_category + '")\n';
2525
+ message += referencepath_categoryValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2526
+ return new TypeError(message);
2527
+ }
2528
+ const obj_contentDurableId = obj.contentDurableId;
2529
+ const path_contentDurableId = path + '.contentDurableId';
2530
+ if (typeof obj_contentDurableId !== 'string') {
2531
+ return new TypeError('Expected "string" but received "' + typeof obj_contentDurableId + '" (at "' + path_contentDurableId + '")');
2532
+ }
2533
+ const obj_description = obj.description;
2534
+ const path_description = path + '.description';
2535
+ if (typeof obj_description !== 'string') {
2536
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
2537
+ }
2538
+ const obj_myInitiative = obj.myInitiative;
2539
+ const path_myInitiative = path + '.myInitiative';
2540
+ let obj_myInitiative_union0 = null;
2541
+ const obj_myInitiative_union0_error = (() => {
2542
+ if (typeof obj_myInitiative !== 'object' || Array.isArray(obj_myInitiative)) {
2543
+ return new TypeError('Expected "object" but received "' + typeof obj_myInitiative + '" (at "' + path_myInitiative + '")');
2544
+ }
2545
+ })();
2546
+ if (obj_myInitiative_union0_error != null) {
2547
+ obj_myInitiative_union0 = obj_myInitiative_union0_error.message;
2548
+ }
2549
+ let obj_myInitiative_union1 = null;
2550
+ const obj_myInitiative_union1_error = (() => {
2551
+ if (obj_myInitiative !== null) {
2552
+ return new TypeError('Expected "null" but received "' + typeof obj_myInitiative + '" (at "' + path_myInitiative + '")');
2553
+ }
2554
+ })();
2555
+ if (obj_myInitiative_union1_error != null) {
2556
+ obj_myInitiative_union1 = obj_myInitiative_union1_error.message;
2557
+ }
2558
+ if (obj_myInitiative_union0 && obj_myInitiative_union1) {
2559
+ let message = 'Object doesn\'t match union (at "' + path_myInitiative + '")';
2560
+ message += '\n' + obj_myInitiative_union0.split('\n').map((line) => '\t' + line).join('\n');
2561
+ message += '\n' + obj_myInitiative_union1.split('\n').map((line) => '\t' + line).join('\n');
2562
+ return new TypeError(message);
2563
+ }
2564
+ const obj_name = obj.name;
2565
+ const path_name = path + '.name';
2566
+ if (typeof obj_name !== 'string') {
2567
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
2568
+ }
2569
+ const obj_relatedCapabilities = obj.relatedCapabilities;
2570
+ const path_relatedCapabilities = path + '.relatedCapabilities';
2571
+ if (!ArrayIsArray(obj_relatedCapabilities)) {
2572
+ return new TypeError('Expected "array" but received "' + typeof obj_relatedCapabilities + '" (at "' + path_relatedCapabilities + '")');
2573
+ }
2574
+ for (let i = 0; i < obj_relatedCapabilities.length; i++) {
2575
+ const obj_relatedCapabilities_item = obj_relatedCapabilities[i];
2576
+ const path_relatedCapabilities_item = path_relatedCapabilities + '[' + i + ']';
2577
+ if (typeof obj_relatedCapabilities_item !== 'string') {
2578
+ return new TypeError('Expected "string" but received "' + typeof obj_relatedCapabilities_item + '" (at "' + path_relatedCapabilities_item + '")');
2579
+ }
2580
+ }
2581
+ const obj_stage = obj.stage;
2582
+ const path_stage = path + '.stage';
2583
+ const referencepath_stageValidationError = validate$b(obj_stage, path_stage);
2584
+ if (referencepath_stageValidationError !== null) {
2585
+ let message = 'Object doesn\'t match TermOutputRepresentation (at "' + path_stage + '")\n';
2586
+ message += referencepath_stageValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2587
+ return new TypeError(message);
2588
+ }
2589
+ const obj_tags = obj.tags;
2590
+ const path_tags = path + '.tags';
2591
+ if (!ArrayIsArray(obj_tags)) {
2592
+ return new TypeError('Expected "array" but received "' + typeof obj_tags + '" (at "' + path_tags + '")');
2593
+ }
2594
+ for (let i = 0; i < obj_tags.length; i++) {
2595
+ const obj_tags_item = obj_tags[i];
2596
+ const path_tags_item = path_tags + '[' + i + ']';
2597
+ const referencepath_tags_itemValidationError = validate$b(obj_tags_item, path_tags_item);
2598
+ if (referencepath_tags_itemValidationError !== null) {
2599
+ let message = 'Object doesn\'t match TermOutputRepresentation (at "' + path_tags_item + '")\n';
2600
+ message += referencepath_tags_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2601
+ return new TypeError(message);
2602
+ }
2603
+ }
2604
+ })();
2605
+ return v_error === undefined ? null : v_error;
2606
+ }
2607
+ const RepresentationType$2 = 'InitiativeOutputRepresentation';
2608
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
2609
+ const input_myInitiative = input.myInitiative;
2610
+ const input_myInitiative_id = path.fullPath + '__myInitiative';
2611
+ if (!Array.isArray(input_myInitiative) && input_myInitiative !== null && typeof input_myInitiative === 'object') {
2612
+ input.myInitiative = ingest$3(input_myInitiative, {
2613
+ fullPath: input_myInitiative_id,
2614
+ propertyName: 'myInitiative',
2615
+ parent: {
2616
+ data: input,
2617
+ key: path.fullPath,
2618
+ existing: existing,
2619
+ },
2620
+ ttl: path.ttl
2621
+ }, luvio, store, timestamp);
2622
+ }
2623
+ return input;
2624
+ }
2625
+ const select$6 = function InitiativeOutputRepresentationSelect() {
2626
+ const { selections: TermOutputRepresentation__selections, opaque: TermOutputRepresentation__opaque, } = select$j();
2627
+ return {
2628
+ kind: 'Fragment',
2629
+ version: VERSION$2,
2630
+ private: [],
2631
+ selections: [
2632
+ {
2633
+ name: 'businessGoals',
2634
+ kind: 'Object',
2635
+ plural: true,
2636
+ selections: TermOutputRepresentation__selections
2637
+ },
2638
+ {
2639
+ name: 'category',
2640
+ kind: 'Object',
2641
+ selections: TermOutputRepresentation__selections
2642
+ },
2643
+ {
2644
+ name: 'contentDurableId',
2645
+ kind: 'Scalar'
2646
+ },
2647
+ {
2648
+ name: 'description',
2649
+ kind: 'Scalar'
2650
+ },
2651
+ {
2652
+ name: 'myInitiative',
2653
+ kind: 'Link',
2654
+ nullable: true,
2655
+ fragment: select$7()
2656
+ },
2657
+ {
2658
+ name: 'name',
2659
+ kind: 'Scalar'
2660
+ },
2661
+ {
2662
+ name: 'relatedCapabilities',
2663
+ kind: 'Scalar',
2664
+ plural: true
2665
+ },
2666
+ {
2667
+ name: 'stage',
2668
+ kind: 'Object',
2669
+ selections: TermOutputRepresentation__selections
2670
+ },
2671
+ {
2672
+ name: 'tags',
2673
+ kind: 'Object',
2674
+ plural: true,
2675
+ selections: TermOutputRepresentation__selections
2676
+ }
2677
+ ]
2678
+ };
2679
+ };
2680
+ function equals$2(existing, incoming) {
2681
+ const existing_contentDurableId = existing.contentDurableId;
2682
+ const incoming_contentDurableId = incoming.contentDurableId;
2683
+ if (!(existing_contentDurableId === incoming_contentDurableId)) {
2684
+ return false;
2685
+ }
2686
+ const existing_description = existing.description;
2687
+ const incoming_description = incoming.description;
2688
+ if (!(existing_description === incoming_description)) {
2689
+ return false;
2690
+ }
2691
+ const existing_name = existing.name;
2692
+ const incoming_name = incoming.name;
2693
+ if (!(existing_name === incoming_name)) {
2694
+ return false;
2695
+ }
2696
+ const existing_businessGoals = existing.businessGoals;
2697
+ const incoming_businessGoals = incoming.businessGoals;
2698
+ const equals_businessGoals_items = equalsArray(existing_businessGoals, incoming_businessGoals, (existing_businessGoals_item, incoming_businessGoals_item) => {
2699
+ if (!(equals$b(existing_businessGoals_item, incoming_businessGoals_item))) {
2700
+ return false;
2701
+ }
2702
+ });
2703
+ if (equals_businessGoals_items === false) {
2704
+ return false;
2705
+ }
2706
+ const existing_category = existing.category;
2707
+ const incoming_category = incoming.category;
2708
+ if (!(equals$b(existing_category, incoming_category))) {
2709
+ return false;
2710
+ }
2711
+ const existing_myInitiative = existing.myInitiative;
2712
+ const incoming_myInitiative = incoming.myInitiative;
2713
+ if (!(existing_myInitiative === incoming_myInitiative
2714
+ || (existing_myInitiative != null &&
2715
+ incoming_myInitiative != null &&
2716
+ existing_myInitiative.__ref != null &&
2717
+ incoming_myInitiative.__ref != null &&
2718
+ existing_myInitiative.__ref === incoming_myInitiative.__ref))) {
2719
+ return false;
2720
+ }
2721
+ const existing_relatedCapabilities = existing.relatedCapabilities;
2722
+ const incoming_relatedCapabilities = incoming.relatedCapabilities;
2723
+ const equals_relatedCapabilities_items = equalsArray(existing_relatedCapabilities, incoming_relatedCapabilities, (existing_relatedCapabilities_item, incoming_relatedCapabilities_item) => {
2724
+ if (!(existing_relatedCapabilities_item === incoming_relatedCapabilities_item)) {
2725
+ return false;
2726
+ }
2727
+ });
2728
+ if (equals_relatedCapabilities_items === false) {
2729
+ return false;
2730
+ }
2731
+ const existing_stage = existing.stage;
2732
+ const incoming_stage = incoming.stage;
2733
+ if (!(equals$b(existing_stage, incoming_stage))) {
2734
+ return false;
2735
+ }
2736
+ const existing_tags = existing.tags;
2737
+ const incoming_tags = incoming.tags;
2738
+ const equals_tags_items = equalsArray(existing_tags, incoming_tags, (existing_tags_item, incoming_tags_item) => {
2739
+ if (!(equals$b(existing_tags_item, incoming_tags_item))) {
2740
+ return false;
2741
+ }
2742
+ });
2743
+ if (equals_tags_items === false) {
2744
+ return false;
2745
+ }
2746
+ return true;
2747
+ }
2748
+ const ingest$2 = function InitiativeOutputRepresentationIngest(input, path, luvio, store, timestamp) {
2749
+ if (process.env.NODE_ENV !== 'production') {
2750
+ const validateError = validate$2(input);
2751
+ if (validateError !== null) {
2752
+ throw validateError;
2753
+ }
2754
+ }
2755
+ const key = path.fullPath;
2756
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 200;
2757
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "salesforceJourney", VERSION$2, RepresentationType$2, equals$2);
2758
+ return createLink(key);
2759
+ };
2760
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
2761
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
2762
+ const rootKey = fullPathFactory();
2763
+ rootKeySet.set(rootKey, {
2764
+ namespace: keyPrefix,
2765
+ representationName: RepresentationType$2,
2766
+ mergeable: false
2767
+ });
2768
+ if (!Array.isArray(input.myInitiative) && input.myInitiative !== null && typeof input.myInitiative === 'object') {
2769
+ getTypeCacheKeys$3(rootKeySet, luvio, input.myInitiative);
2770
+ }
2771
+ }
2772
+
2773
+ const VERSION$1 = "064238ed9ec6117d936ce2a3b78e93b3";
2774
+ function validate$1(obj, path = 'InitiativesCollectionOutputRepresentation') {
2775
+ const v_error = (() => {
2776
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
2777
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
2778
+ }
2779
+ const obj_initiatives = obj.initiatives;
2780
+ const path_initiatives = path + '.initiatives';
2781
+ if (!ArrayIsArray(obj_initiatives)) {
2782
+ return new TypeError('Expected "array" but received "' + typeof obj_initiatives + '" (at "' + path_initiatives + '")');
2783
+ }
2784
+ for (let i = 0; i < obj_initiatives.length; i++) {
2785
+ const obj_initiatives_item = obj_initiatives[i];
2786
+ const path_initiatives_item = path_initiatives + '[' + i + ']';
2787
+ if (typeof obj_initiatives_item !== 'object' || Array.isArray(obj_initiatives_item)) {
2788
+ return new TypeError('Expected "object" but received "' + typeof obj_initiatives_item + '" (at "' + path_initiatives_item + '")');
2789
+ }
2790
+ }
2791
+ })();
2792
+ return v_error === undefined ? null : v_error;
2793
+ }
2794
+ const RepresentationType$1 = 'InitiativesCollectionOutputRepresentation';
2795
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
2796
+ const input_initiatives = input.initiatives;
2797
+ const input_initiatives_id = path.fullPath + '__initiatives';
2798
+ for (let i = 0; i < input_initiatives.length; i++) {
2799
+ const input_initiatives_item = input_initiatives[i];
2800
+ let input_initiatives_item_id = input_initiatives_id + '__' + i;
2801
+ input_initiatives[i] = ingest$2(input_initiatives_item, {
2802
+ fullPath: input_initiatives_item_id,
2803
+ propertyName: i,
2804
+ parent: {
2805
+ data: input,
2806
+ key: path.fullPath,
2807
+ existing: existing,
2808
+ },
2809
+ ttl: path.ttl
2810
+ }, luvio, store, timestamp);
2811
+ }
2812
+ return input;
2813
+ }
2814
+ const select$5 = function InitiativesCollectionOutputRepresentationSelect() {
2815
+ return {
2816
+ kind: 'Fragment',
2817
+ version: VERSION$1,
2818
+ private: [],
2819
+ selections: [
2820
+ {
2821
+ name: 'initiatives',
2822
+ kind: 'Link',
2823
+ plural: true,
2824
+ fragment: select$6()
2825
+ }
2826
+ ]
2827
+ };
2828
+ };
2829
+ function equals$1(existing, incoming) {
2830
+ const existing_initiatives = existing.initiatives;
2831
+ const incoming_initiatives = incoming.initiatives;
2832
+ const equals_initiatives_items = equalsArray(existing_initiatives, incoming_initiatives, (existing_initiatives_item, incoming_initiatives_item) => {
2833
+ if (!(existing_initiatives_item.__ref === incoming_initiatives_item.__ref)) {
2834
+ return false;
2835
+ }
2836
+ });
2837
+ if (equals_initiatives_items === false) {
2838
+ return false;
2839
+ }
2840
+ return true;
2841
+ }
2842
+ const ingest$1 = function InitiativesCollectionOutputRepresentationIngest(input, path, luvio, store, timestamp) {
2843
+ if (process.env.NODE_ENV !== 'production') {
2844
+ const validateError = validate$1(input);
2845
+ if (validateError !== null) {
2846
+ throw validateError;
2847
+ }
2848
+ }
2849
+ const key = path.fullPath;
2850
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 200;
2851
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "salesforceJourney", VERSION$1, RepresentationType$1, equals$1);
2852
+ return createLink(key);
2853
+ };
2854
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
2855
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
2856
+ const rootKey = fullPathFactory();
2857
+ rootKeySet.set(rootKey, {
2858
+ namespace: keyPrefix,
2859
+ representationName: RepresentationType$1,
2860
+ mergeable: false
2861
+ });
2862
+ const input_initiatives_length = input.initiatives.length;
2863
+ for (let i = 0; i < input_initiatives_length; i++) {
2864
+ getTypeCacheKeys$2(rootKeySet, luvio, input.initiatives[i], () => '');
2865
+ }
2866
+ }
2867
+
2868
+ function select$4(luvio, params) {
2869
+ return select$5();
2870
+ }
2871
+ function keyBuilder$3(luvio, params) {
2872
+ return keyPrefix + '::InitiativesCollectionOutputRepresentation:(' + 'cloudOwnership:' + params.urlParams.cloudOwnership + ',' + '[' + params.body.filterConditions.map(element => 'filterConditions.filterType:' + element.filterType + '::' + 'filterConditions.values:' + element.values).join(',') + ']' + ')';
2873
+ }
2874
+ function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
2875
+ getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$3(luvio, resourceParams));
2876
+ }
2877
+ function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
2878
+ const { body } = response;
2879
+ const key = keyBuilder$3(luvio, resourceParams);
2880
+ luvio.storeIngest(key, ingest$1, body);
2881
+ const snapshot = luvio.storeLookup({
2882
+ recordId: key,
2883
+ node: select$4(),
2884
+ variables: {},
2885
+ }, snapshotRefresh);
2886
+ if (process.env.NODE_ENV !== 'production') {
2887
+ if (snapshot.state !== 'Fulfilled') {
2888
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
2889
+ }
2890
+ }
2891
+ deepFreeze(snapshot.data);
2892
+ return snapshot;
2893
+ }
2894
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
2895
+ const key = keyBuilder$3(luvio, params);
2896
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
2897
+ luvio.storeIngestError(key, errorSnapshot);
2898
+ return errorSnapshot;
2899
+ }
2900
+ function createResourceRequest$3(config) {
2901
+ const headers = {};
2902
+ return {
2903
+ baseUri: '/services/data/v66.0',
2904
+ basePath: '/connect/salesforce-journey/' + config.urlParams.cloudOwnership + '/journey-map/initiatives',
2905
+ method: 'post',
2906
+ body: config.body,
2907
+ urlParams: config.urlParams,
2908
+ queryParams: {},
2909
+ headers,
2910
+ priority: 'normal',
2911
+ };
2912
+ }
2913
+
2914
+ const adapterName$3 = 'getInitiatives';
2915
+ const getInitiatives_ConfigPropertyMetadata = [
2916
+ generateParamConfigMetadata('cloudOwnership', true, 0 /* UrlParameter */, 0 /* String */),
2917
+ generateParamConfigMetadata('filterConditions', true, 2 /* Body */, 4 /* Unsupported */, true),
2918
+ ];
2919
+ const getInitiatives_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, getInitiatives_ConfigPropertyMetadata);
2920
+ const createResourceParams$3 = /*#__PURE__*/ createResourceParams$9(getInitiatives_ConfigPropertyMetadata);
2921
+ function keyBuilder$2(luvio, config) {
2922
+ const resourceParams = createResourceParams$3(config);
2923
+ return keyBuilder$3(luvio, resourceParams);
2924
+ }
2925
+ function typeCheckConfig$3(untrustedConfig) {
2926
+ const config = {};
2927
+ typeCheckConfig$9(untrustedConfig, config, getInitiatives_ConfigPropertyMetadata);
2928
+ const untrustedConfig_filterConditions = untrustedConfig.filterConditions;
2929
+ if (ArrayIsArray$1(untrustedConfig_filterConditions)) {
2930
+ const untrustedConfig_filterConditions_array = [];
2931
+ for (let i = 0, arrayLength = untrustedConfig_filterConditions.length; i < arrayLength; i++) {
2932
+ const untrustedConfig_filterConditions_item = untrustedConfig_filterConditions[i];
2933
+ const referenceFilterConditionInputRepresentationValidationError = validate$c(untrustedConfig_filterConditions_item);
2934
+ if (referenceFilterConditionInputRepresentationValidationError === null) {
2935
+ untrustedConfig_filterConditions_array.push(untrustedConfig_filterConditions_item);
2936
+ }
2937
+ }
2938
+ config.filterConditions = untrustedConfig_filterConditions_array;
2939
+ }
2940
+ return config;
2941
+ }
2942
+ function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
2943
+ if (!untrustedIsObject(untrustedConfig)) {
2944
+ return null;
2945
+ }
2946
+ if (process.env.NODE_ENV !== 'production') {
2947
+ validateConfig(untrustedConfig, configPropertyNames);
2948
+ }
2949
+ const config = typeCheckConfig$3(untrustedConfig);
2950
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
2951
+ return null;
2952
+ }
2953
+ return config;
2954
+ }
2955
+ function adapterFragment$1(luvio, config) {
2956
+ createResourceParams$3(config);
2957
+ return select$4();
2958
+ }
2959
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
2960
+ const snapshot = ingestSuccess$3(luvio, resourceParams, response, {
2961
+ config,
2962
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
2963
+ });
2964
+ return luvio.storeBroadcast().then(() => snapshot);
2965
+ }
2966
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
2967
+ const snapshot = ingestError$1(luvio, resourceParams, response, {
2968
+ config,
2969
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
2970
+ });
2971
+ return luvio.storeBroadcast().then(() => snapshot);
2972
+ }
2973
+ function buildNetworkSnapshot$3(luvio, config, options) {
2974
+ const resourceParams = createResourceParams$3(config);
2975
+ const request = createResourceRequest$3(resourceParams);
2976
+ return luvio.dispatchResourceRequest(request, options)
2977
+ .then((response) => {
2978
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
2979
+ const cache = new StoreKeyMap();
2980
+ getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
2981
+ return cache;
2982
+ });
2983
+ }, (response) => {
2984
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
2985
+ });
2986
+ }
2987
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
2988
+ return buildNetworkSnapshotCachePolicy$6(context, coercedAdapterRequestContext, buildNetworkSnapshot$3, 'get', false);
2989
+ }
2990
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
2991
+ const { luvio, config } = context;
2992
+ const selector = {
2993
+ recordId: keyBuilder$2(luvio, config),
2994
+ node: adapterFragment$1(luvio, config),
2995
+ variables: {},
2996
+ };
2997
+ const cacheSnapshot = storeLookup(selector, {
2998
+ config,
2999
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
3000
+ });
3001
+ return cacheSnapshot;
3002
+ }
3003
+ const getInitiativesAdapterFactory = (luvio) => function salesforceJourney__getInitiatives(untrustedConfig, requestContext) {
3004
+ const config = validateAdapterConfig$3(untrustedConfig, getInitiatives_ConfigPropertyNames);
3005
+ // Invalid or incomplete config
3006
+ if (config === null) {
3007
+ return null;
3008
+ }
3009
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
3010
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
3011
+ };
3012
+
3013
+ const VERSION = "ce70d220beb15d1af2131482f611c385";
3014
+ function validate(obj, path = 'JourneyMapMetadataOutputRepresentation') {
3015
+ const v_error = (() => {
3016
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
3017
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
3018
+ }
3019
+ const obj_businessGoals = obj.businessGoals;
3020
+ const path_businessGoals = path + '.businessGoals';
3021
+ if (!ArrayIsArray(obj_businessGoals)) {
3022
+ return new TypeError('Expected "array" but received "' + typeof obj_businessGoals + '" (at "' + path_businessGoals + '")');
3023
+ }
3024
+ for (let i = 0; i < obj_businessGoals.length; i++) {
3025
+ const obj_businessGoals_item = obj_businessGoals[i];
3026
+ const path_businessGoals_item = path_businessGoals + '[' + i + ']';
3027
+ const referencepath_businessGoals_itemValidationError = validate$b(obj_businessGoals_item, path_businessGoals_item);
3028
+ if (referencepath_businessGoals_itemValidationError !== null) {
3029
+ let message = 'Object doesn\'t match TermOutputRepresentation (at "' + path_businessGoals_item + '")\n';
3030
+ message += referencepath_businessGoals_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
3031
+ return new TypeError(message);
3032
+ }
3033
+ }
3034
+ const obj_categories = obj.categories;
3035
+ const path_categories = path + '.categories';
3036
+ if (!ArrayIsArray(obj_categories)) {
3037
+ return new TypeError('Expected "array" but received "' + typeof obj_categories + '" (at "' + path_categories + '")');
3038
+ }
3039
+ for (let i = 0; i < obj_categories.length; i++) {
3040
+ const obj_categories_item = obj_categories[i];
3041
+ const path_categories_item = path_categories + '[' + i + ']';
3042
+ const referencepath_categories_itemValidationError = validate$b(obj_categories_item, path_categories_item);
3043
+ if (referencepath_categories_itemValidationError !== null) {
3044
+ let message = 'Object doesn\'t match TermOutputRepresentation (at "' + path_categories_item + '")\n';
3045
+ message += referencepath_categories_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
3046
+ return new TypeError(message);
3047
+ }
3048
+ }
3049
+ const obj_stages = obj.stages;
3050
+ const path_stages = path + '.stages';
3051
+ if (!ArrayIsArray(obj_stages)) {
3052
+ return new TypeError('Expected "array" but received "' + typeof obj_stages + '" (at "' + path_stages + '")');
3053
+ }
3054
+ for (let i = 0; i < obj_stages.length; i++) {
3055
+ const obj_stages_item = obj_stages[i];
3056
+ const path_stages_item = path_stages + '[' + i + ']';
3057
+ const referencepath_stages_itemValidationError = validate$b(obj_stages_item, path_stages_item);
3058
+ if (referencepath_stages_itemValidationError !== null) {
3059
+ let message = 'Object doesn\'t match TermOutputRepresentation (at "' + path_stages_item + '")\n';
3060
+ message += referencepath_stages_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
3061
+ return new TypeError(message);
3062
+ }
3063
+ }
3064
+ const obj_statuses = obj.statuses;
3065
+ const path_statuses = path + '.statuses';
3066
+ if (!ArrayIsArray(obj_statuses)) {
3067
+ return new TypeError('Expected "array" but received "' + typeof obj_statuses + '" (at "' + path_statuses + '")');
3068
+ }
3069
+ for (let i = 0; i < obj_statuses.length; i++) {
3070
+ const obj_statuses_item = obj_statuses[i];
3071
+ const path_statuses_item = path_statuses + '[' + i + ']';
3072
+ const referencepath_statuses_itemValidationError = validate$b(obj_statuses_item, path_statuses_item);
3073
+ if (referencepath_statuses_itemValidationError !== null) {
3074
+ let message = 'Object doesn\'t match TermOutputRepresentation (at "' + path_statuses_item + '")\n';
3075
+ message += referencepath_statuses_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
3076
+ return new TypeError(message);
3077
+ }
3078
+ }
3079
+ })();
3080
+ return v_error === undefined ? null : v_error;
3081
+ }
3082
+ const RepresentationType = 'JourneyMapMetadataOutputRepresentation';
3083
+ function normalize(input, existing, path, luvio, store, timestamp) {
3084
+ return input;
3085
+ }
3086
+ const select$3 = function JourneyMapMetadataOutputRepresentationSelect() {
3087
+ const { selections: TermOutputRepresentation__selections, opaque: TermOutputRepresentation__opaque, } = select$j();
3088
+ return {
3089
+ kind: 'Fragment',
3090
+ version: VERSION,
3091
+ private: [],
3092
+ selections: [
3093
+ {
3094
+ name: 'businessGoals',
3095
+ kind: 'Object',
3096
+ plural: true,
3097
+ selections: TermOutputRepresentation__selections
3098
+ },
3099
+ {
3100
+ name: 'categories',
3101
+ kind: 'Object',
3102
+ plural: true,
3103
+ selections: TermOutputRepresentation__selections
3104
+ },
3105
+ {
3106
+ name: 'stages',
3107
+ kind: 'Object',
3108
+ plural: true,
3109
+ selections: TermOutputRepresentation__selections
3110
+ },
3111
+ {
3112
+ name: 'statuses',
3113
+ kind: 'Object',
3114
+ plural: true,
3115
+ selections: TermOutputRepresentation__selections
3116
+ }
3117
+ ]
3118
+ };
3119
+ };
3120
+ function equals(existing, incoming) {
3121
+ const existing_businessGoals = existing.businessGoals;
3122
+ const incoming_businessGoals = incoming.businessGoals;
3123
+ const equals_businessGoals_items = equalsArray(existing_businessGoals, incoming_businessGoals, (existing_businessGoals_item, incoming_businessGoals_item) => {
3124
+ if (!(equals$b(existing_businessGoals_item, incoming_businessGoals_item))) {
3125
+ return false;
3126
+ }
3127
+ });
3128
+ if (equals_businessGoals_items === false) {
3129
+ return false;
3130
+ }
3131
+ const existing_categories = existing.categories;
3132
+ const incoming_categories = incoming.categories;
3133
+ const equals_categories_items = equalsArray(existing_categories, incoming_categories, (existing_categories_item, incoming_categories_item) => {
3134
+ if (!(equals$b(existing_categories_item, incoming_categories_item))) {
3135
+ return false;
3136
+ }
3137
+ });
3138
+ if (equals_categories_items === false) {
3139
+ return false;
3140
+ }
3141
+ const existing_stages = existing.stages;
3142
+ const incoming_stages = incoming.stages;
3143
+ const equals_stages_items = equalsArray(existing_stages, incoming_stages, (existing_stages_item, incoming_stages_item) => {
3144
+ if (!(equals$b(existing_stages_item, incoming_stages_item))) {
3145
+ return false;
3146
+ }
3147
+ });
3148
+ if (equals_stages_items === false) {
3149
+ return false;
3150
+ }
3151
+ const existing_statuses = existing.statuses;
3152
+ const incoming_statuses = incoming.statuses;
3153
+ const equals_statuses_items = equalsArray(existing_statuses, incoming_statuses, (existing_statuses_item, incoming_statuses_item) => {
3154
+ if (!(equals$b(existing_statuses_item, incoming_statuses_item))) {
3155
+ return false;
3156
+ }
3157
+ });
3158
+ if (equals_statuses_items === false) {
3159
+ return false;
3160
+ }
3161
+ return true;
3162
+ }
3163
+ const ingest = function JourneyMapMetadataOutputRepresentationIngest(input, path, luvio, store, timestamp) {
3164
+ if (process.env.NODE_ENV !== 'production') {
3165
+ const validateError = validate(input);
3166
+ if (validateError !== null) {
3167
+ throw validateError;
3168
+ }
3169
+ }
3170
+ const key = path.fullPath;
3171
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 200;
3172
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "salesforceJourney", VERSION, RepresentationType, equals);
3173
+ return createLink(key);
3174
+ };
3175
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
3176
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
3177
+ const rootKey = fullPathFactory();
3178
+ rootKeySet.set(rootKey, {
3179
+ namespace: keyPrefix,
3180
+ representationName: RepresentationType,
3181
+ mergeable: false
3182
+ });
3183
+ }
3184
+
3185
+ function select$2(luvio, params) {
3186
+ return select$3();
3187
+ }
3188
+ function keyBuilder$1(luvio, params) {
3189
+ return keyPrefix + '::JourneyMapMetadataOutputRepresentation:(' + 'cloudOwnership:' + params.urlParams.cloudOwnership + ')';
3190
+ }
3191
+ function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
3192
+ getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
3193
+ }
3194
+ function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
3195
+ const { body } = response;
3196
+ const key = keyBuilder$1(luvio, resourceParams);
3197
+ luvio.storeIngest(key, ingest, body);
3198
+ const snapshot = luvio.storeLookup({
3199
+ recordId: key,
3200
+ node: select$2(),
3201
+ variables: {},
3202
+ }, snapshotRefresh);
3203
+ if (process.env.NODE_ENV !== 'production') {
3204
+ if (snapshot.state !== 'Fulfilled') {
3205
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
3206
+ }
3207
+ }
3208
+ deepFreeze(snapshot.data);
3209
+ return snapshot;
3210
+ }
3211
+ function ingestError(luvio, params, error, snapshotRefresh) {
3212
+ const key = keyBuilder$1(luvio, params);
3213
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
3214
+ luvio.storeIngestError(key, errorSnapshot);
3215
+ return errorSnapshot;
3216
+ }
3217
+ function createResourceRequest$2(config) {
3218
+ const headers = {};
3219
+ return {
3220
+ baseUri: '/services/data/v66.0',
3221
+ basePath: '/connect/salesforce-journey/' + config.urlParams.cloudOwnership + '/journey-map/metadata',
3222
+ method: 'get',
3223
+ body: null,
3224
+ urlParams: config.urlParams,
3225
+ queryParams: {},
3226
+ headers,
3227
+ priority: 'normal',
3228
+ };
3229
+ }
3230
+
3231
+ const adapterName$2 = 'getJourneyMapMetadata';
3232
+ const getJourneyMapMetadata_ConfigPropertyMetadata = [
3233
+ generateParamConfigMetadata('cloudOwnership', true, 0 /* UrlParameter */, 0 /* String */),
3234
+ ];
3235
+ const getJourneyMapMetadata_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getJourneyMapMetadata_ConfigPropertyMetadata);
3236
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$9(getJourneyMapMetadata_ConfigPropertyMetadata);
3237
+ function keyBuilder(luvio, config) {
3238
+ const resourceParams = createResourceParams$2(config);
3239
+ return keyBuilder$1(luvio, resourceParams);
3240
+ }
3241
+ function typeCheckConfig$2(untrustedConfig) {
3242
+ const config = {};
3243
+ typeCheckConfig$9(untrustedConfig, config, getJourneyMapMetadata_ConfigPropertyMetadata);
3244
+ return config;
3245
+ }
3246
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
3247
+ if (!untrustedIsObject(untrustedConfig)) {
3248
+ return null;
3249
+ }
3250
+ if (process.env.NODE_ENV !== 'production') {
3251
+ validateConfig(untrustedConfig, configPropertyNames);
3252
+ }
3253
+ const config = typeCheckConfig$2(untrustedConfig);
3254
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
3255
+ return null;
3256
+ }
3257
+ return config;
3258
+ }
3259
+ function adapterFragment(luvio, config) {
3260
+ createResourceParams$2(config);
3261
+ return select$2();
3262
+ }
3263
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
3264
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
3265
+ config,
3266
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
3267
+ });
3268
+ return luvio.storeBroadcast().then(() => snapshot);
3269
+ }
3270
+ function onFetchResponseError(luvio, config, resourceParams, response) {
3271
+ const snapshot = ingestError(luvio, resourceParams, response, {
3272
+ config,
3273
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
3274
+ });
3275
+ return luvio.storeBroadcast().then(() => snapshot);
3276
+ }
3277
+ function buildNetworkSnapshot$2(luvio, config, options) {
3278
+ const resourceParams = createResourceParams$2(config);
3279
+ const request = createResourceRequest$2(resourceParams);
3280
+ return luvio.dispatchResourceRequest(request, options)
3281
+ .then((response) => {
3282
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
3283
+ const cache = new StoreKeyMap();
3284
+ getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
3285
+ return cache;
3286
+ });
3287
+ }, (response) => {
3288
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
3289
+ });
3290
+ }
3291
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
3292
+ return buildNetworkSnapshotCachePolicy$6(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
3293
+ }
3294
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
3295
+ const { luvio, config } = context;
3296
+ const selector = {
3297
+ recordId: keyBuilder(luvio, config),
3298
+ node: adapterFragment(luvio, config),
3299
+ variables: {},
3300
+ };
3301
+ const cacheSnapshot = storeLookup(selector, {
3302
+ config,
3303
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
3304
+ });
3305
+ return cacheSnapshot;
3306
+ }
3307
+ const getJourneyMapMetadataAdapterFactory = (luvio) => function salesforceJourney__getJourneyMapMetadata(untrustedConfig, requestContext) {
3308
+ const config = validateAdapterConfig$2(untrustedConfig, getJourneyMapMetadata_ConfigPropertyNames);
3309
+ // Invalid or incomplete config
3310
+ if (config === null) {
3311
+ return null;
3312
+ }
3313
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
3314
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
3315
+ };
3316
+
3317
+ function select$1(luvio, params) {
3318
+ return select$h();
3319
+ }
3320
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
3321
+ getTypeCacheKeys$9(storeKeyMap, luvio, response);
3322
+ }
3323
+ function ingestSuccess$1(luvio, resourceParams, response) {
3324
+ const { body } = response;
3325
+ const key = keyBuilderFromType$1(luvio, body);
3326
+ luvio.storeIngest(key, ingest$9, body);
3327
+ const snapshot = luvio.storeLookup({
3328
+ recordId: key,
3329
+ node: select$1(),
3330
+ variables: {},
3331
+ });
3332
+ if (process.env.NODE_ENV !== 'production') {
3333
+ if (snapshot.state !== 'Fulfilled') {
3334
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
3335
+ }
3336
+ }
3337
+ deepFreeze(snapshot.data);
3338
+ return snapshot;
3339
+ }
3340
+ function createResourceRequest$1(config) {
3341
+ const headers = {};
3342
+ return {
3343
+ baseUri: '/services/data/v66.0',
3344
+ basePath: '/connect/salesforce-journey/capability-user-preference',
3345
+ method: 'post',
3346
+ body: config.body,
3347
+ urlParams: {},
3348
+ queryParams: {},
3349
+ headers,
3350
+ priority: 'normal',
3351
+ };
3352
+ }
3353
+
3354
+ const adapterName$1 = 'upsertCapabilityUserPreference';
3355
+ const upsertCapabilityUserPreference_ConfigPropertyMetadata = [
3356
+ generateParamConfigMetadata('contentDurableId', true, 2 /* Body */, 0 /* String */),
3357
+ generateParamConfigMetadata('id', false, 2 /* Body */, 0 /* String */),
3358
+ generateParamConfigMetadata('lastContactRequestDate', false, 2 /* Body */, 0 /* String */),
3359
+ generateParamConfigMetadata('stage', false, 2 /* Body */, 0 /* String */),
3360
+ generateParamConfigMetadata('starred', false, 2 /* Body */, 1 /* Boolean */),
3361
+ generateParamConfigMetadata('status', false, 2 /* Body */, 0 /* String */),
3362
+ ];
3363
+ const upsertCapabilityUserPreference_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, upsertCapabilityUserPreference_ConfigPropertyMetadata);
3364
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$9(upsertCapabilityUserPreference_ConfigPropertyMetadata);
3365
+ function typeCheckConfig$1(untrustedConfig) {
3366
+ const config = {};
3367
+ typeCheckConfig$9(untrustedConfig, config, upsertCapabilityUserPreference_ConfigPropertyMetadata);
3368
+ return config;
3369
+ }
3370
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
3371
+ if (!untrustedIsObject(untrustedConfig)) {
3372
+ return null;
3373
+ }
3374
+ if (process.env.NODE_ENV !== 'production') {
3375
+ validateConfig(untrustedConfig, configPropertyNames);
3376
+ }
3377
+ const config = typeCheckConfig$1(untrustedConfig);
3378
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
3379
+ return null;
3380
+ }
3381
+ return config;
3382
+ }
3383
+ function buildNetworkSnapshot$1(luvio, config, options) {
3384
+ const resourceParams = createResourceParams$1(config);
3385
+ const request = createResourceRequest$1(resourceParams);
3386
+ return luvio.dispatchResourceRequest(request, options)
3387
+ .then((response) => {
3388
+ return luvio.handleSuccessResponse(() => {
3389
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response);
3390
+ return luvio.storeBroadcast().then(() => snapshot);
3391
+ }, () => {
3392
+ const cache = new StoreKeyMap();
3393
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
3394
+ return cache;
3395
+ });
3396
+ }, (response) => {
3397
+ deepFreeze(response);
3398
+ throw response;
3399
+ });
3400
+ }
3401
+ const upsertCapabilityUserPreferenceAdapterFactory = (luvio) => {
3402
+ return function upsertCapabilityUserPreference(untrustedConfig) {
3403
+ const config = validateAdapterConfig$1(untrustedConfig, upsertCapabilityUserPreference_ConfigPropertyNames);
3404
+ // Invalid or incomplete config
3405
+ if (config === null) {
3406
+ throw new Error('Invalid config for "upsertCapabilityUserPreference"');
3407
+ }
3408
+ return buildNetworkSnapshot$1(luvio, config);
3409
+ };
3410
+ };
3411
+
3412
+ function select(luvio, params) {
3413
+ return select$7();
3414
+ }
3415
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
3416
+ getTypeCacheKeys$3(storeKeyMap, luvio, response);
3417
+ }
3418
+ function ingestSuccess(luvio, resourceParams, response) {
3419
+ const { body } = response;
3420
+ const key = keyBuilderFromType(luvio, body);
3421
+ luvio.storeIngest(key, ingest$3, body);
3422
+ const snapshot = luvio.storeLookup({
3423
+ recordId: key,
3424
+ node: select(),
3425
+ variables: {},
3426
+ });
3427
+ if (process.env.NODE_ENV !== 'production') {
3428
+ if (snapshot.state !== 'Fulfilled') {
3429
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
3430
+ }
3431
+ }
3432
+ deepFreeze(snapshot.data);
3433
+ return snapshot;
3434
+ }
3435
+ function createResourceRequest(config) {
3436
+ const headers = {};
3437
+ return {
3438
+ baseUri: '/services/data/v66.0',
3439
+ basePath: '/connect/salesforce-journey/journey-map/initiatives/user-preference',
3440
+ method: 'post',
3441
+ body: config.body,
3442
+ urlParams: {},
3443
+ queryParams: {},
3444
+ headers,
3445
+ priority: 'normal',
3446
+ };
3447
+ }
3448
+
3449
+ const adapterName = 'upsertInitiativeUserPreference';
3450
+ const upsertInitiativeUserPreference_ConfigPropertyMetadata = [
3451
+ generateParamConfigMetadata('contentDurableId', true, 2 /* Body */, 0 /* String */),
3452
+ generateParamConfigMetadata('id', false, 2 /* Body */, 0 /* String */),
3453
+ generateParamConfigMetadata('stage', false, 2 /* Body */, 0 /* String */),
3454
+ generateParamConfigMetadata('status', false, 2 /* Body */, 0 /* String */),
3455
+ ];
3456
+ const upsertInitiativeUserPreference_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, upsertInitiativeUserPreference_ConfigPropertyMetadata);
3457
+ const createResourceParams = /*#__PURE__*/ createResourceParams$9(upsertInitiativeUserPreference_ConfigPropertyMetadata);
3458
+ function typeCheckConfig(untrustedConfig) {
3459
+ const config = {};
3460
+ typeCheckConfig$9(untrustedConfig, config, upsertInitiativeUserPreference_ConfigPropertyMetadata);
3461
+ return config;
3462
+ }
3463
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
3464
+ if (!untrustedIsObject(untrustedConfig)) {
3465
+ return null;
3466
+ }
3467
+ if (process.env.NODE_ENV !== 'production') {
3468
+ validateConfig(untrustedConfig, configPropertyNames);
3469
+ }
3470
+ const config = typeCheckConfig(untrustedConfig);
3471
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
3472
+ return null;
3473
+ }
3474
+ return config;
3475
+ }
3476
+ function buildNetworkSnapshot(luvio, config, options) {
3477
+ const resourceParams = createResourceParams(config);
3478
+ const request = createResourceRequest(resourceParams);
3479
+ return luvio.dispatchResourceRequest(request, options)
3480
+ .then((response) => {
3481
+ return luvio.handleSuccessResponse(() => {
3482
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
3483
+ return luvio.storeBroadcast().then(() => snapshot);
3484
+ }, () => {
3485
+ const cache = new StoreKeyMap();
3486
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
3487
+ return cache;
3488
+ });
3489
+ }, (response) => {
3490
+ deepFreeze(response);
3491
+ throw response;
3492
+ });
3493
+ }
3494
+ const upsertInitiativeUserPreferenceAdapterFactory = (luvio) => {
3495
+ return function upsertInitiativeUserPreference(untrustedConfig) {
3496
+ const config = validateAdapterConfig(untrustedConfig, upsertInitiativeUserPreference_ConfigPropertyNames);
3497
+ // Invalid or incomplete config
3498
+ if (config === null) {
3499
+ throw new Error('Invalid config for "upsertInitiativeUserPreference"');
3500
+ }
3501
+ return buildNetworkSnapshot(luvio, config);
3502
+ };
3503
+ };
3504
+
3505
+ let createContactUsLeadRequest;
3506
+ let getCapabilities;
3507
+ let getCapabilityContentDocument;
3508
+ let getCapabilitySearchResult;
3509
+ let getCategoriesMetadata;
3510
+ let getInitiatives;
3511
+ let getJourneyMapMetadata;
3512
+ let upsertCapabilityUserPreference;
3513
+ let upsertInitiativeUserPreference;
3514
+ // Imperative GET Adapters
3515
+ let getCapabilities_imperative;
3516
+ let getCapabilityContentDocument_imperative;
3517
+ let getCapabilitySearchResult_imperative;
3518
+ let getCategoriesMetadata_imperative;
3519
+ let getInitiatives_imperative;
3520
+ let getJourneyMapMetadata_imperative;
3521
+ const getCapabilitiesMetadata = { apiFamily: 'salesforceJourney', name: 'getCapabilities' };
3522
+ const getCapabilityContentDocumentMetadata = {
3523
+ apiFamily: 'salesforceJourney',
3524
+ name: 'getCapabilityContentDocument',
3525
+ };
3526
+ const getCapabilitySearchResultMetadata = {
3527
+ apiFamily: 'salesforceJourney',
3528
+ name: 'getCapabilitySearchResult',
3529
+ };
3530
+ const getCategoriesMetadataMetadata = {
3531
+ apiFamily: 'salesforceJourney',
3532
+ name: 'getCategoriesMetadata',
3533
+ };
3534
+ const getInitiativesMetadata = { apiFamily: 'salesforceJourney', name: 'getInitiatives' };
3535
+ const getJourneyMapMetadataMetadata = {
3536
+ apiFamily: 'salesforceJourney',
3537
+ name: 'getJourneyMapMetadata',
3538
+ };
3539
+ // Notify Update Available
3540
+ function bindExportsTo(luvio) {
3541
+ // LDS Adapters
3542
+ const getCapabilities_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getCapabilities', getCapabilitiesAdapterFactory), getCapabilitiesMetadata);
3543
+ const getCapabilityContentDocument_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getCapabilityContentDocument', getCapabilityContentDocumentAdapterFactory), getCapabilityContentDocumentMetadata);
3544
+ const getCapabilitySearchResult_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getCapabilitySearchResult', getCapabilitySearchResultAdapterFactory), getCapabilitySearchResultMetadata);
3545
+ const getCategoriesMetadata_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getCategoriesMetadata', getCategoriesMetadataAdapterFactory), getCategoriesMetadataMetadata);
3546
+ const getInitiatives_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getInitiatives', getInitiativesAdapterFactory), getInitiativesMetadata);
3547
+ const getJourneyMapMetadata_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getJourneyMapMetadata', getJourneyMapMetadataAdapterFactory), getJourneyMapMetadataMetadata);
3548
+ function unwrapSnapshotData(factory) {
3549
+ const adapter = factory(luvio);
3550
+ return (config) => adapter(config).then((snapshot) => snapshot.data);
3551
+ }
3552
+ return {
3553
+ createContactUsLeadRequest: unwrapSnapshotData(createContactUsLeadRequestAdapterFactory),
3554
+ getCapabilities: createWireAdapterConstructor(luvio, getCapabilities_ldsAdapter, getCapabilitiesMetadata),
3555
+ getCapabilityContentDocument: createWireAdapterConstructor(luvio, getCapabilityContentDocument_ldsAdapter, getCapabilityContentDocumentMetadata),
3556
+ getCapabilitySearchResult: createWireAdapterConstructor(luvio, getCapabilitySearchResult_ldsAdapter, getCapabilitySearchResultMetadata),
3557
+ getCategoriesMetadata: createWireAdapterConstructor(luvio, getCategoriesMetadata_ldsAdapter, getCategoriesMetadataMetadata),
3558
+ getInitiatives: createWireAdapterConstructor(luvio, getInitiatives_ldsAdapter, getInitiativesMetadata),
3559
+ getJourneyMapMetadata: createWireAdapterConstructor(luvio, getJourneyMapMetadata_ldsAdapter, getJourneyMapMetadataMetadata),
3560
+ upsertCapabilityUserPreference: unwrapSnapshotData(upsertCapabilityUserPreferenceAdapterFactory),
3561
+ upsertInitiativeUserPreference: unwrapSnapshotData(upsertInitiativeUserPreferenceAdapterFactory),
3562
+ // Imperative GET Adapters
3563
+ getCapabilities_imperative: createImperativeAdapter(luvio, getCapabilities_ldsAdapter, getCapabilitiesMetadata),
3564
+ getCapabilityContentDocument_imperative: createImperativeAdapter(luvio, getCapabilityContentDocument_ldsAdapter, getCapabilityContentDocumentMetadata),
3565
+ getCapabilitySearchResult_imperative: createImperativeAdapter(luvio, getCapabilitySearchResult_ldsAdapter, getCapabilitySearchResultMetadata),
3566
+ getCategoriesMetadata_imperative: createImperativeAdapter(luvio, getCategoriesMetadata_ldsAdapter, getCategoriesMetadataMetadata),
3567
+ getInitiatives_imperative: createImperativeAdapter(luvio, getInitiatives_ldsAdapter, getInitiativesMetadata),
3568
+ getJourneyMapMetadata_imperative: createImperativeAdapter(luvio, getJourneyMapMetadata_ldsAdapter, getJourneyMapMetadataMetadata),
3569
+ // Notify Update Availables
3570
+ };
3571
+ }
3572
+ withDefaultLuvio((luvio) => {
3573
+ ({
3574
+ createContactUsLeadRequest,
3575
+ getCapabilities,
3576
+ getCapabilityContentDocument,
3577
+ getCapabilitySearchResult,
3578
+ getCategoriesMetadata,
3579
+ getInitiatives,
3580
+ getJourneyMapMetadata,
3581
+ upsertCapabilityUserPreference,
3582
+ upsertInitiativeUserPreference,
3583
+ getCapabilities_imperative,
3584
+ getCapabilityContentDocument_imperative,
3585
+ getCapabilitySearchResult_imperative,
3586
+ getCategoriesMetadata_imperative,
3587
+ getInitiatives_imperative,
3588
+ getJourneyMapMetadata_imperative,
3589
+ } = bindExportsTo(luvio));
3590
+ });
3591
+
3592
+ export { createContactUsLeadRequest, getCapabilities, getCapabilities_imperative, getCapabilityContentDocument, getCapabilityContentDocument_imperative, getCapabilitySearchResult, getCapabilitySearchResult_imperative, getCategoriesMetadata, getCategoriesMetadata_imperative, getInitiatives, getInitiatives_imperative, getJourneyMapMetadata, getJourneyMapMetadata_imperative, upsertCapabilityUserPreference, upsertInitiativeUserPreference };
3593
+ // version: 0.1.0-dev1-c978a7b010