@salesforce/lds-adapters-industries-scheduler 1.100.2

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 (36) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/industries-scheduler.js +1142 -0
  3. package/dist/types/src/generated/adapters/adapter-utils.d.ts +66 -0
  4. package/dist/types/src/generated/adapters/createServiceAppointment.d.ts +15 -0
  5. package/dist/types/src/generated/adapters/getEngagementChannelTypes.d.ts +27 -0
  6. package/dist/types/src/generated/adapters/updateServiceAppointment.d.ts +15 -0
  7. package/dist/types/src/generated/artifacts/main.d.ts +3 -0
  8. package/dist/types/src/generated/artifacts/sfdc.d.ts +5 -0
  9. package/dist/types/src/generated/resources/getConnectSchedulingEngagementChannelTypes.d.ts +16 -0
  10. package/dist/types/src/generated/resources/patchConnectSchedulingServiceAppointments.d.ts +13 -0
  11. package/dist/types/src/generated/resources/postConnectSchedulingServiceAppointments.d.ts +13 -0
  12. package/dist/types/src/generated/types/AbstractServiceAppointmentInputRepresentation.d.ts +41 -0
  13. package/dist/types/src/generated/types/AssignedResourceInputRepresentation.d.ts +38 -0
  14. package/dist/types/src/generated/types/AssignedResourceListInputRepresentation.d.ts +29 -0
  15. package/dist/types/src/generated/types/CreateServiceAppointmentData.d.ts +30 -0
  16. package/dist/types/src/generated/types/CreateServiceAppointmentInputRepresentation.d.ts +41 -0
  17. package/dist/types/src/generated/types/CreateServiceAppointmentResult.d.ts +35 -0
  18. package/dist/types/src/generated/types/ExtendedFieldInputRepresentation.d.ts +32 -0
  19. package/dist/types/src/generated/types/ExtendedFieldListInputRepresentation.d.ts +29 -0
  20. package/dist/types/src/generated/types/GetEngagementChannelTypeListResult.d.ts +30 -0
  21. package/dist/types/src/generated/types/GetEngagementChannelTypeOutputRepresentation.d.ts +30 -0
  22. package/dist/types/src/generated/types/GetEngagementChannelTypeResult.d.ts +44 -0
  23. package/dist/types/src/generated/types/LeadInputRepresentation.d.ts +44 -0
  24. package/dist/types/src/generated/types/ServiceAppointmentInputRepresentation.d.ts +80 -0
  25. package/dist/types/src/generated/types/ServiceAppointmentOutputRepresentation.d.ts +47 -0
  26. package/dist/types/src/generated/types/ServiceAppointmentResult.d.ts +44 -0
  27. package/dist/types/src/generated/types/UpdateServiceAppointmentData.d.ts +30 -0
  28. package/dist/types/src/generated/types/UpdateServiceAppointmentInputRepresentation.d.ts +41 -0
  29. package/dist/types/src/generated/types/type-utils.d.ts +39 -0
  30. package/dist/umd/es2018/industries-scheduler.js +1152 -0
  31. package/dist/umd/es5/industries-scheduler.js +1159 -0
  32. package/package.json +71 -0
  33. package/sfdc/index.d.ts +1 -0
  34. package/sfdc/index.js +1183 -0
  35. package/src/raml/api.raml +401 -0
  36. package/src/raml/luvio.raml +30 -0
