@salesforce/lds-adapters-sales-user-working-hours 0.131.0

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 (44) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/sales-user-working-hours.js +1101 -0
  3. package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +66 -0
  4. package/dist/es/es2018/types/src/generated/adapters/createSalesUserWorkingHours.d.ts +15 -0
  5. package/dist/es/es2018/types/src/generated/adapters/deleteSalesUserWorkingHours.d.ts +13 -0
  6. package/dist/es/es2018/types/src/generated/adapters/getSalesUserWorkingHours.d.ts +28 -0
  7. package/dist/es/es2018/types/src/generated/adapters/updateSalesUserWorkingHours.d.ts +15 -0
  8. package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +4 -0
  9. package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +7 -0
  10. package/dist/es/es2018/types/src/generated/resources/deleteSalesWorkingHoursTimeSlots.d.ts +8 -0
  11. package/dist/es/es2018/types/src/generated/resources/deleteSalesWorkingHoursTimeSlotsById.d.ts +12 -0
  12. package/dist/es/es2018/types/src/generated/resources/getSalesWorkingHoursTimeSlots.d.ts +17 -0
  13. package/dist/es/es2018/types/src/generated/resources/getSalesWorkingHoursTimeSlotsById.d.ts +19 -0
  14. package/dist/es/es2018/types/src/generated/resources/patchSalesWorkingHoursTimeSlots.d.ts +13 -0
  15. package/dist/es/es2018/types/src/generated/resources/patchSalesWorkingHoursTimeSlotsById.d.ts +17 -0
  16. package/dist/es/es2018/types/src/generated/resources/postActivityEngagementMetricsEngagement.d.ts +14 -0
  17. package/dist/es/es2018/types/src/generated/resources/postSalesAlertsDataAndMetrics.d.ts +13 -0
  18. package/dist/es/es2018/types/src/generated/resources/postSalesWorkingHoursTimeSlots.d.ts +13 -0
  19. package/dist/es/es2018/types/src/generated/resources/postSalesWorkingHoursTimeSlotsById.d.ts +17 -0
  20. package/dist/es/es2018/types/src/generated/resources/putActivityEngagementEventsEngagement.d.ts +9 -0
  21. package/dist/es/es2018/types/src/generated/types/EngagementAggregationRequest.d.ts +44 -0
  22. package/dist/es/es2018/types/src/generated/types/EngagementEventResponse.d.ts +32 -0
  23. package/dist/es/es2018/types/src/generated/types/HVSMetricOutputRepresentation.d.ts +38 -0
  24. package/dist/es/es2018/types/src/generated/types/HVSMetricsRequest.d.ts +35 -0
  25. package/dist/es/es2018/types/src/generated/types/HVSMetricsResponse.d.ts +36 -0
  26. package/dist/es/es2018/types/src/generated/types/HighVelocityEngagementEventRequest.d.ts +29 -0
  27. package/dist/es/es2018/types/src/generated/types/HighVelocityEngagementRequest.d.ts +77 -0
  28. package/dist/es/es2018/types/src/generated/types/SalesAlertsRequest.d.ts +32 -0
  29. package/dist/es/es2018/types/src/generated/types/SalesAlertsResponse.d.ts +54 -0
  30. package/dist/es/es2018/types/src/generated/types/SalesUserWorkingHoursGetResponseWrapper.d.ts +55 -0
  31. package/dist/es/es2018/types/src/generated/types/SalesUserWorkingHoursRequest.d.ts +33 -0
  32. package/dist/es/es2018/types/src/generated/types/SalesUserWorkingHoursRequestWrapper.d.ts +29 -0
  33. package/dist/es/es2018/types/src/generated/types/SalesUserWorkingHoursResponse.d.ts +54 -0
  34. package/dist/es/es2018/types/src/generated/types/TimeSlotInputRepresentation.d.ts +38 -0
  35. package/dist/es/es2018/types/src/generated/types/TimeSlotOutputRepresentation.d.ts +47 -0
  36. package/dist/es/es2018/types/src/generated/types/UpdateAlertsRequest.d.ts +35 -0
  37. package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +39 -0
  38. package/dist/es/es2018/types/src/main.d.ts +2 -0
  39. package/dist/es/es2018/types/src/sfdc.d.ts +3 -0
  40. package/package.json +65 -0
  41. package/sfdc/index.d.ts +1 -0
  42. package/sfdc/index.js +1185 -0
  43. package/src/raml/api.raml +462 -0
  44. package/src/raml/luvio.raml +43 -0
