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