package/sfdc/index.js ADDED
@@ -0,0 +1,1183 @@
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, StoreKeyMap } from 'force/luvioEngine';
18
+
19
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
20
+ const { keys: ObjectKeys$1, freeze: ObjectFreeze$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
+ const keyPrefix = 'IndustriesScheduler';
62
+
63
+ const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
64
+ const { isArray: ArrayIsArray } = Array;
65
+ function equalsArray(a, b, equalsItem) {
66
+ const aLength = a.length;
67
+ const bLength = b.length;
68
+ if (aLength !== bLength) {
69
+ return false;
70
+ }
71
+ for (let i = 0; i < aLength; i++) {
72
+ if (equalsItem(a[i], b[i]) === false) {
73
+ return false;
74
+ }
75
+ }
76
+ return true;
77
+ }
78
+ function deepFreeze(value) {
79
+ // No need to freeze primitives
80
+ if (typeof value !== 'object' || value === null) {
81
+ return;
82
+ }
83
+ if (ArrayIsArray(value)) {
84
+ for (let i = 0, len = value.length; i < len; i += 1) {
85
+ deepFreeze(value[i]);
86
+ }
87
+ }
88
+ else {
89
+ const keys = ObjectKeys(value);
90
+ for (let i = 0, len = keys.length; i < len; i += 1) {
91
+ deepFreeze(value[keys[i]]);
92
+ }
93
+ }
94
+ ObjectFreeze(value);
95
+ }
96
+ function createLink(ref) {
97
+ return {
98
+ __ref: serializeStructuredKey(ref),
99
+ };
100
+ }
101
+
102
+ function validate$6(obj, path = 'CreateServiceAppointmentInputRepresentation') {
103
+ const v_error = (() => {
104
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
105
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
106
+ }
107
+ if (obj.assignedResources !== undefined) {
108
+ const obj_assignedResources = obj.assignedResources;
109
+ const path_assignedResources = path + '.assignedResources';
110
+ if (!ArrayIsArray(obj_assignedResources)) {
111
+ return new TypeError('Expected "array" but received "' + typeof obj_assignedResources + '" (at "' + path_assignedResources + '")');
112
+ }
113
+ for (let i = 0; i < obj_assignedResources.length; i++) {
114
+ const obj_assignedResources_item = obj_assignedResources[i];
115
+ const path_assignedResources_item = path_assignedResources + '[' + i + ']';
116
+ if (typeof obj_assignedResources_item !== 'object' || ArrayIsArray(obj_assignedResources_item) || obj_assignedResources_item === null) {
117
+ return new TypeError('Expected "object" but received "' + typeof obj_assignedResources_item + '" (at "' + path_assignedResources_item + '")');
118
+ }
119
+ }
120
+ }
121
+ if (obj.lead !== undefined) {
122
+ const obj_lead = obj.lead;
123
+ const path_lead = path + '.lead';
124
+ if (typeof obj_lead !== 'object' || ArrayIsArray(obj_lead) || obj_lead === null) {
125
+ return new TypeError('Expected "object" but received "' + typeof obj_lead + '" (at "' + path_lead + '")');
126
+ }
127
+ }
128
+ if (obj.schedulingPolicyId !== undefined) {
129
+ const obj_schedulingPolicyId = obj.schedulingPolicyId;
130
+ const path_schedulingPolicyId = path + '.schedulingPolicyId';
131
+ if (typeof obj_schedulingPolicyId !== 'string') {
132
+ return new TypeError('Expected "string" but received "' + typeof obj_schedulingPolicyId + '" (at "' + path_schedulingPolicyId + '")');
133
+ }
134
+ }
135
+ if (obj.serviceAppointment !== undefined) {
136
+ const obj_serviceAppointment = obj.serviceAppointment;
137
+ const path_serviceAppointment = path + '.serviceAppointment';
138
+ if (typeof obj_serviceAppointment !== 'object' || ArrayIsArray(obj_serviceAppointment) || obj_serviceAppointment === null) {
139
+ return new TypeError('Expected "object" but received "' + typeof obj_serviceAppointment + '" (at "' + path_serviceAppointment + '")');
140
+ }
141
+ }
142
+ if (obj.serviceAppointmentId !== undefined) {
143
+ const obj_serviceAppointmentId = obj.serviceAppointmentId;
144
+ const path_serviceAppointmentId = path + '.serviceAppointmentId';
145
+ if (typeof obj_serviceAppointmentId !== 'string') {
146
+ return new TypeError('Expected "string" but received "' + typeof obj_serviceAppointmentId + '" (at "' + path_serviceAppointmentId + '")');
147
+ }
148
+ }
149
+ })();
150
+ return v_error === undefined ? null : v_error;
151
+ }
152
+
153
+ const VERSION$4 = "2f0614d98c99215427524626e17e574b";
154
+ function validate$5(obj, path = 'ServiceAppointmentResult') {
155
+ const v_error = (() => {
156
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
157
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
158
+ }
159
+ const obj_assignedResourceIds = obj.assignedResourceIds;
160
+ const path_assignedResourceIds = path + '.assignedResourceIds';
161
+ if (!ArrayIsArray(obj_assignedResourceIds)) {
162
+ return new TypeError('Expected "array" but received "' + typeof obj_assignedResourceIds + '" (at "' + path_assignedResourceIds + '")');
163
+ }
164
+ for (let i = 0; i < obj_assignedResourceIds.length; i++) {
165
+ const obj_assignedResourceIds_item = obj_assignedResourceIds[i];
166
+ const path_assignedResourceIds_item = path_assignedResourceIds + '[' + i + ']';
167
+ if (typeof obj_assignedResourceIds_item !== 'string') {
168
+ return new TypeError('Expected "string" but received "' + typeof obj_assignedResourceIds_item + '" (at "' + path_assignedResourceIds_item + '")');
169
+ }
170
+ }
171
+ if (obj.parentRecordId !== undefined) {
172
+ const obj_parentRecordId = obj.parentRecordId;
173
+ const path_parentRecordId = path + '.parentRecordId';
174
+ if (typeof obj_parentRecordId !== 'string') {
175
+ return new TypeError('Expected "string" but received "' + typeof obj_parentRecordId + '" (at "' + path_parentRecordId + '")');
176
+ }
177
+ }
178
+ const obj_serviceAppointmentId = obj.serviceAppointmentId;
179
+ const path_serviceAppointmentId = path + '.serviceAppointmentId';
180
+ if (typeof obj_serviceAppointmentId !== 'string') {
181
+ return new TypeError('Expected "string" but received "' + typeof obj_serviceAppointmentId + '" (at "' + path_serviceAppointmentId + '")');
182
+ }
183
+ })();
184
+ return v_error === undefined ? null : v_error;
185
+ }
186
+ const RepresentationType$2 = 'ServiceAppointmentResult';
187
+ function keyBuilder$3(luvio, config) {
188
+ return keyPrefix + '::' + RepresentationType$2 + ':' + config.id;
189
+ }
190
+ function keyBuilderFromType$1(luvio, object) {
191
+ const keyParams = {
192
+ id: object.serviceAppointmentId
193
+ };
194
+ return keyBuilder$3(luvio, keyParams);
195
+ }
196
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
197
+ return input;
198
+ }
199
+ const select$7 = function ServiceAppointmentResultSelect() {
200
+ return {
201
+ kind: 'Fragment',
202
+ version: VERSION$4,
203
+ private: [],
204
+ selections: [
205
+ {
206
+ name: 'assignedResourceIds',
207
+ kind: 'Scalar',
208
+ plural: true
209
+ },
210
+ {
211
+ name: 'parentRecordId',
212
+ kind: 'Scalar',
213
+ required: false
214
+ },
215
+ {
216
+ name: 'serviceAppointmentId',
217
+ kind: 'Scalar'
218
+ }
219
+ ]
220
+ };
221
+ };
222
+ function equals$4(existing, incoming) {
223
+ const existing_parentRecordId = existing.parentRecordId;
224
+ const incoming_parentRecordId = incoming.parentRecordId;
225
+ // if at least one of these optionals is defined
226
+ if (existing_parentRecordId !== undefined || incoming_parentRecordId !== undefined) {
227
+ // if one of these is not defined we know the other is defined and therefore
228
+ // not equal
229
+ if (existing_parentRecordId === undefined || incoming_parentRecordId === undefined) {
230
+ return false;
231
+ }
232
+ if (!(existing_parentRecordId === incoming_parentRecordId)) {
233
+ return false;
234
+ }
235
+ }
236
+ const existing_serviceAppointmentId = existing.serviceAppointmentId;
237
+ const incoming_serviceAppointmentId = incoming.serviceAppointmentId;
238
+ if (!(existing_serviceAppointmentId === incoming_serviceAppointmentId)) {
239
+ return false;
240
+ }
241
+ const existing_assignedResourceIds = existing.assignedResourceIds;
242
+ const incoming_assignedResourceIds = incoming.assignedResourceIds;
243
+ const equals_assignedResourceIds_items = equalsArray(existing_assignedResourceIds, incoming_assignedResourceIds, (existing_assignedResourceIds_item, incoming_assignedResourceIds_item) => {
244
+ if (!(existing_assignedResourceIds_item === incoming_assignedResourceIds_item)) {
245
+ return false;
246
+ }
247
+ });
248
+ if (equals_assignedResourceIds_items === false) {
249
+ return false;
250
+ }
251
+ return true;
252
+ }
253
+ const ingest$2 = function ServiceAppointmentResultIngest(input, path, luvio, store, timestamp) {
254
+ if (process.env.NODE_ENV !== 'production') {
255
+ const validateError = validate$5(input);
256
+ if (validateError !== null) {
257
+ throw validateError;
258
+ }
259
+ }
260
+ const key = keyBuilderFromType$1(luvio, input);
261
+ const existingRecord = store.readEntry(key);
262
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 360000;
263
+ let incomingRecord = normalize$2(input, store.readEntry(key), {
264
+ fullPath: key,
265
+ parent: path.parent,
266
+ propertyName: path.propertyName,
267
+ ttl: ttlToUse
268
+ });
269
+ if (existingRecord === undefined || equals$4(existingRecord, incomingRecord) === false) {
270
+ luvio.storePublish(key, incomingRecord);
271
+ }
272
+ if (ttlToUse !== undefined) {
273
+ const storeMetadataParams = {
274
+ ttl: ttlToUse,
275
+ namespace: "IndustriesScheduler",
276
+ version: VERSION$4,
277
+ representationName: RepresentationType$2,
278
+ };
279
+ luvio.publishStoreMetadata(key, storeMetadataParams);
280
+ }
281
+ return createLink(key);
282
+ };
283
+ function getTypeCacheKeys$2(luvio, input, fullPathFactory) {
284
+ const rootKeySet = new StoreKeyMap();
285
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
286
+ const rootKey = keyBuilderFromType$1(luvio, input);
287
+ rootKeySet.set(rootKey, {
288
+ namespace: keyPrefix,
289
+ representationName: RepresentationType$2,
290
+ mergeable: false
291
+ });
292
+ return rootKeySet;
293
+ }
294
+
295
+ const VERSION$3 = "09b2befd1e1777ff063639379004b1b7";
296
+ function validate$4(obj, path = 'ServiceAppointmentOutputRepresentation') {
297
+ const v_error = (() => {
298
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
299
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
300
+ }
301
+ const obj_result = obj.result;
302
+ const path_result = path + '.result';
303
+ if (typeof obj_result !== 'object') {
304
+ return new TypeError('Expected "object" but received "' + typeof obj_result + '" (at "' + path_result + '")');
305
+ }
306
+ })();
307
+ return v_error === undefined ? null : v_error;
308
+ }
309
+ const RepresentationType$1 = 'ServiceAppointmentOutputRepresentation';
310
+ function keyBuilder$2(luvio, config) {
311
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.id;
312
+ }
313
+ function keyBuilderFromType(luvio, object) {
314
+ const keyParams = {
315
+ id: object.result.serviceAppointmentId
316
+ };
317
+ return keyBuilder$2(luvio, keyParams);
318
+ }
319
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
320
+ const input_result = input.result;
321
+ const input_result_id = path.fullPath + '__result';
322
+ input.result = ingest$2(input_result, {
323
+ fullPath: input_result_id,
324
+ propertyName: 'result',
325
+ parent: {
326
+ data: input,
327
+ key: path.fullPath,
328
+ existing: existing,
329
+ },
330
+ ttl: path.ttl
331
+ }, luvio, store);
332
+ return input;
333
+ }
334
+ const select$6 = function ServiceAppointmentOutputRepresentationSelect() {
335
+ return {
336
+ kind: 'Fragment',
337
+ version: VERSION$3,
338
+ private: [],
339
+ selections: [
340
+ {
341
+ name: 'result',
342
+ kind: 'Link',
343
+ fragment: select$7()
344
+ }
345
+ ]
346
+ };
347
+ };
348
+ function equals$3(existing, incoming) {
349
+ const existing_result = existing.result;
350
+ const incoming_result = incoming.result;
351
+ if (!(existing_result.__ref === incoming_result.__ref)) {
352
+ return false;
353
+ }
354
+ return true;
355
+ }
356
+ const ingest$1 = function ServiceAppointmentOutputRepresentationIngest(input, path, luvio, store, timestamp) {
357
+ if (process.env.NODE_ENV !== 'production') {
358
+ const validateError = validate$4(input);
359
+ if (validateError !== null) {
360
+ throw validateError;
361
+ }
362
+ }
363
+ const key = keyBuilderFromType(luvio, input);
364
+ const existingRecord = store.readEntry(key);
365
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 360000;
366
+ let incomingRecord = normalize$1(input, store.readEntry(key), {
367
+ fullPath: key,
368
+ parent: path.parent,
369
+ propertyName: path.propertyName,
370
+ ttl: ttlToUse
371
+ }, luvio, store);
372
+ if (existingRecord === undefined || equals$3(existingRecord, incomingRecord) === false) {
373
+ luvio.storePublish(key, incomingRecord);
374
+ }
375
+ if (ttlToUse !== undefined) {
376
+ const storeMetadataParams = {
377
+ ttl: ttlToUse,
378
+ namespace: "IndustriesScheduler",
379
+ version: VERSION$3,
380
+ representationName: RepresentationType$1,
381
+ };
382
+ luvio.publishStoreMetadata(key, storeMetadataParams);
383
+ }
384
+ return createLink(key);
385
+ };
386
+ function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
387
+ const rootKeySet = new StoreKeyMap();
388
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
389
+ const rootKey = keyBuilderFromType(luvio, input);
390
+ rootKeySet.set(rootKey, {
391
+ namespace: keyPrefix,
392
+ representationName: RepresentationType$1,
393
+ mergeable: false
394
+ });
395
+ const input_result = getTypeCacheKeys$2(luvio, input.result);
396
+ rootKeySet.merge(input_result);
397
+ return rootKeySet;
398
+ }
399
+
400
+ function select$5(luvio, params) {
401
+ return select$6();
402
+ }
403
+ function getResponseCacheKeys$2(luvio, resourceParams, response) {
404
+ return getTypeCacheKeys$1(luvio, response);
405
+ }
406
+ function ingestSuccess$2(luvio, resourceParams, response) {
407
+ const { body } = response;
408
+ const key = keyBuilderFromType(luvio, body);
409
+ luvio.storeIngest(key, ingest$1, body);
410
+ const snapshot = luvio.storeLookup({
411
+ recordId: key,
412
+ node: select$5(),
413
+ variables: {},
414
+ });
415
+ if (process.env.NODE_ENV !== 'production') {
416
+ if (snapshot.state !== 'Fulfilled') {
417
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
418
+ }
419
+ }
420
+ return snapshot;
421
+ }
422
+ function createResourceRequest$2(config) {
423
+ const headers = {};
424
+ return {
425
+ baseUri: '/services/data/v58.0',
426
+ basePath: '/connect/scheduling/service-appointments',
427
+ method: 'post',
428
+ body: config.body,
429
+ urlParams: {},
430
+ queryParams: {},
431
+ headers,
432
+ priority: 'normal',
433
+ };
434
+ }
435
+
436
+ const createServiceAppointment_ConfigPropertyNames = {
437
+ displayName: 'createServiceAppointment',
438
+ parameters: {
439
+ required: ['createServiceAppointmentInput'],
440
+ optional: []
441
+ }
442
+ };
443
+ function createResourceParams$2(config) {
444
+ const resourceParams = {
445
+ body: {
446
+ createServiceAppointmentInput: config.createServiceAppointmentInput
447
+ }
448
+ };
449
+ return resourceParams;
450
+ }
451
+ function typeCheckConfig$2(untrustedConfig) {
452
+ const config = {};
453
+ const untrustedConfig_createServiceAppointmentInput = untrustedConfig.createServiceAppointmentInput;
454
+ const referenceCreateServiceAppointmentInputRepresentationValidationError = validate$6(untrustedConfig_createServiceAppointmentInput);
455
+ if (referenceCreateServiceAppointmentInputRepresentationValidationError === null) {
456
+ config.createServiceAppointmentInput = untrustedConfig_createServiceAppointmentInput;
457
+ }
458
+ return config;
459
+ }
460
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
461
+ if (!untrustedIsObject(untrustedConfig)) {
462
+ return null;
463
+ }
464
+ if (process.env.NODE_ENV !== 'production') {
465
+ validateConfig(untrustedConfig, configPropertyNames);
466
+ }
467
+ const config = typeCheckConfig$2(untrustedConfig);
468
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
469
+ return null;
470
+ }
471
+ return config;
472
+ }
473
+ function buildNetworkSnapshot$2(luvio, config, options) {
474
+ const resourceParams = createResourceParams$2(config);
475
+ const request = createResourceRequest$2(resourceParams);
476
+ return luvio.dispatchResourceRequest(request, options)
477
+ .then((response) => {
478
+ return luvio.handleSuccessResponse(() => {
479
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response);
480
+ return luvio.storeBroadcast().then(() => snapshot);
481
+ }, () => getResponseCacheKeys$2(luvio, resourceParams, response.body));
482
+ }, (response) => {
483
+ deepFreeze(response);
484
+ throw response;
485
+ });
486
+ }
487
+ const createServiceAppointmentAdapterFactory = (luvio) => {
488
+ return function createServiceAppointment(untrustedConfig) {
489
+ const config = validateAdapterConfig$2(untrustedConfig, createServiceAppointment_ConfigPropertyNames);
490
+ // Invalid or incomplete config
491
+ if (config === null) {
492
+ throw new Error('Invalid config for "createServiceAppointment"');
493
+ }
494
+ return buildNetworkSnapshot$2(luvio, config);
495
+ };
496
+ };
497
+
498
+ const VERSION$2 = "745ed19773bc6307c6816a6d100b0cbe";
499
+ function validate$3(obj, path = 'GetEngagementChannelTypeResult') {
500
+ const v_error = (() => {
501
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
502
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
503
+ }
504
+ if (obj.contactPoint !== undefined) {
505
+ const obj_contactPoint = obj.contactPoint;
506
+ const path_contactPoint = path + '.contactPoint';
507
+ if (typeof obj_contactPoint !== 'string') {
508
+ return new TypeError('Expected "string" but received "' + typeof obj_contactPoint + '" (at "' + path_contactPoint + '")');
509
+ }
510
+ }
511
+ if (obj.contactPointType !== undefined) {
512
+ const obj_contactPointType = obj.contactPointType;
513
+ const path_contactPointType = path + '.contactPointType';
514
+ if (typeof obj_contactPointType !== 'string') {
515
+ return new TypeError('Expected "string" but received "' + typeof obj_contactPointType + '" (at "' + path_contactPointType + '")');
516
+ }
517
+ }
518
+ if (obj.id !== undefined) {
519
+ const obj_id = obj.id;
520
+ const path_id = path + '.id';
521
+ if (typeof obj_id !== 'string') {
522
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
523
+ }
524
+ }
525
+ if (obj.name !== undefined) {
526
+ const obj_name = obj.name;
527
+ const path_name = path + '.name';
528
+ if (typeof obj_name !== 'string') {
529
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
530
+ }
531
+ }
532
+ if (obj.workTypeGroupIds !== undefined) {
533
+ const obj_workTypeGroupIds = obj.workTypeGroupIds;
534
+ const path_workTypeGroupIds = path + '.workTypeGroupIds';
535
+ if (!ArrayIsArray(obj_workTypeGroupIds)) {
536
+ return new TypeError('Expected "array" but received "' + typeof obj_workTypeGroupIds + '" (at "' + path_workTypeGroupIds + '")');
537
+ }
538
+ for (let i = 0; i < obj_workTypeGroupIds.length; i++) {
539
+ const obj_workTypeGroupIds_item = obj_workTypeGroupIds[i];
540
+ const path_workTypeGroupIds_item = path_workTypeGroupIds + '[' + i + ']';
541
+ if (typeof obj_workTypeGroupIds_item !== 'string') {
542
+ return new TypeError('Expected "string" but received "' + typeof obj_workTypeGroupIds_item + '" (at "' + path_workTypeGroupIds_item + '")');
543
+ }
544
+ }
545
+ }
546
+ if (obj.workTypeIds !== undefined) {
547
+ const obj_workTypeIds = obj.workTypeIds;
548
+ const path_workTypeIds = path + '.workTypeIds';
549
+ if (!ArrayIsArray(obj_workTypeIds)) {
550
+ return new TypeError('Expected "array" but received "' + typeof obj_workTypeIds + '" (at "' + path_workTypeIds + '")');
551
+ }
552
+ for (let i = 0; i < obj_workTypeIds.length; i++) {
553
+ const obj_workTypeIds_item = obj_workTypeIds[i];
554
+ const path_workTypeIds_item = path_workTypeIds + '[' + i + ']';
555
+ if (typeof obj_workTypeIds_item !== 'string') {
556
+ return new TypeError('Expected "string" but received "' + typeof obj_workTypeIds_item + '" (at "' + path_workTypeIds_item + '")');
557
+ }
558
+ }
559
+ }
560
+ })();
561
+ return v_error === undefined ? null : v_error;
562
+ }
563
+ const select$4 = function GetEngagementChannelTypeResultSelect() {
564
+ return {
565
+ kind: 'Fragment',
566
+ version: VERSION$2,
567
+ private: [],
568
+ selections: [
569
+ {
570
+ name: 'contactPoint',
571
+ kind: 'Scalar',
572
+ required: false
573
+ },
574
+ {
575
+ name: 'contactPointType',
576
+ kind: 'Scalar',
577
+ required: false
578
+ },
579
+ {
580
+ name: 'id',
581
+ kind: 'Scalar',
582
+ required: false
583
+ },
584
+ {
585
+ name: 'name',
586
+ kind: 'Scalar',
587
+ required: false
588
+ },
589
+ {
590
+ name: 'workTypeGroupIds',
591
+ kind: 'Scalar',
592
+ plural: true,
593
+ required: false
594
+ },
595
+ {
596
+ name: 'workTypeIds',
597
+ kind: 'Scalar',
598
+ plural: true,
599
+ required: false
600
+ }
601
+ ]
602
+ };
603
+ };
604
+ function equals$2(existing, incoming) {
605
+ const existing_contactPoint = existing.contactPoint;
606
+ const incoming_contactPoint = incoming.contactPoint;
607
+ // if at least one of these optionals is defined
608
+ if (existing_contactPoint !== undefined || incoming_contactPoint !== undefined) {
609
+ // if one of these is not defined we know the other is defined and therefore
610
+ // not equal
611
+ if (existing_contactPoint === undefined || incoming_contactPoint === undefined) {
612
+ return false;
613
+ }
614
+ if (!(existing_contactPoint === incoming_contactPoint)) {
615
+ return false;
616
+ }
617
+ }
618
+ const existing_contactPointType = existing.contactPointType;
619
+ const incoming_contactPointType = incoming.contactPointType;
620
+ // if at least one of these optionals is defined
621
+ if (existing_contactPointType !== undefined || incoming_contactPointType !== undefined) {
622
+ // if one of these is not defined we know the other is defined and therefore
623
+ // not equal
624
+ if (existing_contactPointType === undefined || incoming_contactPointType === undefined) {
625
+ return false;
626
+ }
627
+ if (!(existing_contactPointType === incoming_contactPointType)) {
628
+ return false;
629
+ }
630
+ }
631
+ const existing_id = existing.id;
632
+ const incoming_id = incoming.id;
633
+ // if at least one of these optionals is defined
634
+ if (existing_id !== undefined || incoming_id !== undefined) {
635
+ // if one of these is not defined we know the other is defined and therefore
636
+ // not equal
637
+ if (existing_id === undefined || incoming_id === undefined) {
638
+ return false;
639
+ }
640
+ if (!(existing_id === incoming_id)) {
641
+ return false;
642
+ }
643
+ }
644
+ const existing_name = existing.name;
645
+ const incoming_name = incoming.name;
646
+ // if at least one of these optionals is defined
647
+ if (existing_name !== undefined || incoming_name !== undefined) {
648
+ // if one of these is not defined we know the other is defined and therefore
649
+ // not equal
650
+ if (existing_name === undefined || incoming_name === undefined) {
651
+ return false;
652
+ }
653
+ if (!(existing_name === incoming_name)) {
654
+ return false;
655
+ }
656
+ }
657
+ const existing_workTypeGroupIds = existing.workTypeGroupIds;
658
+ const incoming_workTypeGroupIds = incoming.workTypeGroupIds;
659
+ // if at least one of these optionals is defined
660
+ if (existing_workTypeGroupIds !== undefined || incoming_workTypeGroupIds !== undefined) {
661
+ // if one of these is not defined we know the other is defined and therefore
662
+ // not equal
663
+ if (existing_workTypeGroupIds === undefined || incoming_workTypeGroupIds === undefined) {
664
+ return false;
665
+ }
666
+ const equals_workTypeGroupIds_items = equalsArray(existing_workTypeGroupIds, incoming_workTypeGroupIds, (existing_workTypeGroupIds_item, incoming_workTypeGroupIds_item) => {
667
+ if (!(existing_workTypeGroupIds_item === incoming_workTypeGroupIds_item)) {
668
+ return false;
669
+ }
670
+ });
671
+ if (equals_workTypeGroupIds_items === false) {
672
+ return false;
673
+ }
674
+ }
675
+ const existing_workTypeIds = existing.workTypeIds;
676
+ const incoming_workTypeIds = incoming.workTypeIds;
677
+ // if at least one of these optionals is defined
678
+ if (existing_workTypeIds !== undefined || incoming_workTypeIds !== undefined) {
679
+ // if one of these is not defined we know the other is defined and therefore
680
+ // not equal
681
+ if (existing_workTypeIds === undefined || incoming_workTypeIds === undefined) {
682
+ return false;
683
+ }
684
+ const equals_workTypeIds_items = equalsArray(existing_workTypeIds, incoming_workTypeIds, (existing_workTypeIds_item, incoming_workTypeIds_item) => {
685
+ if (!(existing_workTypeIds_item === incoming_workTypeIds_item)) {
686
+ return false;
687
+ }
688
+ });
689
+ if (equals_workTypeIds_items === false) {
690
+ return false;
691
+ }
692
+ }
693
+ return true;
694
+ }
695
+
696
+ const VERSION$1 = "129c53d5f8fb579d31c255a020838251";
697
+ function validate$2(obj, path = 'GetEngagementChannelTypeListResult') {
698
+ const v_error = (() => {
699
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
700
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
701
+ }
702
+ const obj_engagementChannelTypes = obj.engagementChannelTypes;
703
+ const path_engagementChannelTypes = path + '.engagementChannelTypes';
704
+ if (!ArrayIsArray(obj_engagementChannelTypes)) {
705
+ return new TypeError('Expected "array" but received "' + typeof obj_engagementChannelTypes + '" (at "' + path_engagementChannelTypes + '")');
706
+ }
707
+ for (let i = 0; i < obj_engagementChannelTypes.length; i++) {
708
+ const obj_engagementChannelTypes_item = obj_engagementChannelTypes[i];
709
+ const path_engagementChannelTypes_item = path_engagementChannelTypes + '[' + i + ']';
710
+ const referencepath_engagementChannelTypes_itemValidationError = validate$3(obj_engagementChannelTypes_item, path_engagementChannelTypes_item);
711
+ if (referencepath_engagementChannelTypes_itemValidationError !== null) {
712
+ let message = 'Object doesn\'t match GetEngagementChannelTypeResult (at "' + path_engagementChannelTypes_item + '")\n';
713
+ message += referencepath_engagementChannelTypes_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
714
+ return new TypeError(message);
715
+ }
716
+ }
717
+ })();
718
+ return v_error === undefined ? null : v_error;
719
+ }
720
+ const select$3 = function GetEngagementChannelTypeListResultSelect() {
721
+ const { selections: GetEngagementChannelTypeResult__selections, opaque: GetEngagementChannelTypeResult__opaque, } = select$4();
722
+ return {
723
+ kind: 'Fragment',
724
+ version: VERSION$1,
725
+ private: [],
726
+ selections: [
727
+ {
728
+ name: 'engagementChannelTypes',
729
+ kind: 'Object',
730
+ plural: true,
731
+ selections: GetEngagementChannelTypeResult__selections
732
+ }
733
+ ]
734
+ };
735
+ };
736
+ function equals$1(existing, incoming) {
737
+ const existing_engagementChannelTypes = existing.engagementChannelTypes;
738
+ const incoming_engagementChannelTypes = incoming.engagementChannelTypes;
739
+ const equals_engagementChannelTypes_items = equalsArray(existing_engagementChannelTypes, incoming_engagementChannelTypes, (existing_engagementChannelTypes_item, incoming_engagementChannelTypes_item) => {
740
+ if (!(equals$2(existing_engagementChannelTypes_item, incoming_engagementChannelTypes_item))) {
741
+ return false;
742
+ }
743
+ });
744
+ if (equals_engagementChannelTypes_items === false) {
745
+ return false;
746
+ }
747
+ return true;
748
+ }
749
+
750
+ const VERSION = "622654426aa18b7c8846e6d863a5f446";
751
+ function validate$1(obj, path = 'GetEngagementChannelTypeOutputRepresentation') {
752
+ const v_error = (() => {
753
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
754
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
755
+ }
756
+ const obj_result = obj.result;
757
+ const path_result = path + '.result';
758
+ const referencepath_resultValidationError = validate$2(obj_result, path_result);
759
+ if (referencepath_resultValidationError !== null) {
760
+ let message = 'Object doesn\'t match GetEngagementChannelTypeListResult (at "' + path_result + '")\n';
761
+ message += referencepath_resultValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
762
+ return new TypeError(message);
763
+ }
764
+ })();
765
+ return v_error === undefined ? null : v_error;
766
+ }
767
+ const RepresentationType = 'GetEngagementChannelTypeOutputRepresentation';
768
+ function normalize(input, existing, path, luvio, store, timestamp) {
769
+ return input;
770
+ }
771
+ const select$2 = function GetEngagementChannelTypeOutputRepresentationSelect() {
772
+ const { selections: GetEngagementChannelTypeListResult__selections, opaque: GetEngagementChannelTypeListResult__opaque, } = select$3();
773
+ return {
774
+ kind: 'Fragment',
775
+ version: VERSION,
776
+ private: [],
777
+ selections: [
778
+ {
779
+ name: 'result',
780
+ kind: 'Object',
781
+ selections: GetEngagementChannelTypeListResult__selections
782
+ }
783
+ ]
784
+ };
785
+ };
786
+ function equals(existing, incoming) {
787
+ const existing_result = existing.result;
788
+ const incoming_result = incoming.result;
789
+ if (!(equals$1(existing_result, incoming_result))) {
790
+ return false;
791
+ }
792
+ return true;
793
+ }
794
+ const ingest = function GetEngagementChannelTypeOutputRepresentationIngest(input, path, luvio, store, timestamp) {
795
+ if (process.env.NODE_ENV !== 'production') {
796
+ const validateError = validate$1(input);
797
+ if (validateError !== null) {
798
+ throw validateError;
799
+ }
800
+ }
801
+ const key = path.fullPath;
802
+ const existingRecord = store.readEntry(key);
803
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 360000;
804
+ let incomingRecord = normalize(input, store.readEntry(key), {
805
+ fullPath: key,
806
+ parent: path.parent,
807
+ propertyName: path.propertyName,
808
+ ttl: ttlToUse
809
+ });
810
+ if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
811
+ luvio.storePublish(key, incomingRecord);
812
+ }
813
+ if (ttlToUse !== undefined) {
814
+ const storeMetadataParams = {
815
+ ttl: ttlToUse,
816
+ namespace: "IndustriesScheduler",
817
+ version: VERSION,
818
+ representationName: RepresentationType,
819
+ };
820
+ luvio.publishStoreMetadata(key, storeMetadataParams);
821
+ }
822
+ return createLink(key);
823
+ };
824
+ function getTypeCacheKeys(luvio, input, fullPathFactory) {
825
+ const rootKeySet = new StoreKeyMap();
826
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
827
+ const rootKey = fullPathFactory();
828
+ rootKeySet.set(rootKey, {
829
+ namespace: keyPrefix,
830
+ representationName: RepresentationType,
831
+ mergeable: false
832
+ });
833
+ return rootKeySet;
834
+ }
835
+
836
+ function select$1(luvio, params) {
837
+ return select$2();
838
+ }
839
+ function keyBuilder$1(luvio, params) {
840
+ return keyPrefix + '::GetEngagementChannelTypeOutputRepresentation:(' + 'workTypeGroupIds:' + params.queryParams.workTypeGroupIds + ',' + 'workTypeIds:' + params.queryParams.workTypeIds + ')';
841
+ }
842
+ function getResponseCacheKeys$1(luvio, resourceParams, response) {
843
+ return getTypeCacheKeys(luvio, response, () => keyBuilder$1(luvio, resourceParams));
844
+ }
845
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
846
+ const { body } = response;
847
+ const key = keyBuilder$1(luvio, resourceParams);
848
+ luvio.storeIngest(key, ingest, body);
849
+ const snapshot = luvio.storeLookup({
850
+ recordId: key,
851
+ node: select$1(),
852
+ variables: {},
853
+ }, snapshotRefresh);
854
+ if (process.env.NODE_ENV !== 'production') {
855
+ if (snapshot.state !== 'Fulfilled') {
856
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
857
+ }
858
+ }
859
+ return snapshot;
860
+ }
861
+ function ingestError(luvio, params, error, snapshotRefresh) {
862
+ const key = keyBuilder$1(luvio, params);
863
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
864
+ luvio.storeIngestError(key, errorSnapshot);
865
+ return errorSnapshot;
866
+ }
867
+ function createResourceRequest$1(config) {
868
+ const headers = {};
869
+ return {
870
+ baseUri: '/services/data/v58.0',
871
+ basePath: '/connect/scheduling/engagement-channel-types',
872
+ method: 'get',
873
+ body: null,
874
+ urlParams: {},
875
+ queryParams: config.queryParams,
876
+ headers,
877
+ priority: 'normal',
878
+ };
879
+ }
880
+
881
+ const getEngagementChannelTypes_ConfigPropertyNames = {
882
+ displayName: 'getEngagementChannelTypes',
883
+ parameters: {
884
+ required: [],
885
+ optional: ['workTypeGroupIds', 'workTypeIds']
886
+ }
887
+ };
888
+ function createResourceParams$1(config) {
889
+ const resourceParams = {
890
+ queryParams: {
891
+ workTypeGroupIds: config.workTypeGroupIds, workTypeIds: config.workTypeIds
892
+ }
893
+ };
894
+ return resourceParams;
895
+ }
896
+ function keyBuilder(luvio, config) {
897
+ const resourceParams = createResourceParams$1(config);
898
+ return keyBuilder$1(luvio, resourceParams);
899
+ }
900
+ function typeCheckConfig$1(untrustedConfig) {
901
+ const config = {};
902
+ const untrustedConfig_workTypeGroupIds = untrustedConfig.workTypeGroupIds;
903
+ if (ArrayIsArray$1(untrustedConfig_workTypeGroupIds)) {
904
+ const untrustedConfig_workTypeGroupIds_array = [];
905
+ for (let i = 0, arrayLength = untrustedConfig_workTypeGroupIds.length; i < arrayLength; i++) {
906
+ const untrustedConfig_workTypeGroupIds_item = untrustedConfig_workTypeGroupIds[i];
907
+ if (typeof untrustedConfig_workTypeGroupIds_item === 'string') {
908
+ untrustedConfig_workTypeGroupIds_array.push(untrustedConfig_workTypeGroupIds_item);
909
+ }
910
+ }
911
+ config.workTypeGroupIds = untrustedConfig_workTypeGroupIds_array;
912
+ }
913
+ const untrustedConfig_workTypeIds = untrustedConfig.workTypeIds;
914
+ if (ArrayIsArray$1(untrustedConfig_workTypeIds)) {
915
+ const untrustedConfig_workTypeIds_array = [];
916
+ for (let i = 0, arrayLength = untrustedConfig_workTypeIds.length; i < arrayLength; i++) {
917
+ const untrustedConfig_workTypeIds_item = untrustedConfig_workTypeIds[i];
918
+ if (typeof untrustedConfig_workTypeIds_item === 'string') {
919
+ untrustedConfig_workTypeIds_array.push(untrustedConfig_workTypeIds_item);
920
+ }
921
+ }
922
+ config.workTypeIds = untrustedConfig_workTypeIds_array;
923
+ }
924
+ return config;
925
+ }
926
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
927
+ if (!untrustedIsObject(untrustedConfig)) {
928
+ return null;
929
+ }
930
+ if (process.env.NODE_ENV !== 'production') {
931
+ validateConfig(untrustedConfig, configPropertyNames);
932
+ }
933
+ const config = typeCheckConfig$1(untrustedConfig);
934
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
935
+ return null;
936
+ }
937
+ return config;
938
+ }
939
+ function adapterFragment(luvio, config) {
940
+ createResourceParams$1(config);
941
+ return select$1();
942
+ }
943
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
944
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
945
+ config,
946
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
947
+ });
948
+ return luvio.storeBroadcast().then(() => snapshot);
949
+ }
950
+ function onFetchResponseError(luvio, config, resourceParams, response) {
951
+ const snapshot = ingestError(luvio, resourceParams, response, {
952
+ config,
953
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
954
+ });
955
+ return luvio.storeBroadcast().then(() => snapshot);
956
+ }
957
+ function buildNetworkSnapshot$1(luvio, config, options) {
958
+ const resourceParams = createResourceParams$1(config);
959
+ const request = createResourceRequest$1(resourceParams);
960
+ return luvio.dispatchResourceRequest(request, options)
961
+ .then((response) => {
962
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys$1(luvio, resourceParams, response.body));
963
+ }, (response) => {
964
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
965
+ });
966
+ }
967
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
968
+ const { luvio, config } = context;
969
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
970
+ const dispatchOptions = {
971
+ resourceRequestContext: {
972
+ requestCorrelator,
973
+ luvioRequestMethod: undefined,
974
+ },
975
+ eventObservers
976
+ };
977
+ if (networkPriority !== 'normal') {
978
+ dispatchOptions.overrides = {
979
+ priority: networkPriority
980
+ };
981
+ }
982
+ return buildNetworkSnapshot$1(luvio, config, dispatchOptions);
983
+ }
984
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
985
+ const { luvio, config } = context;
986
+ const selector = {
987
+ recordId: keyBuilder(luvio, config),
988
+ node: adapterFragment(luvio, config),
989
+ variables: {},
990
+ };
991
+ const cacheSnapshot = storeLookup(selector, {
992
+ config,
993
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
994
+ });
995
+ return cacheSnapshot;
996
+ }
997
+ const getEngagementChannelTypesAdapterFactory = (luvio) => function IndustriesScheduler__getEngagementChannelTypes(untrustedConfig, requestContext) {
998
+ const config = validateAdapterConfig$1(untrustedConfig, getEngagementChannelTypes_ConfigPropertyNames);
999
+ // Invalid or incomplete config
1000
+ if (config === null) {
1001
+ return null;
1002
+ }
1003
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1004
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
1005
+ };
1006
+
1007
+ function validate(obj, path = 'UpdateServiceAppointmentInputRepresentation') {
1008
+ const v_error = (() => {
1009
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1010
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1011
+ }
1012
+ if (obj.assignedResources !== undefined) {
1013
+ const obj_assignedResources = obj.assignedResources;
1014
+ const path_assignedResources = path + '.assignedResources';
1015
+ if (!ArrayIsArray(obj_assignedResources)) {
1016
+ return new TypeError('Expected "array" but received "' + typeof obj_assignedResources + '" (at "' + path_assignedResources + '")');
1017
+ }
1018
+ for (let i = 0; i < obj_assignedResources.length; i++) {
1019
+ const obj_assignedResources_item = obj_assignedResources[i];
1020
+ const path_assignedResources_item = path_assignedResources + '[' + i + ']';
1021
+ if (typeof obj_assignedResources_item !== 'object' || ArrayIsArray(obj_assignedResources_item) || obj_assignedResources_item === null) {
1022
+ return new TypeError('Expected "object" but received "' + typeof obj_assignedResources_item + '" (at "' + path_assignedResources_item + '")');
1023
+ }
1024
+ }
1025
+ }
1026
+ if (obj.lead !== undefined) {
1027
+ const obj_lead = obj.lead;
1028
+ const path_lead = path + '.lead';
1029
+ if (typeof obj_lead !== 'object' || ArrayIsArray(obj_lead) || obj_lead === null) {
1030
+ return new TypeError('Expected "object" but received "' + typeof obj_lead + '" (at "' + path_lead + '")');
1031
+ }
1032
+ }
1033
+ if (obj.schedulingPolicyId !== undefined) {
1034
+ const obj_schedulingPolicyId = obj.schedulingPolicyId;
1035
+ const path_schedulingPolicyId = path + '.schedulingPolicyId';
1036
+ if (typeof obj_schedulingPolicyId !== 'string') {
1037
+ return new TypeError('Expected "string" but received "' + typeof obj_schedulingPolicyId + '" (at "' + path_schedulingPolicyId + '")');
1038
+ }
1039
+ }
1040
+ const obj_serviceAppointment = obj.serviceAppointment;
1041
+ const path_serviceAppointment = path + '.serviceAppointment';
1042
+ if (typeof obj_serviceAppointment !== 'object' || ArrayIsArray(obj_serviceAppointment) || obj_serviceAppointment === null) {
1043
+ return new TypeError('Expected "object" but received "' + typeof obj_serviceAppointment + '" (at "' + path_serviceAppointment + '")');
1044
+ }
1045
+ const obj_serviceAppointmentId = obj.serviceAppointmentId;
1046
+ const path_serviceAppointmentId = path + '.serviceAppointmentId';
1047
+ if (typeof obj_serviceAppointmentId !== 'string') {
1048
+ return new TypeError('Expected "string" but received "' + typeof obj_serviceAppointmentId + '" (at "' + path_serviceAppointmentId + '")');
1049
+ }
1050
+ })();
1051
+ return v_error === undefined ? null : v_error;
1052
+ }
1053
+
1054
+ function select(luvio, params) {
1055
+ return select$6();
1056
+ }
1057
+ function getResponseCacheKeys(luvio, resourceParams, response) {
1058
+ return getTypeCacheKeys$1(luvio, response);
1059
+ }
1060
+ function ingestSuccess(luvio, resourceParams, response) {
1061
+ const { body } = response;
1062
+ const key = keyBuilderFromType(luvio, body);
1063
+ luvio.storeIngest(key, ingest$1, body);
1064
+ const snapshot = luvio.storeLookup({
1065
+ recordId: key,
1066
+ node: select(),
1067
+ variables: {},
1068
+ });
1069
+ if (process.env.NODE_ENV !== 'production') {
1070
+ if (snapshot.state !== 'Fulfilled') {
1071
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1072
+ }
1073
+ }
1074
+ return snapshot;
1075
+ }
1076
+ function createResourceRequest(config) {
1077
+ const headers = {};
1078
+ return {
1079
+ baseUri: '/services/data/v58.0',
1080
+ basePath: '/connect/scheduling/service-appointments',
1081
+ method: 'patch',
1082
+ body: config.body,
1083
+ urlParams: {},
1084
+ queryParams: {},
1085
+ headers,
1086
+ priority: 'normal',
1087
+ };
1088
+ }
1089
+
1090
+ const updateServiceAppointment_ConfigPropertyNames = {
1091
+ displayName: 'updateServiceAppointment',
1092
+ parameters: {
1093
+ required: ['updateServiceAppointmentInput'],
1094
+ optional: []
1095
+ }
1096
+ };
1097
+ function createResourceParams(config) {
1098
+ const resourceParams = {
1099
+ body: {
1100
+ updateServiceAppointmentInput: config.updateServiceAppointmentInput
1101
+ }
1102
+ };
1103
+ return resourceParams;
1104
+ }
1105
+ function typeCheckConfig(untrustedConfig) {
1106
+ const config = {};
1107
+ const untrustedConfig_updateServiceAppointmentInput = untrustedConfig.updateServiceAppointmentInput;
1108
+ const referenceUpdateServiceAppointmentInputRepresentationValidationError = validate(untrustedConfig_updateServiceAppointmentInput);
1109
+ if (referenceUpdateServiceAppointmentInputRepresentationValidationError === null) {
1110
+ config.updateServiceAppointmentInput = untrustedConfig_updateServiceAppointmentInput;
1111
+ }
1112
+ return config;
1113
+ }
1114
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
1115
+ if (!untrustedIsObject(untrustedConfig)) {
1116
+ return null;
1117
+ }
1118
+ if (process.env.NODE_ENV !== 'production') {
1119
+ validateConfig(untrustedConfig, configPropertyNames);
1120
+ }
1121
+ const config = typeCheckConfig(untrustedConfig);
1122
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1123
+ return null;
1124
+ }
1125
+ return config;
1126
+ }
1127
+ function buildNetworkSnapshot(luvio, config, options) {
1128
+ const resourceParams = createResourceParams(config);
1129
+ const request = createResourceRequest(resourceParams);
1130
+ return luvio.dispatchResourceRequest(request, options)
1131
+ .then((response) => {
1132
+ return luvio.handleSuccessResponse(() => {
1133
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
1134
+ return luvio.storeBroadcast().then(() => snapshot);
1135
+ }, () => getResponseCacheKeys(luvio, resourceParams, response.body));
1136
+ }, (response) => {
1137
+ deepFreeze(response);
1138
+ throw response;
1139
+ });
1140
+ }
1141
+ const updateServiceAppointmentAdapterFactory = (luvio) => {
1142
+ return function updateServiceAppointment(untrustedConfig) {
1143
+ const config = validateAdapterConfig(untrustedConfig, updateServiceAppointment_ConfigPropertyNames);
1144
+ // Invalid or incomplete config
1145
+ if (config === null) {
1146
+ throw new Error('Invalid config for "updateServiceAppointment"');
1147
+ }
1148
+ return buildNetworkSnapshot(luvio, config);
1149
+ };
1150
+ };
1151
+
1152
+ let createServiceAppointment;
1153
+ let getEngagementChannelTypes;
1154
+ let updateServiceAppointment;
1155
+ // Imperative GET Adapters
1156
+ let getEngagementChannelTypes_imperative;
1157
+ const getEngagementChannelTypesMetadata = { apiFamily: 'IndustriesScheduler', name: 'getEngagementChannelTypes' };
1158
+ function bindExportsTo(luvio) {
1159
+ // LDS Adapters
1160
+ const getEngagementChannelTypes_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getEngagementChannelTypes', getEngagementChannelTypesAdapterFactory), getEngagementChannelTypesMetadata);
1161
+ function unwrapSnapshotData(factory) {
1162
+ const adapter = factory(luvio);
1163
+ return (config) => adapter(config).then(snapshot => snapshot.data);
1164
+ }
1165
+ return {
1166
+ createServiceAppointment: unwrapSnapshotData(createServiceAppointmentAdapterFactory),
1167
+ getEngagementChannelTypes: createWireAdapterConstructor(luvio, getEngagementChannelTypes_ldsAdapter, getEngagementChannelTypesMetadata),
1168
+ updateServiceAppointment: unwrapSnapshotData(updateServiceAppointmentAdapterFactory),
1169
+ // Imperative GET Adapters
1170
+ getEngagementChannelTypes_imperative: createImperativeAdapter(luvio, getEngagementChannelTypes_ldsAdapter, getEngagementChannelTypesMetadata)
1171
+ };
1172
+ }
1173
+ withDefaultLuvio((luvio) => {
1174
+ ({
1175
+ createServiceAppointment,
1176
+ getEngagementChannelTypes,
1177
+ updateServiceAppointment,
1178
+ getEngagementChannelTypes_imperative
1179
+ } = bindExportsTo(luvio));
1180
+ });
1181
+
1182
+ export { createServiceAppointment, getEngagementChannelTypes, getEngagementChannelTypes_imperative, updateServiceAppointment };
1183
+ // version: 1.100.2-ca56bb821