@salesforce/lds-adapters-sales-saleseinsteincoach 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 (30) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/sales-saleseinsteincoach.js +1051 -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/deleteRolePlaySession.d.ts +14 -0
  5. package/dist/es/es2018/types/src/generated/adapters/getSalesEinsteinCoachConfiguration.d.ts +27 -0
  6. package/dist/es/es2018/types/src/generated/adapters/startRolePlaySession.d.ts +16 -0
  7. package/dist/es/es2018/types/src/generated/adapters/submitForFeedback.d.ts +19 -0
  8. package/dist/es/es2018/types/src/generated/adapters/submitForRolePlay.d.ts +19 -0
  9. package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +5 -0
  10. package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +7 -0
  11. package/dist/es/es2018/types/src/generated/resources/deleteSalesEinsteinCoachPracticeRoleplay.d.ts +12 -0
  12. package/dist/es/es2018/types/src/generated/resources/getSalesEinsteinCoachPracticeConfiguration.d.ts +15 -0
  13. package/dist/es/es2018/types/src/generated/resources/getSalesEinsteinCoachPracticeRoleplay.d.ts +15 -0
  14. package/dist/es/es2018/types/src/generated/resources/postSalesEinsteinCoachPracticeFeedback.d.ts +16 -0
  15. package/dist/es/es2018/types/src/generated/resources/postSalesEinsteinCoachPracticeRoleplay.d.ts +18 -0
  16. package/dist/es/es2018/types/src/generated/resources/postSalesEinsteinCoachPracticeRoleplayStart.d.ts +13 -0
  17. package/dist/es/es2018/types/src/generated/types/EtsConfigRepresentation.d.ts +34 -0
  18. package/dist/es/es2018/types/src/generated/types/SalesEinsteinCoachConfigurationOutputRepresentation.d.ts +36 -0
  19. package/dist/es/es2018/types/src/generated/types/SalesEinsteinCoachFeedbackInputRepresentation.d.ts +38 -0
  20. package/dist/es/es2018/types/src/generated/types/SalesEinsteinCoachFeedbackOutputRepresentation.d.ts +41 -0
  21. package/dist/es/es2018/types/src/generated/types/SalesEinsteinCoachRolePlayInputRepresentation.d.ts +37 -0
  22. package/dist/es/es2018/types/src/generated/types/SalesEinsteinCoachRolePlayOutputRepresentation.d.ts +47 -0
  23. package/dist/es/es2018/types/src/generated/types/SalesEinsteinCoachRolePlaySessionInputRepresentation.d.ts +31 -0
  24. package/dist/es/es2018/types/src/generated/types/SalesEinsteinCoachRolePlaySessionOutputRepresentation.d.ts +38 -0
  25. package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
  26. package/package.json +67 -0
  27. package/sfdc/index.d.ts +1 -0
  28. package/sfdc/index.js +1104 -0
  29. package/src/raml/api.raml +247 -0
  30. package/src/raml/luvio.raml +50 -0