@@ -0,0 +1,1101 @@
1
+ /**
2
+ * Copyright (c) 2022, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ import { serializeStructuredKey, StoreKeyMap } from '@luvio/engine';
8
+
9
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
+ const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = Object;
11
+ const { isArray: ArrayIsArray$1 } = Array;
12
+ /**
13
+ * Validates an adapter config is well-formed.
14
+ * @param config The config to validate.
15
+ * @param adapter The adapter validation configuration.
16
+ * @param oneOf The keys the config must contain at least one of.
17
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
18
+ */
19
+ function validateConfig(config, adapter, oneOf) {
20
+ const { displayName } = adapter;
21
+ const { required, optional, unsupported } = adapter.parameters;
22
+ if (config === undefined ||
23
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
24
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
25
+ }
26
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
27
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
28
+ }
29
+ if (unsupported !== undefined &&
30
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
31
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
32
+ }
33
+ const supported = required.concat(optional);
34
+ if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
35
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
36
+ }
37
+ }
38
+ function untrustedIsObject(untrusted) {
39
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
40
+ }
41
+ function areRequiredParametersPresent(config, configPropertyNames) {
42
+ return configPropertyNames.parameters.required.every(req => req in config);
43
+ }
44
+ const snapshotRefreshOptions = {
45
+ overrides: {
46
+ headers: {
47
+ 'Cache-Control': 'no-cache',
48
+ },
49
+ }
50
+ };
51
+ const keyPrefix = 'user-working-hours';
52
+
53
+ const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
54
+ const { isArray: ArrayIsArray } = Array;
55
+ const { stringify: JSONStringify } = JSON;
56
+ function equalsArray(a, b, equalsItem) {
57
+ const aLength = a.length;
58
+ const bLength = b.length;
59
+ if (aLength !== bLength) {
60
+ return false;
61
+ }
62
+ for (let i = 0; i < aLength; i++) {
63
+ if (equalsItem(a[i], b[i]) === false) {
64
+ return false;
65
+ }
66
+ }
67
+ return true;
68
+ }
69
+ function deepFreeze(value) {
70
+ // No need to freeze primitives
71
+ if (typeof value !== 'object' || value === null) {
72
+ return;
73
+ }
74
+ if (ArrayIsArray(value)) {
75
+ for (let i = 0, len = value.length; i < len; i += 1) {
76
+ deepFreeze(value[i]);
77
+ }
78
+ }
79
+ else {
80
+ const keys = ObjectKeys(value);
81
+ for (let i = 0, len = keys.length; i < len; i += 1) {
82
+ deepFreeze(value[keys[i]]);
83
+ }
84
+ }
85
+ ObjectFreeze(value);
86
+ }
87
+ function createLink(ref) {
88
+ return {
89
+ __ref: serializeStructuredKey(ref),
90
+ };
91
+ }
92
+
93
+ const VERSION$2 = "ab53e63d1233601122336385be605930";
94
+ function validate$4(obj, path = 'TimeSlotOutputRepresentation') {
95
+ const v_error = (() => {
96
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
97
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
98
+ }
99
+ const obj_dayOfWeek = obj.dayOfWeek;
100
+ const path_dayOfWeek = path + '.dayOfWeek';
101
+ if (typeof obj_dayOfWeek !== 'string') {
102
+ return new TypeError('Expected "string" but received "' + typeof obj_dayOfWeek + '" (at "' + path_dayOfWeek + '")');
103
+ }
104
+ const obj_endTime = obj.endTime;
105
+ const path_endTime = path + '.endTime';
106
+ if (typeof obj_endTime !== 'string') {
107
+ return new TypeError('Expected "string" but received "' + typeof obj_endTime + '" (at "' + path_endTime + '")');
108
+ }
109
+ const obj_id = obj.id;
110
+ const path_id = path + '.id';
111
+ if (typeof obj_id !== 'string') {
112
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
113
+ }
114
+ const obj_startTime = obj.startTime;
115
+ const path_startTime = path + '.startTime';
116
+ if (typeof obj_startTime !== 'string') {
117
+ return new TypeError('Expected "string" but received "' + typeof obj_startTime + '" (at "' + path_startTime + '")');
118
+ }
119
+ })();
120
+ return v_error === undefined ? null : v_error;
121
+ }
122
+ const RepresentationType$2 = 'TimeSlotOutputRepresentation';
123
+ function keyBuilder$5(luvio, config) {
124
+ return keyPrefix + '::' + RepresentationType$2 + ':' + config.timeSlotId;
125
+ }
126
+ function keyBuilderFromType$2(luvio, object) {
127
+ const keyParams = {
128
+ timeSlotId: object.id
129
+ };
130
+ return keyBuilder$5(luvio, keyParams);
131
+ }
132
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
133
+ return input;
134
+ }
135
+ const select$5 = function TimeSlotOutputRepresentationSelect() {
136
+ return {
137
+ kind: 'Fragment',
138
+ version: VERSION$2,
139
+ private: [],
140
+ selections: [
141
+ {
142
+ name: 'dayOfWeek',
143
+ kind: 'Scalar'
144
+ },
145
+ {
146
+ name: 'endTime',
147
+ kind: 'Scalar'
148
+ },
149
+ {
150
+ name: 'id',
151
+ kind: 'Scalar'
152
+ },
153
+ {
154
+ name: 'startTime',
155
+ kind: 'Scalar'
156
+ }
157
+ ]
158
+ };
159
+ };
160
+ function equals$2(existing, incoming) {
161
+ const existing_dayOfWeek = existing.dayOfWeek;
162
+ const incoming_dayOfWeek = incoming.dayOfWeek;
163
+ if (!(existing_dayOfWeek === incoming_dayOfWeek)) {
164
+ return false;
165
+ }
166
+ const existing_endTime = existing.endTime;
167
+ const incoming_endTime = incoming.endTime;
168
+ if (!(existing_endTime === incoming_endTime)) {
169
+ return false;
170
+ }
171
+ const existing_id = existing.id;
172
+ const incoming_id = incoming.id;
173
+ if (!(existing_id === incoming_id)) {
174
+ return false;
175
+ }
176
+ const existing_startTime = existing.startTime;
177
+ const incoming_startTime = incoming.startTime;
178
+ if (!(existing_startTime === incoming_startTime)) {
179
+ return false;
180
+ }
181
+ return true;
182
+ }
183
+ const ingest$2 = function TimeSlotOutputRepresentationIngest(input, path, luvio, store, timestamp) {
184
+ if (process.env.NODE_ENV !== 'production') {
185
+ const validateError = validate$4(input);
186
+ if (validateError !== null) {
187
+ throw validateError;
188
+ }
189
+ }
190
+ const key = keyBuilderFromType$2(luvio, input);
191
+ const existingRecord = store.readEntry(key);
192
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 100;
193
+ let incomingRecord = normalize$2(input, store.readEntry(key), {
194
+ fullPath: key,
195
+ parent: path.parent,
196
+ propertyName: path.propertyName,
197
+ ttl: ttlToUse
198
+ });
199
+ if (existingRecord === undefined || equals$2(existingRecord, incomingRecord) === false) {
200
+ luvio.storePublish(key, incomingRecord);
201
+ }
202
+ if (ttlToUse !== undefined) {
203
+ const storeMetadataParams = {
204
+ ttl: ttlToUse,
205
+ namespace: "user-working-hours",
206
+ version: VERSION$2,
207
+ representationName: RepresentationType$2,
208
+ };
209
+ luvio.publishStoreMetadata(key, storeMetadataParams);
210
+ }
211
+ return createLink(key);
212
+ };
213
+ function getTypeCacheKeys$2(luvio, input, fullPathFactory) {
214
+ const rootKeySet = new StoreKeyMap();
215
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
216
+ const rootKey = keyBuilderFromType$2(luvio, input);
217
+ rootKeySet.set(rootKey, {
218
+ namespace: keyPrefix,
219
+ representationName: RepresentationType$2,
220
+ mergeable: false
221
+ });
222
+ return rootKeySet;
223
+ }
224
+
225
+ const VERSION$1 = "045d79fd271c04e2057703fa891ec24a";
226
+ function validate$3(obj, path = 'SalesUserWorkingHoursGetResponseWrapper') {
227
+ const v_error = (() => {
228
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
229
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
230
+ }
231
+ const obj_timeSlots = obj.timeSlots;
232
+ const path_timeSlots = path + '.timeSlots';
233
+ if (!ArrayIsArray(obj_timeSlots)) {
234
+ return new TypeError('Expected "array" but received "' + typeof obj_timeSlots + '" (at "' + path_timeSlots + '")');
235
+ }
236
+ for (let i = 0; i < obj_timeSlots.length; i++) {
237
+ const obj_timeSlots_item = obj_timeSlots[i];
238
+ const path_timeSlots_item = path_timeSlots + '[' + i + ']';
239
+ if (typeof obj_timeSlots_item !== 'object') {
240
+ return new TypeError('Expected "object" but received "' + typeof obj_timeSlots_item + '" (at "' + path_timeSlots_item + '")');
241
+ }
242
+ }
243
+ const obj_timeZone = obj.timeZone;
244
+ const path_timeZone = path + '.timeZone';
245
+ let obj_timeZone_union0 = null;
246
+ const obj_timeZone_union0_error = (() => {
247
+ if (typeof obj_timeZone !== 'string') {
248
+ return new TypeError('Expected "string" but received "' + typeof obj_timeZone + '" (at "' + path_timeZone + '")');
249
+ }
250
+ })();
251
+ if (obj_timeZone_union0_error != null) {
252
+ obj_timeZone_union0 = obj_timeZone_union0_error.message;
253
+ }
254
+ let obj_timeZone_union1 = null;
255
+ const obj_timeZone_union1_error = (() => {
256
+ if (obj_timeZone !== null) {
257
+ return new TypeError('Expected "null" but received "' + typeof obj_timeZone + '" (at "' + path_timeZone + '")');
258
+ }
259
+ })();
260
+ if (obj_timeZone_union1_error != null) {
261
+ obj_timeZone_union1 = obj_timeZone_union1_error.message;
262
+ }
263
+ if (obj_timeZone_union0 && obj_timeZone_union1) {
264
+ let message = 'Object doesn\'t match union (at "' + path_timeZone + '")';
265
+ message += '\n' + obj_timeZone_union0.split('\n').map((line) => '\t' + line).join('\n');
266
+ message += '\n' + obj_timeZone_union1.split('\n').map((line) => '\t' + line).join('\n');
267
+ return new TypeError(message);
268
+ }
269
+ const obj_userId = obj.userId;
270
+ const path_userId = path + '.userId';
271
+ if (typeof obj_userId !== 'string') {
272
+ return new TypeError('Expected "string" but received "' + typeof obj_userId + '" (at "' + path_userId + '")');
273
+ }
274
+ })();
275
+ return v_error === undefined ? null : v_error;
276
+ }
277
+ const RepresentationType$1 = 'SalesUserWorkingHoursGetResponseWrapper';
278
+ function keyBuilder$4(luvio, config) {
279
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.salesUserId;
280
+ }
281
+ function keyBuilderFromType$1(luvio, object) {
282
+ const keyParams = {
283
+ salesUserId: object.userId
284
+ };
285
+ return keyBuilder$4(luvio, keyParams);
286
+ }
287
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
288
+ const input_timeSlots = input.timeSlots;
289
+ const input_timeSlots_id = path.fullPath + '__timeSlots';
290
+ for (let i = 0; i < input_timeSlots.length; i++) {
291
+ const input_timeSlots_item = input_timeSlots[i];
292
+ let input_timeSlots_item_id = input_timeSlots_id + '__' + i;
293
+ input_timeSlots[i] = ingest$2(input_timeSlots_item, {
294
+ fullPath: input_timeSlots_item_id,
295
+ propertyName: i,
296
+ parent: {
297
+ data: input,
298
+ key: path.fullPath,
299
+ existing: existing,
300
+ },
301
+ ttl: path.ttl
302
+ }, luvio, store);
303
+ }
304
+ return input;
305
+ }
306
+ const select$4 = function SalesUserWorkingHoursGetResponseWrapperSelect() {
307
+ return {
308
+ kind: 'Fragment',
309
+ version: VERSION$1,
310
+ private: [],
311
+ selections: [
312
+ {
313
+ name: 'timeSlots',
314
+ kind: 'Link',
315
+ plural: true,
316
+ fragment: select$5()
317
+ },
318
+ {
319
+ name: 'timeZone',
320
+ kind: 'Scalar'
321
+ },
322
+ {
323
+ name: 'userId',
324
+ kind: 'Scalar'
325
+ }
326
+ ]
327
+ };
328
+ };
329
+ function equals$1(existing, incoming) {
330
+ const existing_userId = existing.userId;
331
+ const incoming_userId = incoming.userId;
332
+ if (!(existing_userId === incoming_userId)) {
333
+ return false;
334
+ }
335
+ const existing_timeSlots = existing.timeSlots;
336
+ const incoming_timeSlots = incoming.timeSlots;
337
+ const equals_timeSlots_items = equalsArray(existing_timeSlots, incoming_timeSlots, (existing_timeSlots_item, incoming_timeSlots_item) => {
338
+ if (!(existing_timeSlots_item.__ref === incoming_timeSlots_item.__ref)) {
339
+ return false;
340
+ }
341
+ });
342
+ if (equals_timeSlots_items === false) {
343
+ return false;
344
+ }
345
+ const existing_timeZone = existing.timeZone;
346
+ const incoming_timeZone = incoming.timeZone;
347
+ if (!(existing_timeZone === incoming_timeZone)) {
348
+ return false;
349
+ }
350
+ return true;
351
+ }
352
+ const ingest$1 = function SalesUserWorkingHoursGetResponseWrapperIngest(input, path, luvio, store, timestamp) {
353
+ if (process.env.NODE_ENV !== 'production') {
354
+ const validateError = validate$3(input);
355
+ if (validateError !== null) {
356
+ throw validateError;
357
+ }
358
+ }
359
+ const key = keyBuilderFromType$1(luvio, input);
360
+ const existingRecord = store.readEntry(key);
361
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 100;
362
+ let incomingRecord = normalize$1(input, store.readEntry(key), {
363
+ fullPath: key,
364
+ parent: path.parent,
365
+ propertyName: path.propertyName,
366
+ ttl: ttlToUse
367
+ }, luvio, store);
368
+ if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
369
+ luvio.storePublish(key, incomingRecord);
370
+ }
371
+ if (ttlToUse !== undefined) {
372
+ const storeMetadataParams = {
373
+ ttl: ttlToUse,
374
+ namespace: "user-working-hours",
375
+ version: VERSION$1,
376
+ representationName: RepresentationType$1,
377
+ };
378
+ luvio.publishStoreMetadata(key, storeMetadataParams);
379
+ }
380
+ return createLink(key);
381
+ };
382
+ function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
383
+ const rootKeySet = new StoreKeyMap();
384
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
385
+ const rootKey = keyBuilderFromType$1(luvio, input);
386
+ rootKeySet.set(rootKey, {
387
+ namespace: keyPrefix,
388
+ representationName: RepresentationType$1,
389
+ mergeable: false
390
+ });
391
+ const input_timeSlots_length = input.timeSlots.length;
392
+ for (let i = 0; i < input_timeSlots_length; i++) {
393
+ rootKeySet.merge(getTypeCacheKeys$2(luvio, input.timeSlots[i]));
394
+ }
395
+ return rootKeySet;
396
+ }
397
+ const notifyUpdateAvailableFactory = (luvio) => {
398
+ return function notifyUserWorkingHoursUpdateAvailable(configs) {
399
+ if (process.env.NODE_ENV !== 'production') {
400
+ const requiredKeyParams = ['salesUserId'];
401
+ configs.forEach(config => {
402
+ if (false === requiredKeyParams.every(req => req in config)) {
403
+ throw new Error(`one of the configs did not contain all required parameters: ${JSONStringify(ObjectKeys(config))}`);
404
+ }
405
+ });
406
+ }
407
+ const keys = configs.map(c => keyBuilder$4(luvio, c));
408
+ return luvio.notifyStoreUpdateAvailable(keys);
409
+ };
410
+ };
411
+
412
+ function select$3(luvio, params) {
413
+ return select$4();
414
+ }
415
+ function keyBuilder$3(luvio, params) {
416
+ return keyBuilder$4(luvio, {
417
+ salesUserId: params.queryParams.userId
418
+ });
419
+ }
420
+ function getResponseCacheKeys$3(luvio, resourceParams, response) {
421
+ return getTypeCacheKeys$1(luvio, response);
422
+ }
423
+ function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
424
+ const { body } = response;
425
+ const key = keyBuilder$3(luvio, resourceParams);
426
+ luvio.storeIngest(key, ingest$1, body);
427
+ const snapshot = luvio.storeLookup({
428
+ recordId: key,
429
+ node: select$3(),
430
+ variables: {},
431
+ }, snapshotRefresh);
432
+ if (process.env.NODE_ENV !== 'production') {
433
+ if (snapshot.state !== 'Fulfilled') {
434
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
435
+ }
436
+ }
437
+ return snapshot;
438
+ }
439
+ function ingestError(luvio, params, error, snapshotRefresh) {
440
+ const key = keyBuilder$3(luvio, params);
441
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
442
+ luvio.storeIngestError(key, errorSnapshot);
443
+ return errorSnapshot;
444
+ }
445
+ function createResourceRequest$3(config) {
446
+ const headers = {};
447
+ return {
448
+ baseUri: '/services/data/v58.0',
449
+ basePath: '/sales/working-hours/time-slots',
450
+ method: 'get',
451
+ body: null,
452
+ urlParams: {},
453
+ queryParams: config.queryParams,
454
+ headers,
455
+ priority: 'normal',
456
+ };
457
+ }
458
+
459
+ const getSalesUserWorkingHours_ConfigPropertyNames = {
460
+ displayName: 'getSalesUserWorkingHours',
461
+ parameters: {
462
+ required: ['userId'],
463
+ optional: ['workingHoursType']
464
+ }
465
+ };
466
+ function createResourceParams$3(config) {
467
+ const resourceParams = {
468
+ queryParams: {
469
+ userId: config.userId, workingHoursType: config.workingHoursType
470
+ }
471
+ };
472
+ return resourceParams;
473
+ }
474
+ function keyBuilder$2(luvio, config) {
475
+ const resourceParams = createResourceParams$3(config);
476
+ return keyBuilder$3(luvio, resourceParams);
477
+ }
478
+ function typeCheckConfig$3(untrustedConfig) {
479
+ const config = {};
480
+ const untrustedConfig_userId = untrustedConfig.userId;
481
+ if (typeof untrustedConfig_userId === 'string') {
482
+ config.userId = untrustedConfig_userId;
483
+ }
484
+ const untrustedConfig_workingHoursType = untrustedConfig.workingHoursType;
485
+ if (typeof untrustedConfig_workingHoursType === 'string') {
486
+ config.workingHoursType = untrustedConfig_workingHoursType;
487
+ }
488
+ return config;
489
+ }
490
+ function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
491
+ if (!untrustedIsObject(untrustedConfig)) {
492
+ return null;
493
+ }
494
+ if (process.env.NODE_ENV !== 'production') {
495
+ validateConfig(untrustedConfig, configPropertyNames);
496
+ }
497
+ const config = typeCheckConfig$3(untrustedConfig);
498
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
499
+ return null;
500
+ }
501
+ return config;
502
+ }
503
+ function adapterFragment(luvio, config) {
504
+ createResourceParams$3(config);
505
+ return select$3();
506
+ }
507
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
508
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
509
+ config,
510
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
511
+ });
512
+ return luvio.storeBroadcast().then(() => snapshot);
513
+ }
514
+ function onFetchResponseError(luvio, config, resourceParams, response) {
515
+ const snapshot = ingestError(luvio, resourceParams, response, {
516
+ config,
517
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
518
+ });
519
+ return luvio.storeBroadcast().then(() => snapshot);
520
+ }
521
+ function buildNetworkSnapshot$3(luvio, config, options) {
522
+ const resourceParams = createResourceParams$3(config);
523
+ const request = createResourceRequest$3(resourceParams);
524
+ return luvio.dispatchResourceRequest(request, options)
525
+ .then((response) => {
526
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys$3(luvio, resourceParams, response.body));
527
+ }, (response) => {
528
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
529
+ });
530
+ }
531
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
532
+ const { luvio, config } = context;
533
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
534
+ const dispatchOptions = {
535
+ resourceRequestContext: {
536
+ requestCorrelator,
537
+ luvioRequestMethod: undefined,
538
+ },
539
+ eventObservers
540
+ };
541
+ if (networkPriority !== 'normal') {
542
+ dispatchOptions.overrides = {
543
+ priority: networkPriority
544
+ };
545
+ }
546
+ return buildNetworkSnapshot$3(luvio, config, dispatchOptions);
547
+ }
548
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
549
+ const { luvio, config } = context;
550
+ const selector = {
551
+ recordId: keyBuilder$2(luvio, config),
552
+ node: adapterFragment(luvio, config),
553
+ variables: {},
554
+ };
555
+ const cacheSnapshot = storeLookup(selector, {
556
+ config,
557
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
558
+ });
559
+ return cacheSnapshot;
560
+ }
561
+ const getSalesUserWorkingHoursAdapterFactory = (luvio) => function userWorkingHours__getSalesUserWorkingHours(untrustedConfig, requestContext) {
562
+ const config = validateAdapterConfig$3(untrustedConfig, getSalesUserWorkingHours_ConfigPropertyNames);
563
+ // Invalid or incomplete config
564
+ if (config === null) {
565
+ return null;
566
+ }
567
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
568
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
569
+ };
570
+
571
+ function validate$2(obj, path = 'TimeSlotInputRepresentation') {
572
+ const v_error = (() => {
573
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
574
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
575
+ }
576
+ if (obj.dayOfWeek !== undefined) {
577
+ const obj_dayOfWeek = obj.dayOfWeek;
578
+ const path_dayOfWeek = path + '.dayOfWeek';
579
+ if (typeof obj_dayOfWeek !== 'string') {
580
+ return new TypeError('Expected "string" but received "' + typeof obj_dayOfWeek + '" (at "' + path_dayOfWeek + '")');
581
+ }
582
+ }
583
+ if (obj.endTime !== undefined) {
584
+ const obj_endTime = obj.endTime;
585
+ const path_endTime = path + '.endTime';
586
+ if (typeof obj_endTime !== 'string') {
587
+ return new TypeError('Expected "string" but received "' + typeof obj_endTime + '" (at "' + path_endTime + '")');
588
+ }
589
+ }
590
+ if (obj.id !== undefined) {
591
+ const obj_id = obj.id;
592
+ const path_id = path + '.id';
593
+ if (typeof obj_id !== 'string') {
594
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
595
+ }
596
+ }
597
+ if (obj.startTime !== undefined) {
598
+ const obj_startTime = obj.startTime;
599
+ const path_startTime = path + '.startTime';
600
+ if (typeof obj_startTime !== 'string') {
601
+ return new TypeError('Expected "string" but received "' + typeof obj_startTime + '" (at "' + path_startTime + '")');
602
+ }
603
+ }
604
+ })();
605
+ return v_error === undefined ? null : v_error;
606
+ }
607
+
608
+ function validate$1(obj, path = 'SalesUserWorkingHoursRequest') {
609
+ const v_error = (() => {
610
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
611
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
612
+ }
613
+ const obj_salesUserWorkingHoursType = obj.salesUserWorkingHoursType;
614
+ const path_salesUserWorkingHoursType = path + '.salesUserWorkingHoursType';
615
+ if (typeof obj_salesUserWorkingHoursType !== 'string') {
616
+ return new TypeError('Expected "string" but received "' + typeof obj_salesUserWorkingHoursType + '" (at "' + path_salesUserWorkingHoursType + '")');
617
+ }
618
+ const obj_timeSlots = obj.timeSlots;
619
+ const path_timeSlots = path + '.timeSlots';
620
+ if (!ArrayIsArray(obj_timeSlots)) {
621
+ return new TypeError('Expected "array" but received "' + typeof obj_timeSlots + '" (at "' + path_timeSlots + '")');
622
+ }
623
+ for (let i = 0; i < obj_timeSlots.length; i++) {
624
+ const obj_timeSlots_item = obj_timeSlots[i];
625
+ const path_timeSlots_item = path_timeSlots + '[' + i + ']';
626
+ const referencepath_timeSlots_itemValidationError = validate$2(obj_timeSlots_item, path_timeSlots_item);
627
+ if (referencepath_timeSlots_itemValidationError !== null) {
628
+ let message = 'Object doesn\'t match TimeSlotInputRepresentation (at "' + path_timeSlots_item + '")\n';
629
+ message += referencepath_timeSlots_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
630
+ return new TypeError(message);
631
+ }
632
+ }
633
+ })();
634
+ return v_error === undefined ? null : v_error;
635
+ }
636
+
637
+ const VERSION = "31f7cd8da38f07de7f040a661d50f857";
638
+ function validate(obj, path = 'SalesUserWorkingHoursResponse') {
639
+ const v_error = (() => {
640
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
641
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
642
+ }
643
+ const obj_timeSlots = obj.timeSlots;
644
+ const path_timeSlots = path + '.timeSlots';
645
+ if (!ArrayIsArray(obj_timeSlots)) {
646
+ return new TypeError('Expected "array" but received "' + typeof obj_timeSlots + '" (at "' + path_timeSlots + '")');
647
+ }
648
+ for (let i = 0; i < obj_timeSlots.length; i++) {
649
+ const obj_timeSlots_item = obj_timeSlots[i];
650
+ const path_timeSlots_item = path_timeSlots + '[' + i + ']';
651
+ if (typeof obj_timeSlots_item !== 'object') {
652
+ return new TypeError('Expected "object" but received "' + typeof obj_timeSlots_item + '" (at "' + path_timeSlots_item + '")');
653
+ }
654
+ }
655
+ const obj_timeZone = obj.timeZone;
656
+ const path_timeZone = path + '.timeZone';
657
+ let obj_timeZone_union0 = null;
658
+ const obj_timeZone_union0_error = (() => {
659
+ if (typeof obj_timeZone !== 'string') {
660
+ return new TypeError('Expected "string" but received "' + typeof obj_timeZone + '" (at "' + path_timeZone + '")');
661
+ }
662
+ })();
663
+ if (obj_timeZone_union0_error != null) {
664
+ obj_timeZone_union0 = obj_timeZone_union0_error.message;
665
+ }
666
+ let obj_timeZone_union1 = null;
667
+ const obj_timeZone_union1_error = (() => {
668
+ if (obj_timeZone !== null) {
669
+ return new TypeError('Expected "null" but received "' + typeof obj_timeZone + '" (at "' + path_timeZone + '")');
670
+ }
671
+ })();
672
+ if (obj_timeZone_union1_error != null) {
673
+ obj_timeZone_union1 = obj_timeZone_union1_error.message;
674
+ }
675
+ if (obj_timeZone_union0 && obj_timeZone_union1) {
676
+ let message = 'Object doesn\'t match union (at "' + path_timeZone + '")';
677
+ message += '\n' + obj_timeZone_union0.split('\n').map((line) => '\t' + line).join('\n');
678
+ message += '\n' + obj_timeZone_union1.split('\n').map((line) => '\t' + line).join('\n');
679
+ return new TypeError(message);
680
+ }
681
+ const obj_userId = obj.userId;
682
+ const path_userId = path + '.userId';
683
+ if (typeof obj_userId !== 'string') {
684
+ return new TypeError('Expected "string" but received "' + typeof obj_userId + '" (at "' + path_userId + '")');
685
+ }
686
+ })();
687
+ return v_error === undefined ? null : v_error;
688
+ }
689
+ const RepresentationType = 'SalesUserWorkingHoursResponse';
690
+ function keyBuilder$1(luvio, config) {
691
+ return keyPrefix + '::' + RepresentationType + ':' + config.salesUserId;
692
+ }
693
+ function keyBuilderFromType(luvio, object) {
694
+ const keyParams = {
695
+ salesUserId: object.userId
696
+ };
697
+ return keyBuilder$1(luvio, keyParams);
698
+ }
699
+ function normalize(input, existing, path, luvio, store, timestamp) {
700
+ const input_timeSlots = input.timeSlots;
701
+ const input_timeSlots_id = path.fullPath + '__timeSlots';
702
+ for (let i = 0; i < input_timeSlots.length; i++) {
703
+ const input_timeSlots_item = input_timeSlots[i];
704
+ let input_timeSlots_item_id = input_timeSlots_id + '__' + i;
705
+ input_timeSlots[i] = ingest$2(input_timeSlots_item, {
706
+ fullPath: input_timeSlots_item_id,
707
+ propertyName: i,
708
+ parent: {
709
+ data: input,
710
+ key: path.fullPath,
711
+ existing: existing,
712
+ },
713
+ ttl: path.ttl
714
+ }, luvio, store);
715
+ }
716
+ return input;
717
+ }
718
+ const select$2 = function SalesUserWorkingHoursResponseSelect() {
719
+ return {
720
+ kind: 'Fragment',
721
+ version: VERSION,
722
+ private: [],
723
+ selections: [
724
+ {
725
+ name: 'timeSlots',
726
+ kind: 'Link',
727
+ plural: true,
728
+ fragment: select$5()
729
+ },
730
+ {
731
+ name: 'timeZone',
732
+ kind: 'Scalar'
733
+ },
734
+ {
735
+ name: 'userId',
736
+ kind: 'Scalar'
737
+ }
738
+ ]
739
+ };
740
+ };
741
+ function equals(existing, incoming) {
742
+ const existing_userId = existing.userId;
743
+ const incoming_userId = incoming.userId;
744
+ if (!(existing_userId === incoming_userId)) {
745
+ return false;
746
+ }
747
+ const existing_timeSlots = existing.timeSlots;
748
+ const incoming_timeSlots = incoming.timeSlots;
749
+ const equals_timeSlots_items = equalsArray(existing_timeSlots, incoming_timeSlots, (existing_timeSlots_item, incoming_timeSlots_item) => {
750
+ if (!(existing_timeSlots_item.__ref === incoming_timeSlots_item.__ref)) {
751
+ return false;
752
+ }
753
+ });
754
+ if (equals_timeSlots_items === false) {
755
+ return false;
756
+ }
757
+ const existing_timeZone = existing.timeZone;
758
+ const incoming_timeZone = incoming.timeZone;
759
+ if (!(existing_timeZone === incoming_timeZone)) {
760
+ return false;
761
+ }
762
+ return true;
763
+ }
764
+ const ingest = function SalesUserWorkingHoursResponseIngest(input, path, luvio, store, timestamp) {
765
+ if (process.env.NODE_ENV !== 'production') {
766
+ const validateError = validate(input);
767
+ if (validateError !== null) {
768
+ throw validateError;
769
+ }
770
+ }
771
+ const key = keyBuilderFromType(luvio, input);
772
+ const existingRecord = store.readEntry(key);
773
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 100;
774
+ let incomingRecord = normalize(input, store.readEntry(key), {
775
+ fullPath: key,
776
+ parent: path.parent,
777
+ propertyName: path.propertyName,
778
+ ttl: ttlToUse
779
+ }, luvio, store);
780
+ if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
781
+ luvio.storePublish(key, incomingRecord);
782
+ }
783
+ if (ttlToUse !== undefined) {
784
+ const storeMetadataParams = {
785
+ ttl: ttlToUse,
786
+ namespace: "user-working-hours",
787
+ version: VERSION,
788
+ representationName: RepresentationType,
789
+ };
790
+ luvio.publishStoreMetadata(key, storeMetadataParams);
791
+ }
792
+ return createLink(key);
793
+ };
794
+ function getTypeCacheKeys(luvio, input, fullPathFactory) {
795
+ const rootKeySet = new StoreKeyMap();
796
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
797
+ const rootKey = keyBuilderFromType(luvio, input);
798
+ rootKeySet.set(rootKey, {
799
+ namespace: keyPrefix,
800
+ representationName: RepresentationType,
801
+ mergeable: false
802
+ });
803
+ const input_timeSlots_length = input.timeSlots.length;
804
+ for (let i = 0; i < input_timeSlots_length; i++) {
805
+ rootKeySet.merge(getTypeCacheKeys$2(luvio, input.timeSlots[i]));
806
+ }
807
+ return rootKeySet;
808
+ }
809
+
810
+ function select$1(luvio, params) {
811
+ return select$2();
812
+ }
813
+ function getResponseCacheKeys$2(luvio, resourceParams, response) {
814
+ return getTypeCacheKeys(luvio, response);
815
+ }
816
+ function ingestSuccess$1(luvio, resourceParams, response) {
817
+ const { body } = response;
818
+ const key = keyBuilderFromType(luvio, body);
819
+ luvio.storeIngest(key, ingest, body);
820
+ const snapshot = luvio.storeLookup({
821
+ recordId: key,
822
+ node: select$1(),
823
+ variables: {},
824
+ });
825
+ if (process.env.NODE_ENV !== 'production') {
826
+ if (snapshot.state !== 'Fulfilled') {
827
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
828
+ }
829
+ }
830
+ return snapshot;
831
+ }
832
+ function createResourceRequest$2(config) {
833
+ const headers = {};
834
+ return {
835
+ baseUri: '/services/data/v58.0',
836
+ basePath: '/sales/working-hours/time-slots',
837
+ method: 'patch',
838
+ body: config.body,
839
+ urlParams: {},
840
+ queryParams: {},
841
+ headers,
842
+ priority: 'normal',
843
+ };
844
+ }
845
+
846
+ const updateSalesUserWorkingHours_ConfigPropertyNames = {
847
+ displayName: 'updateSalesUserWorkingHours',
848
+ parameters: {
849
+ required: ['salesUserWorkingHoursRequest'],
850
+ optional: []
851
+ }
852
+ };
853
+ function createResourceParams$2(config) {
854
+ const resourceParams = {
855
+ body: {
856
+ salesUserWorkingHoursRequest: config.salesUserWorkingHoursRequest
857
+ }
858
+ };
859
+ return resourceParams;
860
+ }
861
+ function typeCheckConfig$2(untrustedConfig) {
862
+ const config = {};
863
+ const untrustedConfig_salesUserWorkingHoursRequest = untrustedConfig.salesUserWorkingHoursRequest;
864
+ const referenceSalesUserWorkingHoursRequestValidationError = validate$1(untrustedConfig_salesUserWorkingHoursRequest);
865
+ if (referenceSalesUserWorkingHoursRequestValidationError === null) {
866
+ config.salesUserWorkingHoursRequest = untrustedConfig_salesUserWorkingHoursRequest;
867
+ }
868
+ return config;
869
+ }
870
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
871
+ if (!untrustedIsObject(untrustedConfig)) {
872
+ return null;
873
+ }
874
+ if (process.env.NODE_ENV !== 'production') {
875
+ validateConfig(untrustedConfig, configPropertyNames);
876
+ }
877
+ const config = typeCheckConfig$2(untrustedConfig);
878
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
879
+ return null;
880
+ }
881
+ return config;
882
+ }
883
+ function buildNetworkSnapshot$2(luvio, config, options) {
884
+ const resourceParams = createResourceParams$2(config);
885
+ const request = createResourceRequest$2(resourceParams);
886
+ return luvio.dispatchResourceRequest(request, options)
887
+ .then((response) => {
888
+ return luvio.handleSuccessResponse(() => {
889
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response);
890
+ return luvio.storeBroadcast().then(() => snapshot);
891
+ }, () => getResponseCacheKeys$2(luvio, resourceParams, response.body));
892
+ }, (response) => {
893
+ deepFreeze(response);
894
+ throw response;
895
+ });
896
+ }
897
+ const updateSalesUserWorkingHoursAdapterFactory = (luvio) => {
898
+ return function updateSalesUserWorkingHours(untrustedConfig) {
899
+ const config = validateAdapterConfig$2(untrustedConfig, updateSalesUserWorkingHours_ConfigPropertyNames);
900
+ // Invalid or incomplete config
901
+ if (config === null) {
902
+ throw new Error('Invalid config for "updateSalesUserWorkingHours"');
903
+ }
904
+ return buildNetworkSnapshot$2(luvio, config);
905
+ };
906
+ };
907
+
908
+ function select(luvio, params) {
909
+ return select$2();
910
+ }
911
+ function getResponseCacheKeys$1(luvio, resourceParams, response) {
912
+ return getTypeCacheKeys(luvio, response);
913
+ }
914
+ function ingestSuccess(luvio, resourceParams, response) {
915
+ const { body } = response;
916
+ const key = keyBuilderFromType(luvio, body);
917
+ luvio.storeIngest(key, ingest, body);
918
+ const snapshot = luvio.storeLookup({
919
+ recordId: key,
920
+ node: select(),
921
+ variables: {},
922
+ });
923
+ if (process.env.NODE_ENV !== 'production') {
924
+ if (snapshot.state !== 'Fulfilled') {
925
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
926
+ }
927
+ }
928
+ return snapshot;
929
+ }
930
+ function createResourceRequest$1(config) {
931
+ const headers = {};
932
+ return {
933
+ baseUri: '/services/data/v58.0',
934
+ basePath: '/sales/working-hours/time-slots',
935
+ method: 'post',
936
+ body: config.body,
937
+ urlParams: {},
938
+ queryParams: {},
939
+ headers,
940
+ priority: 'normal',
941
+ };
942
+ }
943
+
944
+ const createSalesUserWorkingHours_ConfigPropertyNames = {
945
+ displayName: 'createSalesUserWorkingHours',
946
+ parameters: {
947
+ required: ['salesUserWorkingHoursRequest'],
948
+ optional: []
949
+ }
950
+ };
951
+ function createResourceParams$1(config) {
952
+ const resourceParams = {
953
+ body: {
954
+ salesUserWorkingHoursRequest: config.salesUserWorkingHoursRequest
955
+ }
956
+ };
957
+ return resourceParams;
958
+ }
959
+ function typeCheckConfig$1(untrustedConfig) {
960
+ const config = {};
961
+ const untrustedConfig_salesUserWorkingHoursRequest = untrustedConfig.salesUserWorkingHoursRequest;
962
+ const referenceSalesUserWorkingHoursRequestValidationError = validate$1(untrustedConfig_salesUserWorkingHoursRequest);
963
+ if (referenceSalesUserWorkingHoursRequestValidationError === null) {
964
+ config.salesUserWorkingHoursRequest = untrustedConfig_salesUserWorkingHoursRequest;
965
+ }
966
+ return config;
967
+ }
968
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
969
+ if (!untrustedIsObject(untrustedConfig)) {
970
+ return null;
971
+ }
972
+ if (process.env.NODE_ENV !== 'production') {
973
+ validateConfig(untrustedConfig, configPropertyNames);
974
+ }
975
+ const config = typeCheckConfig$1(untrustedConfig);
976
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
977
+ return null;
978
+ }
979
+ return config;
980
+ }
981
+ function buildNetworkSnapshot$1(luvio, config, options) {
982
+ const resourceParams = createResourceParams$1(config);
983
+ const request = createResourceRequest$1(resourceParams);
984
+ return luvio.dispatchResourceRequest(request, options)
985
+ .then((response) => {
986
+ return luvio.handleSuccessResponse(() => {
987
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
988
+ return luvio.storeBroadcast().then(() => snapshot);
989
+ }, () => getResponseCacheKeys$1(luvio, resourceParams, response.body));
990
+ }, (response) => {
991
+ deepFreeze(response);
992
+ throw response;
993
+ });
994
+ }
995
+ const createSalesUserWorkingHoursAdapterFactory = (luvio) => {
996
+ return function createSalesUserWorkingHours(untrustedConfig) {
997
+ const config = validateAdapterConfig$1(untrustedConfig, createSalesUserWorkingHours_ConfigPropertyNames);
998
+ // Invalid or incomplete config
999
+ if (config === null) {
1000
+ throw new Error('Invalid config for "createSalesUserWorkingHours"');
1001
+ }
1002
+ return buildNetworkSnapshot$1(luvio, config);
1003
+ };
1004
+ };
1005
+
1006
+ function keyBuilder(luvio, params) {
1007
+ return keyBuilder$5(luvio, {
1008
+ timeSlotId: params.urlParams.id
1009
+ });
1010
+ }
1011
+ function getResponseCacheKeys(luvio, resourceParams) {
1012
+ const key = keyBuilder(luvio, resourceParams);
1013
+ const cacheKeyMap = new StoreKeyMap();
1014
+ cacheKeyMap.set(key, {
1015
+ namespace: keyPrefix,
1016
+ representationName: RepresentationType$2,
1017
+ mergeable: false
1018
+ });
1019
+ return cacheKeyMap;
1020
+ }
1021
+ function evictSuccess(luvio, resourceParams) {
1022
+ const key = keyBuilder(luvio, resourceParams);
1023
+ luvio.storeEvict(key);
1024
+ }
1025
+ function createResourceRequest(config) {
1026
+ const headers = {};
1027
+ return {
1028
+ baseUri: '/services/data/v58.0',
1029
+ basePath: '/sales/working-hours/time-slots/' + config.urlParams.id + '',
1030
+ method: 'delete',
1031
+ body: null,
1032
+ urlParams: config.urlParams,
1033
+ queryParams: {},
1034
+ headers,
1035
+ priority: 'normal',
1036
+ };
1037
+ }
1038
+
1039
+ const adapterName = 'deleteSalesUserWorkingHours';
1040
+ const deleteSalesUserWorkingHours_ConfigPropertyNames = {
1041
+ displayName: 'deleteSalesUserWorkingHours',
1042
+ parameters: {
1043
+ required: ['id'],
1044
+ optional: []
1045
+ }
1046
+ };
1047
+ function createResourceParams(config) {
1048
+ const resourceParams = {
1049
+ urlParams: {
1050
+ id: config.id
1051
+ }
1052
+ };
1053
+ return resourceParams;
1054
+ }
1055
+ function typeCheckConfig(untrustedConfig) {
1056
+ const config = {};
1057
+ const untrustedConfig_id = untrustedConfig.id;
1058
+ if (typeof untrustedConfig_id === 'string') {
1059
+ config.id = untrustedConfig_id;
1060
+ }
1061
+ return config;
1062
+ }
1063
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
1064
+ if (!untrustedIsObject(untrustedConfig)) {
1065
+ return null;
1066
+ }
1067
+ if (process.env.NODE_ENV !== 'production') {
1068
+ validateConfig(untrustedConfig, configPropertyNames);
1069
+ }
1070
+ const config = typeCheckConfig(untrustedConfig);
1071
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1072
+ return null;
1073
+ }
1074
+ return config;
1075
+ }
1076
+ function buildNetworkSnapshot(luvio, config, options) {
1077
+ const resourceParams = createResourceParams(config);
1078
+ const request = createResourceRequest(resourceParams);
1079
+ return luvio.dispatchResourceRequest(request, options)
1080
+ .then(() => {
1081
+ return luvio.handleSuccessResponse(() => {
1082
+ evictSuccess(luvio, resourceParams);
1083
+ return luvio.storeBroadcast();
1084
+ }, () => getResponseCacheKeys(luvio, resourceParams));
1085
+ }, (response) => {
1086
+ deepFreeze(response);
1087
+ throw response;
1088
+ });
1089
+ }
1090
+ const deleteSalesUserWorkingHoursAdapterFactory = (luvio) => {
1091
+ return function userWorkingHoursdeleteSalesUserWorkingHours(untrustedConfig) {
1092
+ const config = validateAdapterConfig(untrustedConfig, deleteSalesUserWorkingHours_ConfigPropertyNames);
1093
+ // Invalid or incomplete config
1094
+ if (config === null) {
1095
+ throw new Error(`Invalid config for "${adapterName}"`);
1096
+ }
1097
+ return buildNetworkSnapshot(luvio, config);
1098
+ };
1099
+ };
1100
+
1101
+ export { createSalesUserWorkingHoursAdapterFactory, deleteSalesUserWorkingHoursAdapterFactory, getSalesUserWorkingHoursAdapterFactory, notifyUpdateAvailableFactory as notifyUserWorkingHoursUpdateAvailableFactory, updateSalesUserWorkingHoursAdapterFactory };