@salesforce/lds-adapters-sales-pathassistant 0.1.0-dev1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/sfdc/index.js ADDED
@@ -0,0 +1,748 @@
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, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$2, typeCheckConfig as typeCheckConfig$3, StoreKeyMap, createResourceParams as createResourceParams$3 } from 'force/luvioEngine';
18
+
19
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
20
+ const { keys: ObjectKeys, create: ObjectCreate } = 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(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 = 'pathassistant';
83
+
84
+ const { isArray: ArrayIsArray } = Array;
85
+ const { stringify: JSONStringify } = JSON;
86
+ function createLink(ref) {
87
+ return {
88
+ __ref: serializeStructuredKey(ref),
89
+ };
90
+ }
91
+
92
+ const TTL$2 = 30000;
93
+ const VERSION$2 = "4fa0084a0c26cd9bb89e092a910800f1";
94
+ function validate$2(obj, path = 'PathAssistantMetadataRepresentation') {
95
+ const v_error = (() => {
96
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
97
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
98
+ }
99
+ const obj_extraData = obj.extraData;
100
+ const path_extraData = path + '.extraData';
101
+ if (obj_extraData === undefined) {
102
+ return new TypeError('Expected "defined" but received "' + typeof obj_extraData + '" (at "' + path_extraData + '")');
103
+ }
104
+ const obj_pathAssistant = obj.pathAssistant;
105
+ const path_pathAssistant = path + '.pathAssistant';
106
+ if (obj_pathAssistant === undefined) {
107
+ return new TypeError('Expected "defined" but received "' + typeof obj_pathAssistant + '" (at "' + path_pathAssistant + '")');
108
+ }
109
+ const obj_recordData = obj.recordData;
110
+ const path_recordData = path + '.recordData';
111
+ if (obj_recordData === undefined) {
112
+ return new TypeError('Expected "defined" but received "' + typeof obj_recordData + '" (at "' + path_recordData + '")');
113
+ }
114
+ })();
115
+ return v_error === undefined ? null : v_error;
116
+ }
117
+ const RepresentationType$2 = 'PathAssistantMetadataRepresentation';
118
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
119
+ return input;
120
+ }
121
+ const select$5 = function PathAssistantMetadataRepresentationSelect() {
122
+ return {
123
+ kind: 'Fragment',
124
+ version: VERSION$2,
125
+ private: [],
126
+ selections: [
127
+ {
128
+ name: 'extraData',
129
+ kind: 'Object',
130
+ // any
131
+ },
132
+ {
133
+ name: 'pathAssistant',
134
+ kind: 'Object',
135
+ // any
136
+ },
137
+ {
138
+ name: 'recordData',
139
+ kind: 'Object',
140
+ // any
141
+ }
142
+ ]
143
+ };
144
+ };
145
+ function equals$2(existing, incoming) {
146
+ const existing_extraData = existing.extraData;
147
+ const incoming_extraData = incoming.extraData;
148
+ if (JSONStringify(incoming_extraData) !== JSONStringify(existing_extraData)) {
149
+ return false;
150
+ }
151
+ const existing_pathAssistant = existing.pathAssistant;
152
+ const incoming_pathAssistant = incoming.pathAssistant;
153
+ if (JSONStringify(incoming_pathAssistant) !== JSONStringify(existing_pathAssistant)) {
154
+ return false;
155
+ }
156
+ const existing_recordData = existing.recordData;
157
+ const incoming_recordData = incoming.recordData;
158
+ if (JSONStringify(incoming_recordData) !== JSONStringify(existing_recordData)) {
159
+ return false;
160
+ }
161
+ return true;
162
+ }
163
+ const ingest$2 = function PathAssistantMetadataRepresentationIngest(input, path, luvio, store, timestamp) {
164
+ if (process.env.NODE_ENV !== 'production') {
165
+ const validateError = validate$2(input);
166
+ if (validateError !== null) {
167
+ throw validateError;
168
+ }
169
+ }
170
+ const key = path.fullPath;
171
+ const ttlToUse = TTL$2;
172
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "pathassistant", VERSION$2, RepresentationType$2, equals$2);
173
+ return createLink(key);
174
+ };
175
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
176
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
177
+ const rootKey = fullPathFactory();
178
+ rootKeySet.set(rootKey, {
179
+ namespace: keyPrefix,
180
+ representationName: RepresentationType$2,
181
+ mergeable: false
182
+ });
183
+ }
184
+
185
+ function select$4(luvio, params) {
186
+ return select$5();
187
+ }
188
+ function keyBuilder$4(luvio, params) {
189
+ return keyPrefix + '::PathAssistantMetadataRepresentation:(' + 'picklistFieldApiName:' + params.queryParams.picklistFieldApiName + ',' + 'recordId:' + params.urlParams.recordId + ')';
190
+ }
191
+ function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
192
+ getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$4(luvio, resourceParams));
193
+ }
194
+ function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
195
+ const { body } = response;
196
+ const key = keyBuilder$4(luvio, resourceParams);
197
+ luvio.storeIngest(key, ingest$2, body);
198
+ const snapshot = luvio.storeLookup({
199
+ recordId: key,
200
+ node: select$4(),
201
+ variables: {},
202
+ }, snapshotRefresh);
203
+ if (process.env.NODE_ENV !== 'production') {
204
+ if (snapshot.state !== 'Fulfilled') {
205
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
206
+ }
207
+ }
208
+ deepFreeze(snapshot.data);
209
+ return snapshot;
210
+ }
211
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
212
+ const key = keyBuilder$4(luvio, params);
213
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
214
+ const storeMetadataParams = {
215
+ ttl: TTL$2,
216
+ namespace: keyPrefix,
217
+ version: VERSION$2,
218
+ representationName: RepresentationType$2
219
+ };
220
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
221
+ return errorSnapshot;
222
+ }
223
+ function createResourceRequest$2(config) {
224
+ const headers = {};
225
+ return {
226
+ baseUri: '/services/data/v66.0',
227
+ basePath: '/connect/pathassistant/' + config.urlParams.recordId + '',
228
+ method: 'get',
229
+ body: null,
230
+ urlParams: config.urlParams,
231
+ queryParams: config.queryParams,
232
+ headers,
233
+ priority: 'normal',
234
+ };
235
+ }
236
+
237
+ const adapterName$2 = 'getPathAssistant';
238
+ const getPathAssistant_ConfigPropertyMetadata = [
239
+ generateParamConfigMetadata('recordId', true, 0 /* UrlParameter */, 0 /* String */),
240
+ generateParamConfigMetadata('picklistFieldApiName', false, 1 /* QueryParameter */, 0 /* String */),
241
+ ];
242
+ const getPathAssistant_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getPathAssistant_ConfigPropertyMetadata);
243
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(getPathAssistant_ConfigPropertyMetadata);
244
+ function keyBuilder$3(luvio, config) {
245
+ const resourceParams = createResourceParams$2(config);
246
+ return keyBuilder$4(luvio, resourceParams);
247
+ }
248
+ function typeCheckConfig$2(untrustedConfig) {
249
+ const config = {};
250
+ typeCheckConfig$3(untrustedConfig, config, getPathAssistant_ConfigPropertyMetadata);
251
+ return config;
252
+ }
253
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
254
+ if (!untrustedIsObject(untrustedConfig)) {
255
+ return null;
256
+ }
257
+ if (process.env.NODE_ENV !== 'production') {
258
+ validateConfig(untrustedConfig, configPropertyNames);
259
+ }
260
+ const config = typeCheckConfig$2(untrustedConfig);
261
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
262
+ return null;
263
+ }
264
+ return config;
265
+ }
266
+ function adapterFragment$1(luvio, config) {
267
+ createResourceParams$2(config);
268
+ return select$4();
269
+ }
270
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
271
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
272
+ config,
273
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
274
+ });
275
+ return luvio.storeBroadcast().then(() => snapshot);
276
+ }
277
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
278
+ const snapshot = ingestError$1(luvio, resourceParams, response, {
279
+ config,
280
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
281
+ });
282
+ return luvio.storeBroadcast().then(() => snapshot);
283
+ }
284
+ function buildNetworkSnapshot$2(luvio, config, options) {
285
+ const resourceParams = createResourceParams$2(config);
286
+ const request = createResourceRequest$2(resourceParams);
287
+ return luvio.dispatchResourceRequest(request, options)
288
+ .then((response) => {
289
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
290
+ const cache = new StoreKeyMap();
291
+ getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
292
+ return cache;
293
+ });
294
+ }, (response) => {
295
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
296
+ });
297
+ }
298
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
299
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
300
+ }
301
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
302
+ const { luvio, config } = context;
303
+ const selector = {
304
+ recordId: keyBuilder$3(luvio, config),
305
+ node: adapterFragment$1(luvio, config),
306
+ variables: {},
307
+ };
308
+ const cacheSnapshot = storeLookup(selector, {
309
+ config,
310
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
311
+ });
312
+ return cacheSnapshot;
313
+ }
314
+ const getPathAssistantAdapterFactory = (luvio) => function pathassistant__getPathAssistant(untrustedConfig, requestContext) {
315
+ const config = validateAdapterConfig$2(untrustedConfig, getPathAssistant_ConfigPropertyNames);
316
+ // Invalid or incomplete config
317
+ if (config === null) {
318
+ return null;
319
+ }
320
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
321
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
322
+ };
323
+
324
+ const TTL$1 = 30000;
325
+ const VERSION$1 = "ba6bce075182b2ef08471882a25ab029";
326
+ function validate$1(obj, path = 'PathAssistantDaysInStageRepresentation') {
327
+ const v_error = (() => {
328
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
329
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
330
+ }
331
+ const obj_picklistValuesToDays = obj.picklistValuesToDays;
332
+ const path_picklistValuesToDays = path + '.picklistValuesToDays';
333
+ if (obj_picklistValuesToDays === undefined) {
334
+ return new TypeError('Expected "defined" but received "' + typeof obj_picklistValuesToDays + '" (at "' + path_picklistValuesToDays + '")');
335
+ }
336
+ })();
337
+ return v_error === undefined ? null : v_error;
338
+ }
339
+ const RepresentationType$1 = 'PathAssistantDaysInStageRepresentation';
340
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
341
+ return input;
342
+ }
343
+ const select$3 = function PathAssistantDaysInStageRepresentationSelect() {
344
+ return {
345
+ kind: 'Fragment',
346
+ version: VERSION$1,
347
+ private: [],
348
+ selections: [
349
+ {
350
+ name: 'picklistValuesToDays',
351
+ kind: 'Object',
352
+ // any
353
+ }
354
+ ]
355
+ };
356
+ };
357
+ function equals$1(existing, incoming) {
358
+ const existing_picklistValuesToDays = existing.picklistValuesToDays;
359
+ const incoming_picklistValuesToDays = incoming.picklistValuesToDays;
360
+ if (JSONStringify(incoming_picklistValuesToDays) !== JSONStringify(existing_picklistValuesToDays)) {
361
+ return false;
362
+ }
363
+ return true;
364
+ }
365
+ const ingest$1 = function PathAssistantDaysInStageRepresentationIngest(input, path, luvio, store, timestamp) {
366
+ if (process.env.NODE_ENV !== 'production') {
367
+ const validateError = validate$1(input);
368
+ if (validateError !== null) {
369
+ throw validateError;
370
+ }
371
+ }
372
+ const key = path.fullPath;
373
+ const ttlToUse = TTL$1;
374
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "pathassistant", VERSION$1, RepresentationType$1, equals$1);
375
+ return createLink(key);
376
+ };
377
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
378
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
379
+ const rootKey = fullPathFactory();
380
+ rootKeySet.set(rootKey, {
381
+ namespace: keyPrefix,
382
+ representationName: RepresentationType$1,
383
+ mergeable: false
384
+ });
385
+ }
386
+
387
+ function select$2(luvio, params) {
388
+ return select$3();
389
+ }
390
+ function keyBuilder$2(luvio, params) {
391
+ return keyPrefix + '::PathAssistantDaysInStageRepresentation:(' + 'picklistFieldApiName:' + params.queryParams.picklistFieldApiName + ',' + 'recordId:' + params.urlParams.recordId + ')';
392
+ }
393
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
394
+ getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$2(luvio, resourceParams));
395
+ }
396
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
397
+ const { body } = response;
398
+ const key = keyBuilder$2(luvio, resourceParams);
399
+ luvio.storeIngest(key, ingest$1, body);
400
+ const snapshot = luvio.storeLookup({
401
+ recordId: key,
402
+ node: select$2(),
403
+ variables: {},
404
+ }, snapshotRefresh);
405
+ if (process.env.NODE_ENV !== 'production') {
406
+ if (snapshot.state !== 'Fulfilled') {
407
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
408
+ }
409
+ }
410
+ deepFreeze(snapshot.data);
411
+ return snapshot;
412
+ }
413
+ function ingestError(luvio, params, error, snapshotRefresh) {
414
+ const key = keyBuilder$2(luvio, params);
415
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
416
+ const storeMetadataParams = {
417
+ ttl: TTL$1,
418
+ namespace: keyPrefix,
419
+ version: VERSION$1,
420
+ representationName: RepresentationType$1
421
+ };
422
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
423
+ return errorSnapshot;
424
+ }
425
+ function createResourceRequest$1(config) {
426
+ const headers = {};
427
+ return {
428
+ baseUri: '/services/data/v66.0',
429
+ basePath: '/connect/pathassistant/' + config.urlParams.recordId + '/daysInStage',
430
+ method: 'get',
431
+ body: null,
432
+ urlParams: config.urlParams,
433
+ queryParams: config.queryParams,
434
+ headers,
435
+ priority: 'normal',
436
+ };
437
+ }
438
+
439
+ const adapterName$1 = 'getPathAssistantDaysInStage';
440
+ const getPathAssistantDaysInStage_ConfigPropertyMetadata = [
441
+ generateParamConfigMetadata('recordId', true, 0 /* UrlParameter */, 0 /* String */),
442
+ generateParamConfigMetadata('picklistFieldApiName', false, 1 /* QueryParameter */, 0 /* String */),
443
+ ];
444
+ const getPathAssistantDaysInStage_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getPathAssistantDaysInStage_ConfigPropertyMetadata);
445
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(getPathAssistantDaysInStage_ConfigPropertyMetadata);
446
+ function keyBuilder$1(luvio, config) {
447
+ const resourceParams = createResourceParams$1(config);
448
+ return keyBuilder$2(luvio, resourceParams);
449
+ }
450
+ function typeCheckConfig$1(untrustedConfig) {
451
+ const config = {};
452
+ typeCheckConfig$3(untrustedConfig, config, getPathAssistantDaysInStage_ConfigPropertyMetadata);
453
+ return config;
454
+ }
455
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
456
+ if (!untrustedIsObject(untrustedConfig)) {
457
+ return null;
458
+ }
459
+ if (process.env.NODE_ENV !== 'production') {
460
+ validateConfig(untrustedConfig, configPropertyNames);
461
+ }
462
+ const config = typeCheckConfig$1(untrustedConfig);
463
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
464
+ return null;
465
+ }
466
+ return config;
467
+ }
468
+ function adapterFragment(luvio, config) {
469
+ createResourceParams$1(config);
470
+ return select$2();
471
+ }
472
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
473
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
474
+ config,
475
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
476
+ });
477
+ return luvio.storeBroadcast().then(() => snapshot);
478
+ }
479
+ function onFetchResponseError(luvio, config, resourceParams, response) {
480
+ const snapshot = ingestError(luvio, resourceParams, response, {
481
+ config,
482
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
483
+ });
484
+ return luvio.storeBroadcast().then(() => snapshot);
485
+ }
486
+ function buildNetworkSnapshot$1(luvio, config, options) {
487
+ const resourceParams = createResourceParams$1(config);
488
+ const request = createResourceRequest$1(resourceParams);
489
+ return luvio.dispatchResourceRequest(request, options)
490
+ .then((response) => {
491
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
492
+ const cache = new StoreKeyMap();
493
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
494
+ return cache;
495
+ });
496
+ }, (response) => {
497
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
498
+ });
499
+ }
500
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
501
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
502
+ }
503
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
504
+ const { luvio, config } = context;
505
+ const selector = {
506
+ recordId: keyBuilder$1(luvio, config),
507
+ node: adapterFragment(luvio, config),
508
+ variables: {},
509
+ };
510
+ const cacheSnapshot = storeLookup(selector, {
511
+ config,
512
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
513
+ });
514
+ return cacheSnapshot;
515
+ }
516
+ const getPathAssistantDaysInStageAdapterFactory = (luvio) => function pathassistant__getPathAssistantDaysInStage(untrustedConfig, requestContext) {
517
+ const config = validateAdapterConfig$1(untrustedConfig, getPathAssistantDaysInStage_ConfigPropertyNames);
518
+ // Invalid or incomplete config
519
+ if (config === null) {
520
+ return null;
521
+ }
522
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
523
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
524
+ };
525
+
526
+ const TTL = 30000;
527
+ const VERSION = "a729b9451867a2ddc52e8106de4e17c5";
528
+ function validate(obj, path = 'CollapsibleDrawerUserPrefRepresentation') {
529
+ const v_error = (() => {
530
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
531
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
532
+ }
533
+ const obj_apiName = obj.apiName;
534
+ const path_apiName = path + '.apiName';
535
+ if (typeof obj_apiName !== 'string') {
536
+ return new TypeError('Expected "string" but received "' + typeof obj_apiName + '" (at "' + path_apiName + '")');
537
+ }
538
+ const obj_isSuccess = obj.isSuccess;
539
+ const path_isSuccess = path + '.isSuccess';
540
+ if (typeof obj_isSuccess !== 'boolean') {
541
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
542
+ }
543
+ })();
544
+ return v_error === undefined ? null : v_error;
545
+ }
546
+ const RepresentationType = 'CollapsibleDrawerUserPrefRepresentation';
547
+ function keyBuilder(luvio, config) {
548
+ return keyPrefix + '::' + RepresentationType + ':' + config.apiName;
549
+ }
550
+ function keyBuilderFromType(luvio, object) {
551
+ const keyParams = {
552
+ apiName: object.apiName
553
+ };
554
+ return keyBuilder(luvio, keyParams);
555
+ }
556
+ function normalize(input, existing, path, luvio, store, timestamp) {
557
+ return input;
558
+ }
559
+ const select$1 = function CollapsibleDrawerUserPrefRepresentationSelect() {
560
+ return {
561
+ kind: 'Fragment',
562
+ version: VERSION,
563
+ private: [],
564
+ selections: [
565
+ {
566
+ name: 'apiName',
567
+ kind: 'Scalar'
568
+ },
569
+ {
570
+ name: 'isSuccess',
571
+ kind: 'Scalar'
572
+ }
573
+ ]
574
+ };
575
+ };
576
+ function equals(existing, incoming) {
577
+ const existing_isSuccess = existing.isSuccess;
578
+ const incoming_isSuccess = incoming.isSuccess;
579
+ if (!(existing_isSuccess === incoming_isSuccess)) {
580
+ return false;
581
+ }
582
+ const existing_apiName = existing.apiName;
583
+ const incoming_apiName = incoming.apiName;
584
+ if (!(existing_apiName === incoming_apiName)) {
585
+ return false;
586
+ }
587
+ return true;
588
+ }
589
+ const ingest = function CollapsibleDrawerUserPrefRepresentationIngest(input, path, luvio, store, timestamp) {
590
+ if (process.env.NODE_ENV !== 'production') {
591
+ const validateError = validate(input);
592
+ if (validateError !== null) {
593
+ throw validateError;
594
+ }
595
+ }
596
+ const key = keyBuilderFromType(luvio, input);
597
+ const ttlToUse = TTL;
598
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "pathassistant", VERSION, RepresentationType, equals);
599
+ return createLink(key);
600
+ };
601
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
602
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
603
+ const rootKey = keyBuilderFromType(luvio, input);
604
+ rootKeySet.set(rootKey, {
605
+ namespace: keyPrefix,
606
+ representationName: RepresentationType,
607
+ mergeable: false
608
+ });
609
+ }
610
+
611
+ function select(luvio, params) {
612
+ return select$1();
613
+ }
614
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
615
+ getTypeCacheKeys(storeKeyMap, luvio, response);
616
+ }
617
+ function ingestSuccess(luvio, resourceParams, response) {
618
+ const { body } = response;
619
+ const key = keyBuilderFromType(luvio, body);
620
+ luvio.storeIngest(key, ingest, body);
621
+ const snapshot = luvio.storeLookup({
622
+ recordId: key,
623
+ node: select(),
624
+ variables: {},
625
+ });
626
+ if (process.env.NODE_ENV !== 'production') {
627
+ if (snapshot.state !== 'Fulfilled') {
628
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
629
+ }
630
+ }
631
+ deepFreeze(snapshot.data);
632
+ return snapshot;
633
+ }
634
+ function createResourceRequest(config) {
635
+ const headers = {};
636
+ return {
637
+ baseUri: '/services/data/v66.0',
638
+ basePath: '/connect/pathassistant/collapsibleDrawerUserPref',
639
+ method: 'patch',
640
+ body: null,
641
+ urlParams: {},
642
+ queryParams: config.queryParams,
643
+ headers,
644
+ priority: 'normal',
645
+ };
646
+ }
647
+
648
+ const adapterName = 'updateCollapsibleDrawerUserPref';
649
+ const updateCollapsibleDrawerUserPref_ConfigPropertyMetadata = [
650
+ generateParamConfigMetadata('isCollapsed', false, 1 /* QueryParameter */, 1 /* Boolean */),
651
+ ];
652
+ const updateCollapsibleDrawerUserPref_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, updateCollapsibleDrawerUserPref_ConfigPropertyMetadata);
653
+ const createResourceParams = /*#__PURE__*/ createResourceParams$3(updateCollapsibleDrawerUserPref_ConfigPropertyMetadata);
654
+ function typeCheckConfig(untrustedConfig) {
655
+ const config = {};
656
+ typeCheckConfig$3(untrustedConfig, config, updateCollapsibleDrawerUserPref_ConfigPropertyMetadata);
657
+ return config;
658
+ }
659
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
660
+ if (!untrustedIsObject(untrustedConfig)) {
661
+ return null;
662
+ }
663
+ if (process.env.NODE_ENV !== 'production') {
664
+ validateConfig(untrustedConfig, configPropertyNames);
665
+ }
666
+ const config = typeCheckConfig(untrustedConfig);
667
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
668
+ return null;
669
+ }
670
+ return config;
671
+ }
672
+ function buildNetworkSnapshot(luvio, config, options) {
673
+ const resourceParams = createResourceParams(config);
674
+ const request = createResourceRequest(resourceParams);
675
+ return luvio.dispatchResourceRequest(request, options)
676
+ .then((response) => {
677
+ return luvio.handleSuccessResponse(() => {
678
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
679
+ return luvio.storeBroadcast().then(() => snapshot);
680
+ }, () => {
681
+ const cache = new StoreKeyMap();
682
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
683
+ return cache;
684
+ });
685
+ }, (response) => {
686
+ deepFreeze(response);
687
+ throw response;
688
+ });
689
+ }
690
+ const updateCollapsibleDrawerUserPrefAdapterFactory = (luvio) => {
691
+ return function updateCollapsibleDrawerUserPref(untrustedConfig) {
692
+ const config = validateAdapterConfig(untrustedConfig, updateCollapsibleDrawerUserPref_ConfigPropertyNames);
693
+ // Invalid or incomplete config
694
+ if (config === null) {
695
+ throw new Error('Invalid config for "updateCollapsibleDrawerUserPref"');
696
+ }
697
+ return buildNetworkSnapshot(luvio, config);
698
+ };
699
+ };
700
+
701
+ let getPathAssistant;
702
+ let getPathAssistantDaysInStage;
703
+ let updateCollapsibleDrawerUserPref;
704
+ // Imperative GET Adapters
705
+ let getPathAssistant_imperative;
706
+ let getPathAssistantDaysInStage_imperative;
707
+ // Adapter Metadata
708
+ const getPathAssistantMetadata = {
709
+ apiFamily: 'pathassistant',
710
+ name: 'getPathAssistant',
711
+ ttl: 30000,
712
+ };
713
+ const getPathAssistantDaysInStageMetadata = {
714
+ apiFamily: 'pathassistant',
715
+ name: 'getPathAssistantDaysInStage',
716
+ ttl: 30000,
717
+ };
718
+ // Notify Update Available
719
+ function bindExportsTo(luvio) {
720
+ // LDS Adapters
721
+ const getPathAssistant_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getPathAssistant', getPathAssistantAdapterFactory), getPathAssistantMetadata);
722
+ const getPathAssistantDaysInStage_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getPathAssistantDaysInStage', getPathAssistantDaysInStageAdapterFactory), getPathAssistantDaysInStageMetadata);
723
+ function unwrapSnapshotData(factory) {
724
+ const adapter = factory(luvio);
725
+ return (config) => adapter(config).then((snapshot) => snapshot.data);
726
+ }
727
+ return {
728
+ getPathAssistant: createWireAdapterConstructor(luvio, getPathAssistant_ldsAdapter, getPathAssistantMetadata),
729
+ getPathAssistantDaysInStage: createWireAdapterConstructor(luvio, getPathAssistantDaysInStage_ldsAdapter, getPathAssistantDaysInStageMetadata),
730
+ updateCollapsibleDrawerUserPref: unwrapSnapshotData(updateCollapsibleDrawerUserPrefAdapterFactory),
731
+ // Imperative GET Adapters
732
+ getPathAssistant_imperative: createImperativeAdapter(luvio, getPathAssistant_ldsAdapter, getPathAssistantMetadata),
733
+ getPathAssistantDaysInStage_imperative: createImperativeAdapter(luvio, getPathAssistantDaysInStage_ldsAdapter, getPathAssistantDaysInStageMetadata),
734
+ // Notify Update Availables
735
+ };
736
+ }
737
+ withDefaultLuvio((luvio) => {
738
+ ({
739
+ getPathAssistant,
740
+ getPathAssistantDaysInStage,
741
+ updateCollapsibleDrawerUserPref,
742
+ getPathAssistant_imperative,
743
+ getPathAssistantDaysInStage_imperative,
744
+ } = bindExportsTo(luvio));
745
+ });
746
+
747
+ export { getPathAssistant, getPathAssistantDaysInStage, getPathAssistantDaysInStage_imperative, getPathAssistant_imperative, updateCollapsibleDrawerUserPref };
748
+ // version: 0.1.0-dev1-c978a7b010