@salesforce/lds-adapters-industries-gdf-dch 1.295.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (21) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/industries-gdf-dch.js +640 -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/saveAssessmentResponses.d.ts +17 -0
  5. package/dist/es/es2018/types/src/generated/adapters/updateAssessmentResponses.d.ts +18 -0
  6. package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +2 -0
  7. package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +3 -0
  8. package/dist/es/es2018/types/src/generated/resources/patchConnectDiscoveryFrameworkAssessmentQuestionResponse.d.ts +17 -0
  9. package/dist/es/es2018/types/src/generated/resources/postConnectDiscoveryFrameworkAssessmentQuestionResponse.d.ts +16 -0
  10. package/dist/es/es2018/types/src/generated/types/AssessmentQuestionResponseInputRepresentation.d.ts +31 -0
  11. package/dist/es/es2018/types/src/generated/types/AssessmentQuestionResponseOutputRepresentation.d.ts +37 -0
  12. package/dist/es/es2018/types/src/generated/types/AssessmentQuestionResponseSaveErrorRepresentation.d.ts +31 -0
  13. package/dist/es/es2018/types/src/generated/types/AssessmentQuestionResponseSaveSuccessRepresentation.d.ts +28 -0
  14. package/dist/es/es2018/types/src/generated/types/SaveAssessmentResponsesInputRepresentation.d.ts +29 -0
  15. package/dist/es/es2018/types/src/generated/types/SaveAssessmentResponsesOutputRepresentation.d.ts +48 -0
  16. package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
  17. package/package.json +66 -0
  18. package/sfdc/index.d.ts +1 -0
  19. package/sfdc/index.js +670 -0
  20. package/src/raml/api.raml +138 -0
  21. package/src/raml/luvio.raml +22 -0