@@ -0,0 +1,1051 @@
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, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, typeCheckConfig as typeCheckConfig$5, StoreKeyMap, createResourceParams as createResourceParams$5 } from '@luvio/engine';
8
+
9
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
+ const { keys: ObjectKeys, create: ObjectCreate } = 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(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
+ function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
52
+ return {
53
+ name,
54
+ required,
55
+ resourceType,
56
+ typeCheckShape,
57
+ isArrayShape,
58
+ coerceFn,
59
+ };
60
+ }
61
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
62
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
63
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
64
+ return {
65
+ displayName,
66
+ parameters: {
67
+ required,
68
+ optional,
69
+ }
70
+ };
71
+ }
72
+ const keyPrefix = 'SalesEinsteinCoach';
73
+
74
+ const { isArray: ArrayIsArray } = Array;
75
+ function createLink(ref) {
76
+ return {
77
+ __ref: serializeStructuredKey(ref),
78
+ };
79
+ }
80
+
81
+ const VERSION$4 = "6b3d91e8c7c2898e39cf0de7f0ee715c";
82
+ function validate$4(obj, path = 'EtsConfigRepresentation') {
83
+ const v_error = (() => {
84
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
85
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
86
+ }
87
+ const obj_appContext = obj.appContext;
88
+ const path_appContext = path + '.appContext';
89
+ if (typeof obj_appContext !== 'string') {
90
+ return new TypeError('Expected "string" but received "' + typeof obj_appContext + '" (at "' + path_appContext + '")');
91
+ }
92
+ const obj_tenantId = obj.tenantId;
93
+ const path_tenantId = path + '.tenantId';
94
+ if (typeof obj_tenantId !== 'string') {
95
+ return new TypeError('Expected "string" but received "' + typeof obj_tenantId + '" (at "' + path_tenantId + '")');
96
+ }
97
+ const obj_uri = obj.uri;
98
+ const path_uri = path + '.uri';
99
+ if (typeof obj_uri !== 'string') {
100
+ return new TypeError('Expected "string" but received "' + typeof obj_uri + '" (at "' + path_uri + '")');
101
+ }
102
+ })();
103
+ return v_error === undefined ? null : v_error;
104
+ }
105
+ const select$8 = function EtsConfigRepresentationSelect() {
106
+ return {
107
+ kind: 'Fragment',
108
+ version: VERSION$4,
109
+ private: [],
110
+ selections: [
111
+ {
112
+ name: 'appContext',
113
+ kind: 'Scalar'
114
+ },
115
+ {
116
+ name: 'tenantId',
117
+ kind: 'Scalar'
118
+ },
119
+ {
120
+ name: 'uri',
121
+ kind: 'Scalar'
122
+ }
123
+ ]
124
+ };
125
+ };
126
+ function equals$4(existing, incoming) {
127
+ const existing_appContext = existing.appContext;
128
+ const incoming_appContext = incoming.appContext;
129
+ if (!(existing_appContext === incoming_appContext)) {
130
+ return false;
131
+ }
132
+ const existing_tenantId = existing.tenantId;
133
+ const incoming_tenantId = incoming.tenantId;
134
+ if (!(existing_tenantId === incoming_tenantId)) {
135
+ return false;
136
+ }
137
+ const existing_uri = existing.uri;
138
+ const incoming_uri = incoming.uri;
139
+ if (!(existing_uri === incoming_uri)) {
140
+ return false;
141
+ }
142
+ return true;
143
+ }
144
+
145
+ const TTL$3 = 600000;
146
+ const VERSION$3 = "99f102a01a7842f72a2286283a158187";
147
+ function validate$3(obj, path = 'SalesEinsteinCoachConfigurationOutputRepresentation') {
148
+ const v_error = (() => {
149
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
150
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
151
+ }
152
+ const obj_coachingMomentType = obj.coachingMomentType;
153
+ const path_coachingMomentType = path + '.coachingMomentType';
154
+ if (typeof obj_coachingMomentType !== 'string') {
155
+ return new TypeError('Expected "string" but received "' + typeof obj_coachingMomentType + '" (at "' + path_coachingMomentType + '")');
156
+ }
157
+ const obj_etsConfig = obj.etsConfig;
158
+ const path_etsConfig = path + '.etsConfig';
159
+ const referencepath_etsConfigValidationError = validate$4(obj_etsConfig, path_etsConfig);
160
+ if (referencepath_etsConfigValidationError !== null) {
161
+ let message = 'Object doesn\'t match EtsConfigRepresentation (at "' + path_etsConfig + '")\n';
162
+ message += referencepath_etsConfigValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
163
+ return new TypeError(message);
164
+ }
165
+ const obj_instructions = obj.instructions;
166
+ const path_instructions = path + '.instructions';
167
+ if (typeof obj_instructions !== 'string') {
168
+ return new TypeError('Expected "string" but received "' + typeof obj_instructions + '" (at "' + path_instructions + '")');
169
+ }
170
+ })();
171
+ return v_error === undefined ? null : v_error;
172
+ }
173
+ const RepresentationType$3 = 'SalesEinsteinCoachConfigurationOutputRepresentation';
174
+ function normalize$3(input, existing, path, luvio, store, timestamp) {
175
+ return input;
176
+ }
177
+ const select$7 = function SalesEinsteinCoachConfigurationOutputRepresentationSelect() {
178
+ const { selections: EtsConfigRepresentation__selections, opaque: EtsConfigRepresentation__opaque, } = select$8();
179
+ return {
180
+ kind: 'Fragment',
181
+ version: VERSION$3,
182
+ private: [],
183
+ selections: [
184
+ {
185
+ name: 'coachingMomentType',
186
+ kind: 'Scalar'
187
+ },
188
+ {
189
+ name: 'etsConfig',
190
+ kind: 'Object',
191
+ selections: EtsConfigRepresentation__selections
192
+ },
193
+ {
194
+ name: 'instructions',
195
+ kind: 'Scalar'
196
+ }
197
+ ]
198
+ };
199
+ };
200
+ function equals$3(existing, incoming) {
201
+ const existing_coachingMomentType = existing.coachingMomentType;
202
+ const incoming_coachingMomentType = incoming.coachingMomentType;
203
+ if (!(existing_coachingMomentType === incoming_coachingMomentType)) {
204
+ return false;
205
+ }
206
+ const existing_instructions = existing.instructions;
207
+ const incoming_instructions = incoming.instructions;
208
+ if (!(existing_instructions === incoming_instructions)) {
209
+ return false;
210
+ }
211
+ const existing_etsConfig = existing.etsConfig;
212
+ const incoming_etsConfig = incoming.etsConfig;
213
+ if (!(equals$4(existing_etsConfig, incoming_etsConfig))) {
214
+ return false;
215
+ }
216
+ return true;
217
+ }
218
+ const ingest$3 = function SalesEinsteinCoachConfigurationOutputRepresentationIngest(input, path, luvio, store, timestamp) {
219
+ if (process.env.NODE_ENV !== 'production') {
220
+ const validateError = validate$3(input);
221
+ if (validateError !== null) {
222
+ throw validateError;
223
+ }
224
+ }
225
+ const key = path.fullPath;
226
+ const ttlToUse = TTL$3;
227
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "SalesEinsteinCoach", VERSION$3, RepresentationType$3, equals$3);
228
+ return createLink(key);
229
+ };
230
+ function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
231
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
232
+ const rootKey = fullPathFactory();
233
+ rootKeySet.set(rootKey, {
234
+ namespace: keyPrefix,
235
+ representationName: RepresentationType$3,
236
+ mergeable: false
237
+ });
238
+ }
239
+
240
+ function select$6(luvio, params) {
241
+ return select$7();
242
+ }
243
+ function keyBuilder$5(luvio, params) {
244
+ return keyPrefix + '::SalesEinsteinCoachConfigurationOutputRepresentation:(' + 'scenario:' + params.queryParams.scenario + ')';
245
+ }
246
+ function getResponseCacheKeys$4(storeKeyMap, luvio, resourceParams, response) {
247
+ getTypeCacheKeys$3(storeKeyMap, luvio, response, () => keyBuilder$5(luvio, resourceParams));
248
+ }
249
+ function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
250
+ const { body } = response;
251
+ const key = keyBuilder$5(luvio, resourceParams);
252
+ luvio.storeIngest(key, ingest$3, body);
253
+ const snapshot = luvio.storeLookup({
254
+ recordId: key,
255
+ node: select$6(),
256
+ variables: {},
257
+ }, snapshotRefresh);
258
+ if (process.env.NODE_ENV !== 'production') {
259
+ if (snapshot.state !== 'Fulfilled') {
260
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
261
+ }
262
+ }
263
+ deepFreeze(snapshot.data);
264
+ return snapshot;
265
+ }
266
+ function ingestError(luvio, params, error, snapshotRefresh) {
267
+ const key = keyBuilder$5(luvio, params);
268
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
269
+ const storeMetadataParams = {
270
+ ttl: TTL$3,
271
+ namespace: keyPrefix,
272
+ version: VERSION$3,
273
+ representationName: RepresentationType$3
274
+ };
275
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
276
+ return errorSnapshot;
277
+ }
278
+ function createResourceRequest$4(config) {
279
+ const headers = {};
280
+ return {
281
+ baseUri: '/services/data/v66.0',
282
+ basePath: '/sales-einstein-coach/practice/configuration',
283
+ method: 'get',
284
+ body: null,
285
+ urlParams: {},
286
+ queryParams: config.queryParams,
287
+ headers,
288
+ priority: 'normal',
289
+ };
290
+ }
291
+
292
+ const adapterName$4 = 'getSalesEinsteinCoachConfiguration';
293
+ const getSalesEinsteinCoachConfiguration_ConfigPropertyMetadata = [
294
+ generateParamConfigMetadata('scenario', true, 1 /* QueryParameter */, 0 /* String */),
295
+ ];
296
+ const getSalesEinsteinCoachConfiguration_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$4, getSalesEinsteinCoachConfiguration_ConfigPropertyMetadata);
297
+ const createResourceParams$4 = /*#__PURE__*/ createResourceParams$5(getSalesEinsteinCoachConfiguration_ConfigPropertyMetadata);
298
+ function keyBuilder$4(luvio, config) {
299
+ const resourceParams = createResourceParams$4(config);
300
+ return keyBuilder$5(luvio, resourceParams);
301
+ }
302
+ function typeCheckConfig$4(untrustedConfig) {
303
+ const config = {};
304
+ typeCheckConfig$5(untrustedConfig, config, getSalesEinsteinCoachConfiguration_ConfigPropertyMetadata);
305
+ return config;
306
+ }
307
+ function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
308
+ if (!untrustedIsObject(untrustedConfig)) {
309
+ return null;
310
+ }
311
+ if (process.env.NODE_ENV !== 'production') {
312
+ validateConfig(untrustedConfig, configPropertyNames);
313
+ }
314
+ const config = typeCheckConfig$4(untrustedConfig);
315
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
316
+ return null;
317
+ }
318
+ return config;
319
+ }
320
+ function adapterFragment(luvio, config) {
321
+ createResourceParams$4(config);
322
+ return select$6();
323
+ }
324
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
325
+ const snapshot = ingestSuccess$3(luvio, resourceParams, response, {
326
+ config,
327
+ resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
328
+ });
329
+ return luvio.storeBroadcast().then(() => snapshot);
330
+ }
331
+ function onFetchResponseError(luvio, config, resourceParams, response) {
332
+ const snapshot = ingestError(luvio, resourceParams, response, {
333
+ config,
334
+ resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
335
+ });
336
+ return luvio.storeBroadcast().then(() => snapshot);
337
+ }
338
+ function buildNetworkSnapshot$4(luvio, config, options) {
339
+ const resourceParams = createResourceParams$4(config);
340
+ const request = createResourceRequest$4(resourceParams);
341
+ return luvio.dispatchResourceRequest(request, options)
342
+ .then((response) => {
343
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
344
+ const cache = new StoreKeyMap();
345
+ getResponseCacheKeys$4(cache, luvio, resourceParams, response.body);
346
+ return cache;
347
+ });
348
+ }, (response) => {
349
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
350
+ });
351
+ }
352
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
353
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot$4, undefined, false);
354
+ }
355
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
356
+ const { luvio, config } = context;
357
+ const selector = {
358
+ recordId: keyBuilder$4(luvio, config),
359
+ node: adapterFragment(luvio, config),
360
+ variables: {},
361
+ };
362
+ const cacheSnapshot = storeLookup(selector, {
363
+ config,
364
+ resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
365
+ });
366
+ return cacheSnapshot;
367
+ }
368
+ const getSalesEinsteinCoachConfigurationAdapterFactory = (luvio) => function SalesEinsteinCoach__getSalesEinsteinCoachConfiguration(untrustedConfig, requestContext) {
369
+ const config = validateAdapterConfig$4(untrustedConfig, getSalesEinsteinCoachConfiguration_ConfigPropertyNames);
370
+ // Invalid or incomplete config
371
+ if (config === null) {
372
+ return null;
373
+ }
374
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
375
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
376
+ };
377
+
378
+ const TTL$2 = 15000;
379
+ const VERSION$2 = "eb29c35ef1ae7eaadb3e5cda5c1f5eef";
380
+ function validate$2(obj, path = 'SalesEinsteinCoachFeedbackOutputRepresentation') {
381
+ const v_error = (() => {
382
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
383
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
384
+ }
385
+ const obj_feedback = obj.feedback;
386
+ const path_feedback = path + '.feedback';
387
+ if (typeof obj_feedback !== 'string') {
388
+ return new TypeError('Expected "string" but received "' + typeof obj_feedback + '" (at "' + path_feedback + '")');
389
+ }
390
+ const obj_generationId = obj.generationId;
391
+ const path_generationId = path + '.generationId';
392
+ if (typeof obj_generationId !== 'string') {
393
+ return new TypeError('Expected "string" but received "' + typeof obj_generationId + '" (at "' + path_generationId + '")');
394
+ }
395
+ })();
396
+ return v_error === undefined ? null : v_error;
397
+ }
398
+ const RepresentationType$2 = 'SalesEinsteinCoachFeedbackOutputRepresentation';
399
+ function keyBuilder$3(luvio, config) {
400
+ return keyPrefix + '::' + RepresentationType$2 + ':' + config.generation_id;
401
+ }
402
+ function keyBuilderFromType$2(luvio, object) {
403
+ const keyParams = {
404
+ generation_id: object.generationId
405
+ };
406
+ return keyBuilder$3(luvio, keyParams);
407
+ }
408
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
409
+ return input;
410
+ }
411
+ const select$5 = function SalesEinsteinCoachFeedbackOutputRepresentationSelect() {
412
+ return {
413
+ kind: 'Fragment',
414
+ version: VERSION$2,
415
+ private: [],
416
+ selections: [
417
+ {
418
+ name: 'feedback',
419
+ kind: 'Scalar'
420
+ },
421
+ {
422
+ name: 'generationId',
423
+ kind: 'Scalar'
424
+ }
425
+ ]
426
+ };
427
+ };
428
+ function equals$2(existing, incoming) {
429
+ const existing_feedback = existing.feedback;
430
+ const incoming_feedback = incoming.feedback;
431
+ if (!(existing_feedback === incoming_feedback)) {
432
+ return false;
433
+ }
434
+ const existing_generationId = existing.generationId;
435
+ const incoming_generationId = incoming.generationId;
436
+ if (!(existing_generationId === incoming_generationId)) {
437
+ return false;
438
+ }
439
+ return true;
440
+ }
441
+ const ingest$2 = function SalesEinsteinCoachFeedbackOutputRepresentationIngest(input, path, luvio, store, timestamp) {
442
+ if (process.env.NODE_ENV !== 'production') {
443
+ const validateError = validate$2(input);
444
+ if (validateError !== null) {
445
+ throw validateError;
446
+ }
447
+ }
448
+ const key = keyBuilderFromType$2(luvio, input);
449
+ const ttlToUse = TTL$2;
450
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "SalesEinsteinCoach", VERSION$2, RepresentationType$2, equals$2);
451
+ return createLink(key);
452
+ };
453
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
454
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
455
+ const rootKey = keyBuilderFromType$2(luvio, input);
456
+ rootKeySet.set(rootKey, {
457
+ namespace: keyPrefix,
458
+ representationName: RepresentationType$2,
459
+ mergeable: false
460
+ });
461
+ }
462
+
463
+ function select$4(luvio, params) {
464
+ return select$5();
465
+ }
466
+ function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
467
+ getTypeCacheKeys$2(storeKeyMap, luvio, response);
468
+ }
469
+ function ingestSuccess$2(luvio, resourceParams, response) {
470
+ const { body } = response;
471
+ const key = keyBuilderFromType$2(luvio, body);
472
+ luvio.storeIngest(key, ingest$2, body);
473
+ const snapshot = luvio.storeLookup({
474
+ recordId: key,
475
+ node: select$4(),
476
+ variables: {},
477
+ });
478
+ if (process.env.NODE_ENV !== 'production') {
479
+ if (snapshot.state !== 'Fulfilled') {
480
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
481
+ }
482
+ }
483
+ deepFreeze(snapshot.data);
484
+ return snapshot;
485
+ }
486
+ function createResourceRequest$3(config) {
487
+ const headers = {};
488
+ return {
489
+ baseUri: '/services/data/v66.0',
490
+ basePath: '/sales-einstein-coach/practice/feedback',
491
+ method: 'post',
492
+ body: config.body,
493
+ urlParams: {},
494
+ queryParams: {},
495
+ headers,
496
+ priority: 'normal',
497
+ };
498
+ }
499
+
500
+ const adapterName$3 = 'submitForFeedback';
501
+ const submitForFeedback_ConfigPropertyMetadata = [
502
+ generateParamConfigMetadata('recordId', true, 2 /* Body */, 0 /* String */),
503
+ generateParamConfigMetadata('scenario', true, 2 /* Body */, 0 /* String */),
504
+ generateParamConfigMetadata('transcript', true, 2 /* Body */, 4 /* Unsupported */, true),
505
+ ];
506
+ const submitForFeedback_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, submitForFeedback_ConfigPropertyMetadata);
507
+ const createResourceParams$3 = /*#__PURE__*/ createResourceParams$5(submitForFeedback_ConfigPropertyMetadata);
508
+ function typeCheckConfig$3(untrustedConfig) {
509
+ const config = {};
510
+ typeCheckConfig$5(untrustedConfig, config, submitForFeedback_ConfigPropertyMetadata);
511
+ const untrustedConfig_transcript = untrustedConfig.transcript;
512
+ if (ArrayIsArray$1(untrustedConfig_transcript)) {
513
+ const untrustedConfig_transcript_array = [];
514
+ for (let i = 0, arrayLength = untrustedConfig_transcript.length; i < arrayLength; i++) {
515
+ const untrustedConfig_transcript_item = untrustedConfig_transcript[i];
516
+ if (untrustedIsObject(untrustedConfig_transcript_item)) {
517
+ const untrustedConfig_transcript_item_object = {};
518
+ const untrustedConfig_transcript_item_keys = Object.keys(untrustedConfig_transcript_item);
519
+ for (let i = 0, arrayLength = untrustedConfig_transcript_item_keys.length; i < arrayLength; i++) {
520
+ const key = untrustedConfig_transcript_item_keys[i];
521
+ const untrustedConfig_transcript_item_prop = untrustedConfig_transcript_item[key];
522
+ if (untrustedConfig_transcript_item_object !== undefined) {
523
+ untrustedConfig_transcript_item_object[key] = untrustedConfig_transcript_item_prop;
524
+ }
525
+ }
526
+ if (untrustedConfig_transcript_item_object !== undefined && Object.keys(untrustedConfig_transcript_item_object).length >= 0) {
527
+ untrustedConfig_transcript_array.push(untrustedConfig_transcript_item_object);
528
+ }
529
+ }
530
+ }
531
+ config.transcript = untrustedConfig_transcript_array;
532
+ }
533
+ return config;
534
+ }
535
+ function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
536
+ if (!untrustedIsObject(untrustedConfig)) {
537
+ return null;
538
+ }
539
+ if (process.env.NODE_ENV !== 'production') {
540
+ validateConfig(untrustedConfig, configPropertyNames);
541
+ }
542
+ const config = typeCheckConfig$3(untrustedConfig);
543
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
544
+ return null;
545
+ }
546
+ return config;
547
+ }
548
+ function buildNetworkSnapshot$3(luvio, config, options) {
549
+ const resourceParams = createResourceParams$3(config);
550
+ const request = createResourceRequest$3(resourceParams);
551
+ return luvio.dispatchResourceRequest(request, options)
552
+ .then((response) => {
553
+ return luvio.handleSuccessResponse(() => {
554
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response);
555
+ return luvio.storeBroadcast().then(() => snapshot);
556
+ }, () => {
557
+ const cache = new StoreKeyMap();
558
+ getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
559
+ return cache;
560
+ });
561
+ }, (response) => {
562
+ deepFreeze(response);
563
+ throw response;
564
+ });
565
+ }
566
+ const submitForFeedbackAdapterFactory = (luvio) => {
567
+ return function submitForFeedback(untrustedConfig) {
568
+ const config = validateAdapterConfig$3(untrustedConfig, submitForFeedback_ConfigPropertyNames);
569
+ // Invalid or incomplete config
570
+ if (config === null) {
571
+ throw new Error('Invalid config for "submitForFeedback"');
572
+ }
573
+ return buildNetworkSnapshot$3(luvio, config);
574
+ };
575
+ };
576
+
577
+ const TTL$1 = 15000;
578
+ const VERSION$1 = "e25cd2e13eba0c39def1e1bd6777ce4d";
579
+ function validate$1(obj, path = 'SalesEinsteinCoachRolePlaySessionOutputRepresentation') {
580
+ const v_error = (() => {
581
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
582
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
583
+ }
584
+ const obj_sessionId = obj.sessionId;
585
+ const path_sessionId = path + '.sessionId';
586
+ if (typeof obj_sessionId !== 'string') {
587
+ return new TypeError('Expected "string" but received "' + typeof obj_sessionId + '" (at "' + path_sessionId + '")');
588
+ }
589
+ })();
590
+ return v_error === undefined ? null : v_error;
591
+ }
592
+ const RepresentationType$1 = 'SalesEinsteinCoachRolePlaySessionOutputRepresentation';
593
+ function keyBuilder$2(luvio, config) {
594
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.session_id;
595
+ }
596
+ function keyBuilderFromType$1(luvio, object) {
597
+ const keyParams = {
598
+ session_id: object.sessionId
599
+ };
600
+ return keyBuilder$2(luvio, keyParams);
601
+ }
602
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
603
+ return input;
604
+ }
605
+ const select$3 = function SalesEinsteinCoachRolePlaySessionOutputRepresentationSelect() {
606
+ return {
607
+ kind: 'Fragment',
608
+ version: VERSION$1,
609
+ private: [],
610
+ selections: [
611
+ {
612
+ name: 'sessionId',
613
+ kind: 'Scalar'
614
+ }
615
+ ]
616
+ };
617
+ };
618
+ function equals$1(existing, incoming) {
619
+ const existing_sessionId = existing.sessionId;
620
+ const incoming_sessionId = incoming.sessionId;
621
+ if (!(existing_sessionId === incoming_sessionId)) {
622
+ return false;
623
+ }
624
+ return true;
625
+ }
626
+ const ingest$1 = function SalesEinsteinCoachRolePlaySessionOutputRepresentationIngest(input, path, luvio, store, timestamp) {
627
+ if (process.env.NODE_ENV !== 'production') {
628
+ const validateError = validate$1(input);
629
+ if (validateError !== null) {
630
+ throw validateError;
631
+ }
632
+ }
633
+ const key = keyBuilderFromType$1(luvio, input);
634
+ const ttlToUse = TTL$1;
635
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "SalesEinsteinCoach", VERSION$1, RepresentationType$1, equals$1);
636
+ return createLink(key);
637
+ };
638
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
639
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
640
+ const rootKey = keyBuilderFromType$1(luvio, input);
641
+ rootKeySet.set(rootKey, {
642
+ namespace: keyPrefix,
643
+ representationName: RepresentationType$1,
644
+ mergeable: false
645
+ });
646
+ }
647
+
648
+ function keyBuilder$1(luvio, params) {
649
+ return keyBuilder$2(luvio, {
650
+ session_id: params.queryParams.sessionId || ''
651
+ });
652
+ }
653
+ function getResponseCacheKeys$2(cacheKeyMap, luvio, resourceParams) {
654
+ const key = keyBuilder$1(luvio, resourceParams);
655
+ cacheKeyMap.set(key, {
656
+ namespace: keyPrefix,
657
+ representationName: RepresentationType$1,
658
+ mergeable: false
659
+ });
660
+ }
661
+ function evictSuccess(luvio, resourceParams) {
662
+ const key = keyBuilder$1(luvio, resourceParams);
663
+ luvio.storeEvict(key);
664
+ }
665
+ function createResourceRequest$2(config) {
666
+ const headers = {};
667
+ return {
668
+ baseUri: '/services/data/v66.0',
669
+ basePath: '/sales-einstein-coach/practice/roleplay',
670
+ method: 'delete',
671
+ body: null,
672
+ urlParams: {},
673
+ queryParams: config.queryParams,
674
+ headers,
675
+ priority: 'normal',
676
+ };
677
+ }
678
+
679
+ const adapterName$2 = 'deleteRolePlaySession';
680
+ const deleteRolePlaySession_ConfigPropertyMetadata = [
681
+ generateParamConfigMetadata('sessionId', false, 1 /* QueryParameter */, 0 /* String */),
682
+ ];
683
+ const deleteRolePlaySession_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, deleteRolePlaySession_ConfigPropertyMetadata);
684
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$5(deleteRolePlaySession_ConfigPropertyMetadata);
685
+ function typeCheckConfig$2(untrustedConfig) {
686
+ const config = {};
687
+ typeCheckConfig$5(untrustedConfig, config, deleteRolePlaySession_ConfigPropertyMetadata);
688
+ return config;
689
+ }
690
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
691
+ if (!untrustedIsObject(untrustedConfig)) {
692
+ return null;
693
+ }
694
+ if (process.env.NODE_ENV !== 'production') {
695
+ validateConfig(untrustedConfig, configPropertyNames);
696
+ }
697
+ const config = typeCheckConfig$2(untrustedConfig);
698
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
699
+ return null;
700
+ }
701
+ return config;
702
+ }
703
+ function buildNetworkSnapshot$2(luvio, config, options) {
704
+ const resourceParams = createResourceParams$2(config);
705
+ const request = createResourceRequest$2(resourceParams);
706
+ return luvio.dispatchResourceRequest(request, options)
707
+ .then(() => {
708
+ return luvio.handleSuccessResponse(() => {
709
+ evictSuccess(luvio, resourceParams);
710
+ return luvio.storeBroadcast();
711
+ }, () => {
712
+ const cache = new StoreKeyMap();
713
+ getResponseCacheKeys$2(cache, luvio, resourceParams);
714
+ return cache;
715
+ });
716
+ }, (response) => {
717
+ deepFreeze(response);
718
+ throw response;
719
+ });
720
+ }
721
+ const deleteRolePlaySessionAdapterFactory = (luvio) => {
722
+ return function SalesEinsteinCoachdeleteRolePlaySession(untrustedConfig) {
723
+ const config = validateAdapterConfig$2(untrustedConfig, deleteRolePlaySession_ConfigPropertyNames);
724
+ // Invalid or incomplete config
725
+ if (config === null) {
726
+ throw new Error(`Invalid config for "${adapterName$2}"`);
727
+ }
728
+ return buildNetworkSnapshot$2(luvio, config);
729
+ };
730
+ };
731
+
732
+ const TTL = 15000;
733
+ const VERSION = "052724fcba3dafd4732c1917be55d517";
734
+ function validate(obj, path = 'SalesEinsteinCoachRolePlayOutputRepresentation') {
735
+ const v_error = (() => {
736
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
737
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
738
+ }
739
+ const obj_reply = obj.reply;
740
+ const path_reply = path + '.reply';
741
+ if (typeof obj_reply !== 'string') {
742
+ return new TypeError('Expected "string" but received "' + typeof obj_reply + '" (at "' + path_reply + '")');
743
+ }
744
+ const obj_replyAudio = obj.replyAudio;
745
+ const path_replyAudio = path + '.replyAudio';
746
+ let obj_replyAudio_union0 = null;
747
+ const obj_replyAudio_union0_error = (() => {
748
+ if (typeof obj_replyAudio !== 'string') {
749
+ return new TypeError('Expected "string" but received "' + typeof obj_replyAudio + '" (at "' + path_replyAudio + '")');
750
+ }
751
+ })();
752
+ if (obj_replyAudio_union0_error != null) {
753
+ obj_replyAudio_union0 = obj_replyAudio_union0_error.message;
754
+ }
755
+ let obj_replyAudio_union1 = null;
756
+ const obj_replyAudio_union1_error = (() => {
757
+ if (obj_replyAudio !== null) {
758
+ return new TypeError('Expected "null" but received "' + typeof obj_replyAudio + '" (at "' + path_replyAudio + '")');
759
+ }
760
+ })();
761
+ if (obj_replyAudio_union1_error != null) {
762
+ obj_replyAudio_union1 = obj_replyAudio_union1_error.message;
763
+ }
764
+ if (obj_replyAudio_union0 && obj_replyAudio_union1) {
765
+ let message = 'Object doesn\'t match union (at "' + path_replyAudio + '")';
766
+ message += '\n' + obj_replyAudio_union0.split('\n').map((line) => '\t' + line).join('\n');
767
+ message += '\n' + obj_replyAudio_union1.split('\n').map((line) => '\t' + line).join('\n');
768
+ return new TypeError(message);
769
+ }
770
+ const obj_replyId = obj.replyId;
771
+ const path_replyId = path + '.replyId';
772
+ if (typeof obj_replyId !== 'string') {
773
+ return new TypeError('Expected "string" but received "' + typeof obj_replyId + '" (at "' + path_replyId + '")');
774
+ }
775
+ const obj_sequenceId = obj.sequenceId;
776
+ const path_sequenceId = path + '.sequenceId';
777
+ if (typeof obj_sequenceId !== 'string') {
778
+ return new TypeError('Expected "string" but received "' + typeof obj_sequenceId + '" (at "' + path_sequenceId + '")');
779
+ }
780
+ })();
781
+ return v_error === undefined ? null : v_error;
782
+ }
783
+ const RepresentationType = 'SalesEinsteinCoachRolePlayOutputRepresentation';
784
+ function keyBuilder(luvio, config) {
785
+ return keyPrefix + '::' + RepresentationType + ':' + config.reply_id;
786
+ }
787
+ function keyBuilderFromType(luvio, object) {
788
+ const keyParams = {
789
+ reply_id: object.replyId
790
+ };
791
+ return keyBuilder(luvio, keyParams);
792
+ }
793
+ function normalize(input, existing, path, luvio, store, timestamp) {
794
+ return input;
795
+ }
796
+ const select$2 = function SalesEinsteinCoachRolePlayOutputRepresentationSelect() {
797
+ return {
798
+ kind: 'Fragment',
799
+ version: VERSION,
800
+ private: [],
801
+ selections: [
802
+ {
803
+ name: 'reply',
804
+ kind: 'Scalar'
805
+ },
806
+ {
807
+ name: 'replyAudio',
808
+ kind: 'Scalar'
809
+ },
810
+ {
811
+ name: 'replyId',
812
+ kind: 'Scalar'
813
+ },
814
+ {
815
+ name: 'sequenceId',
816
+ kind: 'Scalar'
817
+ }
818
+ ]
819
+ };
820
+ };
821
+ function equals(existing, incoming) {
822
+ const existing_reply = existing.reply;
823
+ const incoming_reply = incoming.reply;
824
+ if (!(existing_reply === incoming_reply)) {
825
+ return false;
826
+ }
827
+ const existing_replyId = existing.replyId;
828
+ const incoming_replyId = incoming.replyId;
829
+ if (!(existing_replyId === incoming_replyId)) {
830
+ return false;
831
+ }
832
+ const existing_sequenceId = existing.sequenceId;
833
+ const incoming_sequenceId = incoming.sequenceId;
834
+ if (!(existing_sequenceId === incoming_sequenceId)) {
835
+ return false;
836
+ }
837
+ const existing_replyAudio = existing.replyAudio;
838
+ const incoming_replyAudio = incoming.replyAudio;
839
+ if (!(existing_replyAudio === incoming_replyAudio)) {
840
+ return false;
841
+ }
842
+ return true;
843
+ }
844
+ const ingest = function SalesEinsteinCoachRolePlayOutputRepresentationIngest(input, path, luvio, store, timestamp) {
845
+ if (process.env.NODE_ENV !== 'production') {
846
+ const validateError = validate(input);
847
+ if (validateError !== null) {
848
+ throw validateError;
849
+ }
850
+ }
851
+ const key = keyBuilderFromType(luvio, input);
852
+ const ttlToUse = TTL;
853
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "SalesEinsteinCoach", VERSION, RepresentationType, equals);
854
+ return createLink(key);
855
+ };
856
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
857
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
858
+ const rootKey = keyBuilderFromType(luvio, input);
859
+ rootKeySet.set(rootKey, {
860
+ namespace: keyPrefix,
861
+ representationName: RepresentationType,
862
+ mergeable: false
863
+ });
864
+ }
865
+
866
+ function select$1(luvio, params) {
867
+ return select$2();
868
+ }
869
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
870
+ getTypeCacheKeys(storeKeyMap, luvio, response);
871
+ }
872
+ function ingestSuccess$1(luvio, resourceParams, response) {
873
+ const { body } = response;
874
+ const key = keyBuilderFromType(luvio, body);
875
+ luvio.storeIngest(key, ingest, body);
876
+ const snapshot = luvio.storeLookup({
877
+ recordId: key,
878
+ node: select$1(),
879
+ variables: {},
880
+ });
881
+ if (process.env.NODE_ENV !== 'production') {
882
+ if (snapshot.state !== 'Fulfilled') {
883
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
884
+ }
885
+ }
886
+ deepFreeze(snapshot.data);
887
+ return snapshot;
888
+ }
889
+ function createResourceRequest$1(config) {
890
+ const headers = {};
891
+ return {
892
+ baseUri: '/services/data/v66.0',
893
+ basePath: '/sales-einstein-coach/practice/roleplay',
894
+ method: 'post',
895
+ body: config.body,
896
+ urlParams: {},
897
+ queryParams: config.queryParams,
898
+ headers,
899
+ priority: 'normal',
900
+ };
901
+ }
902
+
903
+ const adapterName$1 = 'submitForRolePlay';
904
+ const submitForRolePlay_ConfigPropertyMetadata = [
905
+ generateParamConfigMetadata('sessionId', false, 1 /* QueryParameter */, 0 /* String */),
906
+ generateParamConfigMetadata('replyId', true, 2 /* Body */, 0 /* String */),
907
+ generateParamConfigMetadata('sequenceId', true, 2 /* Body */, 0 /* String */),
908
+ generateParamConfigMetadata('transcript', true, 2 /* Body */, 0 /* String */),
909
+ generateParamConfigMetadata('scenario', true, 2 /* Body */, 0 /* String */),
910
+ ];
911
+ const submitForRolePlay_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, submitForRolePlay_ConfigPropertyMetadata);
912
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$5(submitForRolePlay_ConfigPropertyMetadata);
913
+ function typeCheckConfig$1(untrustedConfig) {
914
+ const config = {};
915
+ typeCheckConfig$5(untrustedConfig, config, submitForRolePlay_ConfigPropertyMetadata);
916
+ return config;
917
+ }
918
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
919
+ if (!untrustedIsObject(untrustedConfig)) {
920
+ return null;
921
+ }
922
+ if (process.env.NODE_ENV !== 'production') {
923
+ validateConfig(untrustedConfig, configPropertyNames);
924
+ }
925
+ const config = typeCheckConfig$1(untrustedConfig);
926
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
927
+ return null;
928
+ }
929
+ return config;
930
+ }
931
+ function buildNetworkSnapshot$1(luvio, config, options) {
932
+ const resourceParams = createResourceParams$1(config);
933
+ const request = createResourceRequest$1(resourceParams);
934
+ return luvio.dispatchResourceRequest(request, options)
935
+ .then((response) => {
936
+ return luvio.handleSuccessResponse(() => {
937
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response);
938
+ return luvio.storeBroadcast().then(() => snapshot);
939
+ }, () => {
940
+ const cache = new StoreKeyMap();
941
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
942
+ return cache;
943
+ });
944
+ }, (response) => {
945
+ deepFreeze(response);
946
+ throw response;
947
+ });
948
+ }
949
+ const submitForRolePlayAdapterFactory = (luvio) => {
950
+ return function submitForRolePlay(untrustedConfig) {
951
+ const config = validateAdapterConfig$1(untrustedConfig, submitForRolePlay_ConfigPropertyNames);
952
+ // Invalid or incomplete config
953
+ if (config === null) {
954
+ throw new Error('Invalid config for "submitForRolePlay"');
955
+ }
956
+ return buildNetworkSnapshot$1(luvio, config);
957
+ };
958
+ };
959
+
960
+ function select(luvio, params) {
961
+ return select$3();
962
+ }
963
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
964
+ getTypeCacheKeys$1(storeKeyMap, luvio, response);
965
+ }
966
+ function ingestSuccess(luvio, resourceParams, response) {
967
+ const { body } = response;
968
+ const key = keyBuilderFromType$1(luvio, body);
969
+ luvio.storeIngest(key, ingest$1, body);
970
+ const snapshot = luvio.storeLookup({
971
+ recordId: key,
972
+ node: select(),
973
+ variables: {},
974
+ });
975
+ if (process.env.NODE_ENV !== 'production') {
976
+ if (snapshot.state !== 'Fulfilled') {
977
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
978
+ }
979
+ }
980
+ deepFreeze(snapshot.data);
981
+ return snapshot;
982
+ }
983
+ function createResourceRequest(config) {
984
+ const headers = {};
985
+ return {
986
+ baseUri: '/services/data/v66.0',
987
+ basePath: '/sales-einstein-coach/practice/roleplay/start',
988
+ method: 'post',
989
+ body: config.body,
990
+ urlParams: {},
991
+ queryParams: {},
992
+ headers,
993
+ priority: 'normal',
994
+ };
995
+ }
996
+
997
+ const adapterName = 'startRolePlaySession';
998
+ const startRolePlaySession_ConfigPropertyMetadata = [
999
+ generateParamConfigMetadata('recordId', true, 2 /* Body */, 0 /* String */),
1000
+ generateParamConfigMetadata('scenario', true, 2 /* Body */, 0 /* String */),
1001
+ ];
1002
+ const startRolePlaySession_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, startRolePlaySession_ConfigPropertyMetadata);
1003
+ const createResourceParams = /*#__PURE__*/ createResourceParams$5(startRolePlaySession_ConfigPropertyMetadata);
1004
+ function typeCheckConfig(untrustedConfig) {
1005
+ const config = {};
1006
+ typeCheckConfig$5(untrustedConfig, config, startRolePlaySession_ConfigPropertyMetadata);
1007
+ return config;
1008
+ }
1009
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
1010
+ if (!untrustedIsObject(untrustedConfig)) {
1011
+ return null;
1012
+ }
1013
+ if (process.env.NODE_ENV !== 'production') {
1014
+ validateConfig(untrustedConfig, configPropertyNames);
1015
+ }
1016
+ const config = typeCheckConfig(untrustedConfig);
1017
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1018
+ return null;
1019
+ }
1020
+ return config;
1021
+ }
1022
+ function buildNetworkSnapshot(luvio, config, options) {
1023
+ const resourceParams = createResourceParams(config);
1024
+ const request = createResourceRequest(resourceParams);
1025
+ return luvio.dispatchResourceRequest(request, options)
1026
+ .then((response) => {
1027
+ return luvio.handleSuccessResponse(() => {
1028
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
1029
+ return luvio.storeBroadcast().then(() => snapshot);
1030
+ }, () => {
1031
+ const cache = new StoreKeyMap();
1032
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
1033
+ return cache;
1034
+ });
1035
+ }, (response) => {
1036
+ deepFreeze(response);
1037
+ throw response;
1038
+ });
1039
+ }
1040
+ const startRolePlaySessionAdapterFactory = (luvio) => {
1041
+ return function startRolePlaySession(untrustedConfig) {
1042
+ const config = validateAdapterConfig(untrustedConfig, startRolePlaySession_ConfigPropertyNames);
1043
+ // Invalid or incomplete config
1044
+ if (config === null) {
1045
+ throw new Error('Invalid config for "startRolePlaySession"');
1046
+ }
1047
+ return buildNetworkSnapshot(luvio, config);
1048
+ };
1049
+ };
1050
+
1051
+ export { deleteRolePlaySessionAdapterFactory, getSalesEinsteinCoachConfigurationAdapterFactory, startRolePlaySessionAdapterFactory, submitForFeedbackAdapterFactory, submitForRolePlayAdapterFactory };