@salesforce/lds-adapters-sales-user-working-hours 0.1.0-dev1

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