package/sfdc/index.js ADDED
@@ -0,0 +1,670 @@
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 { withDefaultLuvio } from 'force/ldsEngine';
16
+ import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$2, typeCheckConfig as typeCheckConfig$2 } from 'force/luvioEngine';
17
+
18
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
19
+ const { keys: ObjectKeys, create: ObjectCreate } = Object;
20
+ const { isArray: ArrayIsArray$1 } = Array;
21
+ /**
22
+ * Validates an adapter config is well-formed.
23
+ * @param config The config to validate.
24
+ * @param adapter The adapter validation configuration.
25
+ * @param oneOf The keys the config must contain at least one of.
26
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
27
+ */
28
+ function validateConfig(config, adapter, oneOf) {
29
+ const { displayName } = adapter;
30
+ const { required, optional, unsupported } = adapter.parameters;
31
+ if (config === undefined ||
32
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
33
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
34
+ }
35
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
36
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
37
+ }
38
+ if (unsupported !== undefined &&
39
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
40
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
41
+ }
42
+ const supported = required.concat(optional);
43
+ if (ObjectKeys(config).some(key => !supported.includes(key))) {
44
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
45
+ }
46
+ }
47
+ function untrustedIsObject(untrusted) {
48
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
49
+ }
50
+ function areRequiredParametersPresent(config, configPropertyNames) {
51
+ return configPropertyNames.parameters.required.every(req => req in config);
52
+ }
53
+ function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
54
+ return {
55
+ name,
56
+ required,
57
+ resourceType,
58
+ typeCheckShape,
59
+ isArrayShape,
60
+ coerceFn,
61
+ };
62
+ }
63
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
64
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
65
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
66
+ return {
67
+ displayName,
68
+ parameters: {
69
+ required,
70
+ optional,
71
+ }
72
+ };
73
+ }
74
+ const keyPrefix = 'gdf-dch';
75
+
76
+ const { isArray: ArrayIsArray } = Array;
77
+ function equalsArray(a, b, equalsItem) {
78
+ const aLength = a.length;
79
+ const bLength = b.length;
80
+ if (aLength !== bLength) {
81
+ return false;
82
+ }
83
+ for (let i = 0; i < aLength; i++) {
84
+ if (equalsItem(a[i], b[i]) === false) {
85
+ return false;
86
+ }
87
+ }
88
+ return true;
89
+ }
90
+ function createLink(ref) {
91
+ return {
92
+ __ref: serializeStructuredKey(ref),
93
+ };
94
+ }
95
+
96
+ function validate$4(obj, path = 'AssessmentQuestionResponseInputRepresentation') {
97
+ const v_error = (() => {
98
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
99
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
100
+ }
101
+ const obj_assessmentQuestionUniqueIndex = obj.assessmentQuestionUniqueIndex;
102
+ const path_assessmentQuestionUniqueIndex = path + '.assessmentQuestionUniqueIndex';
103
+ if (typeof obj_assessmentQuestionUniqueIndex !== 'string') {
104
+ return new TypeError('Expected "string" but received "' + typeof obj_assessmentQuestionUniqueIndex + '" (at "' + path_assessmentQuestionUniqueIndex + '")');
105
+ }
106
+ const obj_responseValue = obj.responseValue;
107
+ const path_responseValue = path + '.responseValue';
108
+ if (typeof obj_responseValue !== 'string') {
109
+ return new TypeError('Expected "string" but received "' + typeof obj_responseValue + '" (at "' + path_responseValue + '")');
110
+ }
111
+ })();
112
+ return v_error === undefined ? null : v_error;
113
+ }
114
+
115
+ const VERSION$3 = "545ad42a61d2ac8da773cb40104715c2";
116
+ function validate$3(obj, path = 'AssessmentQuestionResponseSaveErrorRepresentation') {
117
+ const v_error = (() => {
118
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
119
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
120
+ }
121
+ const obj_code = obj.code;
122
+ const path_code = path + '.code';
123
+ if (typeof obj_code !== 'number' || (typeof obj_code === 'number' && Math.floor(obj_code) !== obj_code)) {
124
+ return new TypeError('Expected "integer" but received "' + typeof obj_code + '" (at "' + path_code + '")');
125
+ }
126
+ const obj_message = obj.message;
127
+ const path_message = path + '.message';
128
+ if (typeof obj_message !== 'string') {
129
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
130
+ }
131
+ })();
132
+ return v_error === undefined ? null : v_error;
133
+ }
134
+ const select$5 = function AssessmentQuestionResponseSaveErrorRepresentationSelect() {
135
+ return {
136
+ kind: 'Fragment',
137
+ version: VERSION$3,
138
+ private: [],
139
+ selections: [
140
+ {
141
+ name: 'code',
142
+ kind: 'Scalar'
143
+ },
144
+ {
145
+ name: 'message',
146
+ kind: 'Scalar'
147
+ }
148
+ ]
149
+ };
150
+ };
151
+ function equals$3(existing, incoming) {
152
+ const existing_code = existing.code;
153
+ const incoming_code = incoming.code;
154
+ if (!(existing_code === incoming_code)) {
155
+ return false;
156
+ }
157
+ const existing_message = existing.message;
158
+ const incoming_message = incoming.message;
159
+ if (!(existing_message === incoming_message)) {
160
+ return false;
161
+ }
162
+ return true;
163
+ }
164
+
165
+ const VERSION$2 = "d79661fe6f97abbfe22946001c7b0ee0";
166
+ function validate$2(obj, path = 'AssessmentQuestionResponseSaveSuccessRepresentation') {
167
+ const v_error = (() => {
168
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
169
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
170
+ }
171
+ const obj_assessmentQuestionResponseId = obj.assessmentQuestionResponseId;
172
+ const path_assessmentQuestionResponseId = path + '.assessmentQuestionResponseId';
173
+ if (typeof obj_assessmentQuestionResponseId !== 'string') {
174
+ return new TypeError('Expected "string" but received "' + typeof obj_assessmentQuestionResponseId + '" (at "' + path_assessmentQuestionResponseId + '")');
175
+ }
176
+ })();
177
+ return v_error === undefined ? null : v_error;
178
+ }
179
+ const select$4 = function AssessmentQuestionResponseSaveSuccessRepresentationSelect() {
180
+ return {
181
+ kind: 'Fragment',
182
+ version: VERSION$2,
183
+ private: [],
184
+ selections: [
185
+ {
186
+ name: 'assessmentQuestionResponseId',
187
+ kind: 'Scalar'
188
+ }
189
+ ]
190
+ };
191
+ };
192
+ function equals$2(existing, incoming) {
193
+ const existing_assessmentQuestionResponseId = existing.assessmentQuestionResponseId;
194
+ const incoming_assessmentQuestionResponseId = incoming.assessmentQuestionResponseId;
195
+ if (!(existing_assessmentQuestionResponseId === incoming_assessmentQuestionResponseId)) {
196
+ return false;
197
+ }
198
+ return true;
199
+ }
200
+
201
+ const VERSION$1 = "1da9ac67418fd6eb60ec7c5ba5c4c00b";
202
+ function validate$1(obj, path = 'AssessmentQuestionResponseOutputRepresentation') {
203
+ const v_error = (() => {
204
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
205
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
206
+ }
207
+ const obj_assessmentQuestionUniqueIndex = obj.assessmentQuestionUniqueIndex;
208
+ const path_assessmentQuestionUniqueIndex = path + '.assessmentQuestionUniqueIndex';
209
+ if (typeof obj_assessmentQuestionUniqueIndex !== 'string') {
210
+ return new TypeError('Expected "string" but received "' + typeof obj_assessmentQuestionUniqueIndex + '" (at "' + path_assessmentQuestionUniqueIndex + '")');
211
+ }
212
+ if (obj.error !== undefined) {
213
+ const obj_error = obj.error;
214
+ const path_error = path + '.error';
215
+ const referencepath_errorValidationError = validate$3(obj_error, path_error);
216
+ if (referencepath_errorValidationError !== null) {
217
+ let message = 'Object doesn\'t match AssessmentQuestionResponseSaveErrorRepresentation (at "' + path_error + '")\n';
218
+ message += referencepath_errorValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
219
+ return new TypeError(message);
220
+ }
221
+ }
222
+ if (obj.result !== undefined) {
223
+ const obj_result = obj.result;
224
+ const path_result = path + '.result';
225
+ const referencepath_resultValidationError = validate$2(obj_result, path_result);
226
+ if (referencepath_resultValidationError !== null) {
227
+ let message = 'Object doesn\'t match AssessmentQuestionResponseSaveSuccessRepresentation (at "' + path_result + '")\n';
228
+ message += referencepath_resultValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
229
+ return new TypeError(message);
230
+ }
231
+ }
232
+ const obj_status = obj.status;
233
+ const path_status = path + '.status';
234
+ if (typeof obj_status !== 'number' || (typeof obj_status === 'number' && Math.floor(obj_status) !== obj_status)) {
235
+ return new TypeError('Expected "integer" but received "' + typeof obj_status + '" (at "' + path_status + '")');
236
+ }
237
+ })();
238
+ return v_error === undefined ? null : v_error;
239
+ }
240
+ const select$3 = function AssessmentQuestionResponseOutputRepresentationSelect() {
241
+ const { selections: AssessmentQuestionResponseSaveErrorRepresentation__selections, opaque: AssessmentQuestionResponseSaveErrorRepresentation__opaque, } = select$5();
242
+ const { selections: AssessmentQuestionResponseSaveSuccessRepresentation__selections, opaque: AssessmentQuestionResponseSaveSuccessRepresentation__opaque, } = select$4();
243
+ return {
244
+ kind: 'Fragment',
245
+ version: VERSION$1,
246
+ private: [],
247
+ selections: [
248
+ {
249
+ name: 'assessmentQuestionUniqueIndex',
250
+ kind: 'Scalar'
251
+ },
252
+ {
253
+ name: 'error',
254
+ kind: 'Object',
255
+ selections: AssessmentQuestionResponseSaveErrorRepresentation__selections,
256
+ required: false
257
+ },
258
+ {
259
+ name: 'result',
260
+ kind: 'Object',
261
+ selections: AssessmentQuestionResponseSaveSuccessRepresentation__selections,
262
+ required: false
263
+ },
264
+ {
265
+ name: 'status',
266
+ kind: 'Scalar'
267
+ }
268
+ ]
269
+ };
270
+ };
271
+ function equals$1(existing, incoming) {
272
+ const existing_status = existing.status;
273
+ const incoming_status = incoming.status;
274
+ if (!(existing_status === incoming_status)) {
275
+ return false;
276
+ }
277
+ const existing_assessmentQuestionUniqueIndex = existing.assessmentQuestionUniqueIndex;
278
+ const incoming_assessmentQuestionUniqueIndex = incoming.assessmentQuestionUniqueIndex;
279
+ if (!(existing_assessmentQuestionUniqueIndex === incoming_assessmentQuestionUniqueIndex)) {
280
+ return false;
281
+ }
282
+ const existing_error = existing.error;
283
+ const incoming_error = incoming.error;
284
+ // if at least one of these optionals is defined
285
+ if (existing_error !== undefined || incoming_error !== undefined) {
286
+ // if one of these is not defined we know the other is defined and therefore
287
+ // not equal
288
+ if (existing_error === undefined || incoming_error === undefined) {
289
+ return false;
290
+ }
291
+ if (!(equals$3(existing_error, incoming_error))) {
292
+ return false;
293
+ }
294
+ }
295
+ const existing_result = existing.result;
296
+ const incoming_result = incoming.result;
297
+ // if at least one of these optionals is defined
298
+ if (existing_result !== undefined || incoming_result !== undefined) {
299
+ // if one of these is not defined we know the other is defined and therefore
300
+ // not equal
301
+ if (existing_result === undefined || incoming_result === undefined) {
302
+ return false;
303
+ }
304
+ if (!(equals$2(existing_result, incoming_result))) {
305
+ return false;
306
+ }
307
+ }
308
+ return true;
309
+ }
310
+
311
+ const TTL = 1000;
312
+ const VERSION = "97c2c11e91dcbac09f2cb39bba5a494d";
313
+ function validate(obj, path = 'SaveAssessmentResponsesOutputRepresentation') {
314
+ const v_error = (() => {
315
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
316
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
317
+ }
318
+ const obj_assessmentId = obj.assessmentId;
319
+ const path_assessmentId = path + '.assessmentId';
320
+ if (typeof obj_assessmentId !== 'string') {
321
+ return new TypeError('Expected "string" but received "' + typeof obj_assessmentId + '" (at "' + path_assessmentId + '")');
322
+ }
323
+ const obj_message = obj.message;
324
+ const path_message = path + '.message';
325
+ if (typeof obj_message !== 'string') {
326
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
327
+ }
328
+ const obj_questionResponses = obj.questionResponses;
329
+ const path_questionResponses = path + '.questionResponses';
330
+ if (!ArrayIsArray(obj_questionResponses)) {
331
+ return new TypeError('Expected "array" but received "' + typeof obj_questionResponses + '" (at "' + path_questionResponses + '")');
332
+ }
333
+ for (let i = 0; i < obj_questionResponses.length; i++) {
334
+ const obj_questionResponses_item = obj_questionResponses[i];
335
+ const path_questionResponses_item = path_questionResponses + '[' + i + ']';
336
+ const referencepath_questionResponses_itemValidationError = validate$1(obj_questionResponses_item, path_questionResponses_item);
337
+ if (referencepath_questionResponses_itemValidationError !== null) {
338
+ let message = 'Object doesn\'t match AssessmentQuestionResponseOutputRepresentation (at "' + path_questionResponses_item + '")\n';
339
+ message += referencepath_questionResponses_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
340
+ return new TypeError(message);
341
+ }
342
+ }
343
+ const obj_statusCode = obj.statusCode;
344
+ const path_statusCode = path + '.statusCode';
345
+ if (typeof obj_statusCode !== 'number' || (typeof obj_statusCode === 'number' && Math.floor(obj_statusCode) !== obj_statusCode)) {
346
+ return new TypeError('Expected "integer" but received "' + typeof obj_statusCode + '" (at "' + path_statusCode + '")');
347
+ }
348
+ })();
349
+ return v_error === undefined ? null : v_error;
350
+ }
351
+ const RepresentationType = 'SaveAssessmentResponsesOutputRepresentation';
352
+ function keyBuilder(luvio, config) {
353
+ return keyPrefix + '::' + RepresentationType + ':' + config.assessmentId;
354
+ }
355
+ function keyBuilderFromType(luvio, object) {
356
+ const keyParams = {
357
+ assessmentId: object.assessmentId
358
+ };
359
+ return keyBuilder(luvio, keyParams);
360
+ }
361
+ function normalize(input, existing, path, luvio, store, timestamp) {
362
+ return input;
363
+ }
364
+ const select$2 = function SaveAssessmentResponsesOutputRepresentationSelect() {
365
+ const { selections: AssessmentQuestionResponseOutputRepresentation__selections, opaque: AssessmentQuestionResponseOutputRepresentation__opaque, } = select$3();
366
+ return {
367
+ kind: 'Fragment',
368
+ version: VERSION,
369
+ private: [],
370
+ selections: [
371
+ {
372
+ name: 'assessmentId',
373
+ kind: 'Scalar'
374
+ },
375
+ {
376
+ name: 'message',
377
+ kind: 'Scalar'
378
+ },
379
+ {
380
+ name: 'questionResponses',
381
+ kind: 'Object',
382
+ plural: true,
383
+ selections: AssessmentQuestionResponseOutputRepresentation__selections
384
+ },
385
+ {
386
+ name: 'statusCode',
387
+ kind: 'Scalar'
388
+ }
389
+ ]
390
+ };
391
+ };
392
+ function equals(existing, incoming) {
393
+ const existing_statusCode = existing.statusCode;
394
+ const incoming_statusCode = incoming.statusCode;
395
+ if (!(existing_statusCode === incoming_statusCode)) {
396
+ return false;
397
+ }
398
+ const existing_assessmentId = existing.assessmentId;
399
+ const incoming_assessmentId = incoming.assessmentId;
400
+ if (!(existing_assessmentId === incoming_assessmentId)) {
401
+ return false;
402
+ }
403
+ const existing_message = existing.message;
404
+ const incoming_message = incoming.message;
405
+ if (!(existing_message === incoming_message)) {
406
+ return false;
407
+ }
408
+ const existing_questionResponses = existing.questionResponses;
409
+ const incoming_questionResponses = incoming.questionResponses;
410
+ const equals_questionResponses_items = equalsArray(existing_questionResponses, incoming_questionResponses, (existing_questionResponses_item, incoming_questionResponses_item) => {
411
+ if (!(equals$1(existing_questionResponses_item, incoming_questionResponses_item))) {
412
+ return false;
413
+ }
414
+ });
415
+ if (equals_questionResponses_items === false) {
416
+ return false;
417
+ }
418
+ return true;
419
+ }
420
+ const ingest = function SaveAssessmentResponsesOutputRepresentationIngest(input, path, luvio, store, timestamp) {
421
+ if (process.env.NODE_ENV !== 'production') {
422
+ const validateError = validate(input);
423
+ if (validateError !== null) {
424
+ throw validateError;
425
+ }
426
+ }
427
+ const key = keyBuilderFromType(luvio, input);
428
+ const ttlToUse = TTL;
429
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "gdf-dch", VERSION, RepresentationType, equals);
430
+ return createLink(key);
431
+ };
432
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
433
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
434
+ const rootKey = keyBuilderFromType(luvio, input);
435
+ rootKeySet.set(rootKey, {
436
+ namespace: keyPrefix,
437
+ representationName: RepresentationType,
438
+ mergeable: false
439
+ });
440
+ }
441
+
442
+ function select$1(luvio, params) {
443
+ return select$2();
444
+ }
445
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
446
+ getTypeCacheKeys(storeKeyMap, luvio, response);
447
+ }
448
+ function ingestSuccess$1(luvio, resourceParams, response) {
449
+ const { body } = response;
450
+ const key = keyBuilderFromType(luvio, body);
451
+ luvio.storeIngest(key, ingest, body);
452
+ const snapshot = luvio.storeLookup({
453
+ recordId: key,
454
+ node: select$1(),
455
+ variables: {},
456
+ });
457
+ if (process.env.NODE_ENV !== 'production') {
458
+ if (snapshot.state !== 'Fulfilled') {
459
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
460
+ }
461
+ }
462
+ deepFreeze(snapshot.data);
463
+ return snapshot;
464
+ }
465
+ function createResourceRequest$1(config) {
466
+ const headers = {};
467
+ return {
468
+ baseUri: '/services/data/v62.0',
469
+ basePath: '/connect/discovery-framework/assessment-question-response',
470
+ method: 'post',
471
+ body: config.body,
472
+ urlParams: {},
473
+ queryParams: config.queryParams,
474
+ headers,
475
+ priority: 'normal',
476
+ };
477
+ }
478
+
479
+ const adapterName$1 = 'saveAssessmentResponses';
480
+ const saveAssessmentResponses_ConfigPropertyMetadata = [
481
+ generateParamConfigMetadata('partialSave', false, 1 /* QueryParameter */, 1 /* Boolean */),
482
+ generateParamConfigMetadata('questionResponses', true, 2 /* Body */, 4 /* Unsupported */, true),
483
+ ];
484
+ const saveAssessmentResponses_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, saveAssessmentResponses_ConfigPropertyMetadata);
485
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$2(saveAssessmentResponses_ConfigPropertyMetadata);
486
+ function typeCheckConfig$1(untrustedConfig) {
487
+ const config = {};
488
+ typeCheckConfig$2(untrustedConfig, config, saveAssessmentResponses_ConfigPropertyMetadata);
489
+ const untrustedConfig_questionResponses = untrustedConfig.questionResponses;
490
+ if (ArrayIsArray$1(untrustedConfig_questionResponses)) {
491
+ const untrustedConfig_questionResponses_array = [];
492
+ for (let i = 0, arrayLength = untrustedConfig_questionResponses.length; i < arrayLength; i++) {
493
+ const untrustedConfig_questionResponses_item = untrustedConfig_questionResponses[i];
494
+ const referenceAssessmentQuestionResponseInputRepresentationValidationError = validate$4(untrustedConfig_questionResponses_item);
495
+ if (referenceAssessmentQuestionResponseInputRepresentationValidationError === null) {
496
+ untrustedConfig_questionResponses_array.push(untrustedConfig_questionResponses_item);
497
+ }
498
+ }
499
+ config.questionResponses = untrustedConfig_questionResponses_array;
500
+ }
501
+ return config;
502
+ }
503
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
504
+ if (!untrustedIsObject(untrustedConfig)) {
505
+ return null;
506
+ }
507
+ if (process.env.NODE_ENV !== 'production') {
508
+ validateConfig(untrustedConfig, configPropertyNames);
509
+ }
510
+ const config = typeCheckConfig$1(untrustedConfig);
511
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
512
+ return null;
513
+ }
514
+ return config;
515
+ }
516
+ function buildNetworkSnapshot$1(luvio, config, options) {
517
+ const resourceParams = createResourceParams$1(config);
518
+ const request = createResourceRequest$1(resourceParams);
519
+ return luvio.dispatchResourceRequest(request, options)
520
+ .then((response) => {
521
+ return luvio.handleSuccessResponse(() => {
522
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response);
523
+ return luvio.storeBroadcast().then(() => snapshot);
524
+ }, () => {
525
+ const cache = new StoreKeyMap();
526
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
527
+ return cache;
528
+ });
529
+ }, (response) => {
530
+ deepFreeze(response);
531
+ throw response;
532
+ });
533
+ }
534
+ const saveAssessmentResponsesAdapterFactory = (luvio) => {
535
+ return function saveAssessmentResponses(untrustedConfig) {
536
+ const config = validateAdapterConfig$1(untrustedConfig, saveAssessmentResponses_ConfigPropertyNames);
537
+ // Invalid or incomplete config
538
+ if (config === null) {
539
+ throw new Error('Invalid config for "saveAssessmentResponses"');
540
+ }
541
+ return buildNetworkSnapshot$1(luvio, config);
542
+ };
543
+ };
544
+
545
+ function select(luvio, params) {
546
+ return select$2();
547
+ }
548
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
549
+ getTypeCacheKeys(storeKeyMap, luvio, response);
550
+ }
551
+ function ingestSuccess(luvio, resourceParams, response) {
552
+ const { body } = response;
553
+ const key = keyBuilderFromType(luvio, body);
554
+ luvio.storeIngest(key, ingest, body);
555
+ const snapshot = luvio.storeLookup({
556
+ recordId: key,
557
+ node: select(),
558
+ variables: {},
559
+ });
560
+ if (process.env.NODE_ENV !== 'production') {
561
+ if (snapshot.state !== 'Fulfilled') {
562
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
563
+ }
564
+ }
565
+ deepFreeze(snapshot.data);
566
+ return snapshot;
567
+ }
568
+ function createResourceRequest(config) {
569
+ const headers = {};
570
+ return {
571
+ baseUri: '/services/data/v62.0',
572
+ basePath: '/connect/discovery-framework/assessment-question-response',
573
+ method: 'patch',
574
+ body: config.body,
575
+ urlParams: {},
576
+ queryParams: config.queryParams,
577
+ headers,
578
+ priority: 'normal',
579
+ };
580
+ }
581
+
582
+ const adapterName = 'updateAssessmentResponses';
583
+ const updateAssessmentResponses_ConfigPropertyMetadata = [
584
+ generateParamConfigMetadata('assessmentId', false, 1 /* QueryParameter */, 0 /* String */),
585
+ generateParamConfigMetadata('partialSave', false, 1 /* QueryParameter */, 1 /* Boolean */),
586
+ generateParamConfigMetadata('questionResponses', true, 2 /* Body */, 4 /* Unsupported */, true),
587
+ ];
588
+ const updateAssessmentResponses_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, updateAssessmentResponses_ConfigPropertyMetadata);
589
+ const createResourceParams = /*#__PURE__*/ createResourceParams$2(updateAssessmentResponses_ConfigPropertyMetadata);
590
+ function typeCheckConfig(untrustedConfig) {
591
+ const config = {};
592
+ typeCheckConfig$2(untrustedConfig, config, updateAssessmentResponses_ConfigPropertyMetadata);
593
+ const untrustedConfig_questionResponses = untrustedConfig.questionResponses;
594
+ if (ArrayIsArray$1(untrustedConfig_questionResponses)) {
595
+ const untrustedConfig_questionResponses_array = [];
596
+ for (let i = 0, arrayLength = untrustedConfig_questionResponses.length; i < arrayLength; i++) {
597
+ const untrustedConfig_questionResponses_item = untrustedConfig_questionResponses[i];
598
+ const referenceAssessmentQuestionResponseInputRepresentationValidationError = validate$4(untrustedConfig_questionResponses_item);
599
+ if (referenceAssessmentQuestionResponseInputRepresentationValidationError === null) {
600
+ untrustedConfig_questionResponses_array.push(untrustedConfig_questionResponses_item);
601
+ }
602
+ }
603
+ config.questionResponses = untrustedConfig_questionResponses_array;
604
+ }
605
+ return config;
606
+ }
607
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
608
+ if (!untrustedIsObject(untrustedConfig)) {
609
+ return null;
610
+ }
611
+ if (process.env.NODE_ENV !== 'production') {
612
+ validateConfig(untrustedConfig, configPropertyNames);
613
+ }
614
+ const config = typeCheckConfig(untrustedConfig);
615
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
616
+ return null;
617
+ }
618
+ return config;
619
+ }
620
+ function buildNetworkSnapshot(luvio, config, options) {
621
+ const resourceParams = createResourceParams(config);
622
+ const request = createResourceRequest(resourceParams);
623
+ return luvio.dispatchResourceRequest(request, options)
624
+ .then((response) => {
625
+ return luvio.handleSuccessResponse(() => {
626
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
627
+ return luvio.storeBroadcast().then(() => snapshot);
628
+ }, () => {
629
+ const cache = new StoreKeyMap();
630
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
631
+ return cache;
632
+ });
633
+ }, (response) => {
634
+ deepFreeze(response);
635
+ throw response;
636
+ });
637
+ }
638
+ const updateAssessmentResponsesAdapterFactory = (luvio) => {
639
+ return function updateAssessmentResponses(untrustedConfig) {
640
+ const config = validateAdapterConfig(untrustedConfig, updateAssessmentResponses_ConfigPropertyNames);
641
+ // Invalid or incomplete config
642
+ if (config === null) {
643
+ throw new Error('Invalid config for "updateAssessmentResponses"');
644
+ }
645
+ return buildNetworkSnapshot(luvio, config);
646
+ };
647
+ };
648
+
649
+ let saveAssessmentResponses;
650
+ let updateAssessmentResponses;
651
+ // Notify Update Available
652
+ function bindExportsTo(luvio) {
653
+ // LDS Adapters
654
+ function unwrapSnapshotData(factory) {
655
+ const adapter = factory(luvio);
656
+ return (config) => adapter(config).then((snapshot) => snapshot.data);
657
+ }
658
+ return {
659
+ saveAssessmentResponses: unwrapSnapshotData(saveAssessmentResponsesAdapterFactory),
660
+ updateAssessmentResponses: unwrapSnapshotData(updateAssessmentResponsesAdapterFactory),
661
+ // Imperative GET Adapters
662
+ // Notify Update Availables
663
+ };
664
+ }
665
+ withDefaultLuvio((luvio) => {
666
+ ({ saveAssessmentResponses, updateAssessmentResponses } = bindExportsTo(luvio));
667
+ });
668
+
669
+ export { saveAssessmentResponses, updateAssessmentResponses };
670
+ // version: 1.295.0-e85f207c7