@salesforce/lds-adapters-service-knowledge-questions 1.366.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.
- package/LICENSE.txt +82 -0
- package/dist/es/es2018/service-knowledge-questions.js +1034 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/getKnowledgeAnswer.d.ts +21 -0
- package/dist/es/es2018/types/src/generated/adapters/getKnowledgeQuestionsGen.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/adapters/postKnowledgeUpdateQuestion.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +3 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +5 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectSelfServiceKnowledgeGetQuestionsByRecordId.d.ts +18 -0
- package/dist/es/es2018/types/src/generated/resources/postConnectSelfServiceKnowledgeAnswer.d.ts +18 -0
- package/dist/es/es2018/types/src/generated/resources/postConnectSelfServiceKnowledgeUpdateQuestionByQuestionId.d.ts +12 -0
- package/dist/es/es2018/types/src/generated/types/KnowledgeAnswerInputRepresentation.d.ts +42 -0
- package/dist/es/es2018/types/src/generated/types/KnowledgeAnswerRepresentation.d.ts +45 -0
- package/dist/es/es2018/types/src/generated/types/KnowledgeQuestionCollectionRepresentation.d.ts +37 -0
- package/dist/es/es2018/types/src/generated/types/KnowledgeQuestionRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/KnowledgeUpdateQuestionRepresentation.d.ts +42 -0
- package/dist/es/es2018/types/src/generated/types/SSKnowledgeErrorDetailsOutputRepresentation.d.ts +32 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
- package/package.json +66 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +1081 -0
- package/src/raml/api.raml +162 -0
- package/src/raml/luvio.raml +37 -0
package/sfdc/index.js
ADDED
|
@@ -0,0 +1,1081 @@
|
|
|
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$3, typeCheckConfig as typeCheckConfig$3, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1 } from 'force/luvioEngine';
|
|
18
|
+
|
|
19
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
20
|
+
const { keys: ObjectKeys, create: ObjectCreate } = 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(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 = 'knowledge-questions';
|
|
83
|
+
|
|
84
|
+
const { isArray: ArrayIsArray } = Array;
|
|
85
|
+
function equalsArray(a, b, equalsItem) {
|
|
86
|
+
const aLength = a.length;
|
|
87
|
+
const bLength = b.length;
|
|
88
|
+
if (aLength !== bLength) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
for (let i = 0; i < aLength; i++) {
|
|
92
|
+
if (equalsItem(a[i], b[i]) === false) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
function createLink(ref) {
|
|
99
|
+
return {
|
|
100
|
+
__ref: serializeStructuredKey(ref),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const VERSION$4 = "d28d9f1d9c88cda2437b9983c72a36e1";
|
|
105
|
+
function validate$4(obj, path = 'SSKnowledgeErrorDetailsOutputRepresentation') {
|
|
106
|
+
const v_error = (() => {
|
|
107
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
108
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
109
|
+
}
|
|
110
|
+
if (obj.code !== undefined) {
|
|
111
|
+
const obj_code = obj.code;
|
|
112
|
+
const path_code = path + '.code';
|
|
113
|
+
if (typeof obj_code !== 'number' || (typeof obj_code === 'number' && Math.floor(obj_code) !== obj_code)) {
|
|
114
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_code + '" (at "' + path_code + '")');
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (obj.message !== undefined) {
|
|
118
|
+
const obj_message = obj.message;
|
|
119
|
+
const path_message = path + '.message';
|
|
120
|
+
if (typeof obj_message !== 'string') {
|
|
121
|
+
return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
})();
|
|
125
|
+
return v_error === undefined ? null : v_error;
|
|
126
|
+
}
|
|
127
|
+
const select$7 = function SSKnowledgeErrorDetailsOutputRepresentationSelect() {
|
|
128
|
+
return {
|
|
129
|
+
kind: 'Fragment',
|
|
130
|
+
version: VERSION$4,
|
|
131
|
+
private: [],
|
|
132
|
+
selections: [
|
|
133
|
+
{
|
|
134
|
+
name: 'code',
|
|
135
|
+
kind: 'Scalar',
|
|
136
|
+
required: false
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: 'message',
|
|
140
|
+
kind: 'Scalar',
|
|
141
|
+
required: false
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
function equals$4(existing, incoming) {
|
|
147
|
+
const existing_code = existing.code;
|
|
148
|
+
const incoming_code = incoming.code;
|
|
149
|
+
// if at least one of these optionals is defined
|
|
150
|
+
if (existing_code !== undefined || incoming_code !== undefined) {
|
|
151
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
152
|
+
// not equal
|
|
153
|
+
if (existing_code === undefined || incoming_code === undefined) {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
if (!(existing_code === incoming_code)) {
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const existing_message = existing.message;
|
|
161
|
+
const incoming_message = incoming.message;
|
|
162
|
+
// if at least one of these optionals is defined
|
|
163
|
+
if (existing_message !== undefined || incoming_message !== undefined) {
|
|
164
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
165
|
+
// not equal
|
|
166
|
+
if (existing_message === undefined || incoming_message === undefined) {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
if (!(existing_message === incoming_message)) {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const TTL$2 = 300;
|
|
177
|
+
const VERSION$3 = "66164e67076ac635d0de8f197fb6913f";
|
|
178
|
+
function validate$3(obj, path = 'KnowledgeAnswerRepresentation') {
|
|
179
|
+
const v_error = (() => {
|
|
180
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
181
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
182
|
+
}
|
|
183
|
+
const obj_answer = obj.answer;
|
|
184
|
+
const path_answer = path + '.answer';
|
|
185
|
+
if (typeof obj_answer !== 'string') {
|
|
186
|
+
return new TypeError('Expected "string" but received "' + typeof obj_answer + '" (at "' + path_answer + '")');
|
|
187
|
+
}
|
|
188
|
+
const obj_error = obj.error;
|
|
189
|
+
const path_error = path + '.error';
|
|
190
|
+
let obj_error_union0 = null;
|
|
191
|
+
const obj_error_union0_error = (() => {
|
|
192
|
+
const referencepath_errorValidationError = validate$4(obj_error, path_error);
|
|
193
|
+
if (referencepath_errorValidationError !== null) {
|
|
194
|
+
let message = 'Object doesn\'t match SSKnowledgeErrorDetailsOutputRepresentation (at "' + path_error + '")\n';
|
|
195
|
+
message += referencepath_errorValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
196
|
+
return new TypeError(message);
|
|
197
|
+
}
|
|
198
|
+
})();
|
|
199
|
+
if (obj_error_union0_error != null) {
|
|
200
|
+
obj_error_union0 = obj_error_union0_error.message;
|
|
201
|
+
}
|
|
202
|
+
let obj_error_union1 = null;
|
|
203
|
+
const obj_error_union1_error = (() => {
|
|
204
|
+
if (obj_error !== null) {
|
|
205
|
+
return new TypeError('Expected "null" but received "' + typeof obj_error + '" (at "' + path_error + '")');
|
|
206
|
+
}
|
|
207
|
+
})();
|
|
208
|
+
if (obj_error_union1_error != null) {
|
|
209
|
+
obj_error_union1 = obj_error_union1_error.message;
|
|
210
|
+
}
|
|
211
|
+
if (obj_error_union0 && obj_error_union1) {
|
|
212
|
+
let message = 'Object doesn\'t match union (at "' + path_error + '")';
|
|
213
|
+
message += '\n' + obj_error_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
214
|
+
message += '\n' + obj_error_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
215
|
+
return new TypeError(message);
|
|
216
|
+
}
|
|
217
|
+
const obj_status = obj.status;
|
|
218
|
+
const path_status = path + '.status';
|
|
219
|
+
let obj_status_union0 = null;
|
|
220
|
+
const obj_status_union0_error = (() => {
|
|
221
|
+
if (typeof obj_status !== 'string') {
|
|
222
|
+
return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
|
|
223
|
+
}
|
|
224
|
+
})();
|
|
225
|
+
if (obj_status_union0_error != null) {
|
|
226
|
+
obj_status_union0 = obj_status_union0_error.message;
|
|
227
|
+
}
|
|
228
|
+
let obj_status_union1 = null;
|
|
229
|
+
const obj_status_union1_error = (() => {
|
|
230
|
+
if (obj_status !== null) {
|
|
231
|
+
return new TypeError('Expected "null" but received "' + typeof obj_status + '" (at "' + path_status + '")');
|
|
232
|
+
}
|
|
233
|
+
})();
|
|
234
|
+
if (obj_status_union1_error != null) {
|
|
235
|
+
obj_status_union1 = obj_status_union1_error.message;
|
|
236
|
+
}
|
|
237
|
+
if (obj_status_union0 && obj_status_union1) {
|
|
238
|
+
let message = 'Object doesn\'t match union (at "' + path_status + '")';
|
|
239
|
+
message += '\n' + obj_status_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
240
|
+
message += '\n' + obj_status_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
241
|
+
return new TypeError(message);
|
|
242
|
+
}
|
|
243
|
+
})();
|
|
244
|
+
return v_error === undefined ? null : v_error;
|
|
245
|
+
}
|
|
246
|
+
const RepresentationType$2 = 'KnowledgeAnswerRepresentation';
|
|
247
|
+
function keyBuilder$3(luvio, config) {
|
|
248
|
+
return keyPrefix + '::' + RepresentationType$2 + ':' + config.id;
|
|
249
|
+
}
|
|
250
|
+
function keyBuilderFromType$1(luvio, object) {
|
|
251
|
+
const keyParams = {
|
|
252
|
+
id: object.answer
|
|
253
|
+
};
|
|
254
|
+
return keyBuilder$3(luvio, keyParams);
|
|
255
|
+
}
|
|
256
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
257
|
+
return input;
|
|
258
|
+
}
|
|
259
|
+
const select$6 = function KnowledgeAnswerRepresentationSelect() {
|
|
260
|
+
const { selections: SSKnowledgeErrorDetailsOutputRepresentation__selections, opaque: SSKnowledgeErrorDetailsOutputRepresentation__opaque, } = select$7();
|
|
261
|
+
return {
|
|
262
|
+
kind: 'Fragment',
|
|
263
|
+
version: VERSION$3,
|
|
264
|
+
private: [],
|
|
265
|
+
selections: [
|
|
266
|
+
{
|
|
267
|
+
name: 'answer',
|
|
268
|
+
kind: 'Scalar'
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
name: 'error',
|
|
272
|
+
kind: 'Object',
|
|
273
|
+
nullable: true,
|
|
274
|
+
selections: SSKnowledgeErrorDetailsOutputRepresentation__selections
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
name: 'status',
|
|
278
|
+
kind: 'Scalar'
|
|
279
|
+
}
|
|
280
|
+
]
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
function equals$3(existing, incoming) {
|
|
284
|
+
const existing_answer = existing.answer;
|
|
285
|
+
const incoming_answer = incoming.answer;
|
|
286
|
+
if (!(existing_answer === incoming_answer)) {
|
|
287
|
+
return false;
|
|
288
|
+
}
|
|
289
|
+
const existing_error = existing.error;
|
|
290
|
+
const incoming_error = incoming.error;
|
|
291
|
+
if (!(existing_error === incoming_error
|
|
292
|
+
|| (existing_error != null &&
|
|
293
|
+
incoming_error != null &&
|
|
294
|
+
equals$4(existing_error, incoming_error)))) {
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
const existing_status = existing.status;
|
|
298
|
+
const incoming_status = incoming.status;
|
|
299
|
+
if (!(existing_status === incoming_status)) {
|
|
300
|
+
return false;
|
|
301
|
+
}
|
|
302
|
+
return true;
|
|
303
|
+
}
|
|
304
|
+
const ingest$2 = function KnowledgeAnswerRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
305
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
306
|
+
const validateError = validate$3(input);
|
|
307
|
+
if (validateError !== null) {
|
|
308
|
+
throw validateError;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
const key = keyBuilderFromType$1(luvio, input);
|
|
312
|
+
const ttlToUse = TTL$2;
|
|
313
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "knowledge-questions", VERSION$3, RepresentationType$2, equals$3);
|
|
314
|
+
return createLink(key);
|
|
315
|
+
};
|
|
316
|
+
function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
|
|
317
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
318
|
+
const rootKey = keyBuilderFromType$1(luvio, input);
|
|
319
|
+
rootKeySet.set(rootKey, {
|
|
320
|
+
namespace: keyPrefix,
|
|
321
|
+
representationName: RepresentationType$2,
|
|
322
|
+
mergeable: false
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function select$5(luvio, params) {
|
|
327
|
+
return select$6();
|
|
328
|
+
}
|
|
329
|
+
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
330
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response);
|
|
331
|
+
}
|
|
332
|
+
function ingestSuccess$2(luvio, resourceParams, response) {
|
|
333
|
+
const { body } = response;
|
|
334
|
+
const key = keyBuilderFromType$1(luvio, body);
|
|
335
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
336
|
+
const snapshot = luvio.storeLookup({
|
|
337
|
+
recordId: key,
|
|
338
|
+
node: select$5(),
|
|
339
|
+
variables: {},
|
|
340
|
+
});
|
|
341
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
342
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
343
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
deepFreeze(snapshot.data);
|
|
347
|
+
return snapshot;
|
|
348
|
+
}
|
|
349
|
+
function createResourceRequest$2(config) {
|
|
350
|
+
const headers = {};
|
|
351
|
+
return {
|
|
352
|
+
baseUri: '/services/data/v65.0',
|
|
353
|
+
basePath: '/connect/self-service/knowledge/answer',
|
|
354
|
+
method: 'post',
|
|
355
|
+
body: config.body,
|
|
356
|
+
urlParams: {},
|
|
357
|
+
queryParams: {},
|
|
358
|
+
headers,
|
|
359
|
+
priority: 'normal',
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
const adapterName$2 = 'getKnowledgeAnswer';
|
|
364
|
+
const getKnowledgeAnswer_ConfigPropertyMetadata = [
|
|
365
|
+
generateParamConfigMetadata('contextInfo', true, 2 /* Body */, 4 /* Unsupported */),
|
|
366
|
+
generateParamConfigMetadata('metadata', true, 2 /* Body */, 4 /* Unsupported */),
|
|
367
|
+
generateParamConfigMetadata('question', true, 2 /* Body */, 0 /* String */),
|
|
368
|
+
];
|
|
369
|
+
const getKnowledgeAnswer_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getKnowledgeAnswer_ConfigPropertyMetadata);
|
|
370
|
+
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(getKnowledgeAnswer_ConfigPropertyMetadata);
|
|
371
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
372
|
+
const config = {};
|
|
373
|
+
typeCheckConfig$3(untrustedConfig, config, getKnowledgeAnswer_ConfigPropertyMetadata);
|
|
374
|
+
const untrustedConfig_contextInfo = untrustedConfig.contextInfo;
|
|
375
|
+
if (untrustedIsObject(untrustedConfig_contextInfo)) {
|
|
376
|
+
const untrustedConfig_contextInfo_object = {};
|
|
377
|
+
const untrustedConfig_contextInfo_keys = Object.keys(untrustedConfig_contextInfo);
|
|
378
|
+
for (let i = 0, arrayLength = untrustedConfig_contextInfo_keys.length; i < arrayLength; i++) {
|
|
379
|
+
const key = untrustedConfig_contextInfo_keys[i];
|
|
380
|
+
const untrustedConfig_contextInfo_prop = untrustedConfig_contextInfo[key];
|
|
381
|
+
if (typeof untrustedConfig_contextInfo_prop === 'string') {
|
|
382
|
+
if (untrustedConfig_contextInfo_object !== undefined) {
|
|
383
|
+
untrustedConfig_contextInfo_object[key] = untrustedConfig_contextInfo_prop;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
if (untrustedConfig_contextInfo_object !== undefined && Object.keys(untrustedConfig_contextInfo_object).length >= 0) {
|
|
388
|
+
config.contextInfo = untrustedConfig_contextInfo_object;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
const untrustedConfig_metadata = untrustedConfig.metadata;
|
|
392
|
+
if (untrustedIsObject(untrustedConfig_metadata)) {
|
|
393
|
+
const untrustedConfig_metadata_object = {};
|
|
394
|
+
const untrustedConfig_metadata_keys = Object.keys(untrustedConfig_metadata);
|
|
395
|
+
for (let i = 0, arrayLength = untrustedConfig_metadata_keys.length; i < arrayLength; i++) {
|
|
396
|
+
const key = untrustedConfig_metadata_keys[i];
|
|
397
|
+
const untrustedConfig_metadata_prop = untrustedConfig_metadata[key];
|
|
398
|
+
if (typeof untrustedConfig_metadata_prop === 'string') {
|
|
399
|
+
if (untrustedConfig_metadata_object !== undefined) {
|
|
400
|
+
untrustedConfig_metadata_object[key] = untrustedConfig_metadata_prop;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
if (untrustedConfig_metadata_object !== undefined && Object.keys(untrustedConfig_metadata_object).length >= 0) {
|
|
405
|
+
config.metadata = untrustedConfig_metadata_object;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
return config;
|
|
409
|
+
}
|
|
410
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
411
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
412
|
+
return null;
|
|
413
|
+
}
|
|
414
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
415
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
416
|
+
}
|
|
417
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
418
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
419
|
+
return null;
|
|
420
|
+
}
|
|
421
|
+
return config;
|
|
422
|
+
}
|
|
423
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
424
|
+
const resourceParams = createResourceParams$2(config);
|
|
425
|
+
const request = createResourceRequest$2(resourceParams);
|
|
426
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
427
|
+
.then((response) => {
|
|
428
|
+
return luvio.handleSuccessResponse(() => {
|
|
429
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response);
|
|
430
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
431
|
+
}, () => {
|
|
432
|
+
const cache = new StoreKeyMap();
|
|
433
|
+
getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
|
|
434
|
+
return cache;
|
|
435
|
+
});
|
|
436
|
+
}, (response) => {
|
|
437
|
+
deepFreeze(response);
|
|
438
|
+
throw response;
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
const getKnowledgeAnswerAdapterFactory = (luvio) => {
|
|
442
|
+
return function getKnowledgeAnswer(untrustedConfig) {
|
|
443
|
+
const config = validateAdapterConfig$2(untrustedConfig, getKnowledgeAnswer_ConfigPropertyNames);
|
|
444
|
+
// Invalid or incomplete config
|
|
445
|
+
if (config === null) {
|
|
446
|
+
throw new Error('Invalid config for "getKnowledgeAnswer"');
|
|
447
|
+
}
|
|
448
|
+
return buildNetworkSnapshot$2(luvio, config);
|
|
449
|
+
};
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
const VERSION$2 = "0583cf81b5f0f4d839cf90aa7caddf0a";
|
|
453
|
+
function validate$2(obj, path = 'KnowledgeQuestionRepresentation') {
|
|
454
|
+
const v_error = (() => {
|
|
455
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
456
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
457
|
+
}
|
|
458
|
+
const obj_answer = obj.answer;
|
|
459
|
+
const path_answer = path + '.answer';
|
|
460
|
+
if (typeof obj_answer !== 'string') {
|
|
461
|
+
return new TypeError('Expected "string" but received "' + typeof obj_answer + '" (at "' + path_answer + '")');
|
|
462
|
+
}
|
|
463
|
+
const obj_question = obj.question;
|
|
464
|
+
const path_question = path + '.question';
|
|
465
|
+
if (typeof obj_question !== 'string') {
|
|
466
|
+
return new TypeError('Expected "string" but received "' + typeof obj_question + '" (at "' + path_question + '")');
|
|
467
|
+
}
|
|
468
|
+
const obj_questionId = obj.questionId;
|
|
469
|
+
const path_questionId = path + '.questionId';
|
|
470
|
+
if (typeof obj_questionId !== 'string') {
|
|
471
|
+
return new TypeError('Expected "string" but received "' + typeof obj_questionId + '" (at "' + path_questionId + '")');
|
|
472
|
+
}
|
|
473
|
+
const obj_selectionCount = obj.selectionCount;
|
|
474
|
+
const path_selectionCount = path + '.selectionCount';
|
|
475
|
+
if (typeof obj_selectionCount !== 'number' || (typeof obj_selectionCount === 'number' && Math.floor(obj_selectionCount) !== obj_selectionCount)) {
|
|
476
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_selectionCount + '" (at "' + path_selectionCount + '")');
|
|
477
|
+
}
|
|
478
|
+
})();
|
|
479
|
+
return v_error === undefined ? null : v_error;
|
|
480
|
+
}
|
|
481
|
+
const select$4 = function KnowledgeQuestionRepresentationSelect() {
|
|
482
|
+
return {
|
|
483
|
+
kind: 'Fragment',
|
|
484
|
+
version: VERSION$2,
|
|
485
|
+
private: [],
|
|
486
|
+
selections: [
|
|
487
|
+
{
|
|
488
|
+
name: 'answer',
|
|
489
|
+
kind: 'Scalar'
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
name: 'question',
|
|
493
|
+
kind: 'Scalar'
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
name: 'questionId',
|
|
497
|
+
kind: 'Scalar'
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
name: 'selectionCount',
|
|
501
|
+
kind: 'Scalar'
|
|
502
|
+
}
|
|
503
|
+
]
|
|
504
|
+
};
|
|
505
|
+
};
|
|
506
|
+
function equals$2(existing, incoming) {
|
|
507
|
+
const existing_selectionCount = existing.selectionCount;
|
|
508
|
+
const incoming_selectionCount = incoming.selectionCount;
|
|
509
|
+
if (!(existing_selectionCount === incoming_selectionCount)) {
|
|
510
|
+
return false;
|
|
511
|
+
}
|
|
512
|
+
const existing_answer = existing.answer;
|
|
513
|
+
const incoming_answer = incoming.answer;
|
|
514
|
+
if (!(existing_answer === incoming_answer)) {
|
|
515
|
+
return false;
|
|
516
|
+
}
|
|
517
|
+
const existing_question = existing.question;
|
|
518
|
+
const incoming_question = incoming.question;
|
|
519
|
+
if (!(existing_question === incoming_question)) {
|
|
520
|
+
return false;
|
|
521
|
+
}
|
|
522
|
+
const existing_questionId = existing.questionId;
|
|
523
|
+
const incoming_questionId = incoming.questionId;
|
|
524
|
+
if (!(existing_questionId === incoming_questionId)) {
|
|
525
|
+
return false;
|
|
526
|
+
}
|
|
527
|
+
return true;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
const TTL$1 = 300;
|
|
531
|
+
const VERSION$1 = "51b624dd6a5712d6763bed223c4ba2c7";
|
|
532
|
+
function validate$1(obj, path = 'KnowledgeQuestionCollectionRepresentation') {
|
|
533
|
+
const v_error = (() => {
|
|
534
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
535
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
536
|
+
}
|
|
537
|
+
const obj_error = obj.error;
|
|
538
|
+
const path_error = path + '.error';
|
|
539
|
+
let obj_error_union0 = null;
|
|
540
|
+
const obj_error_union0_error = (() => {
|
|
541
|
+
const referencepath_errorValidationError = validate$4(obj_error, path_error);
|
|
542
|
+
if (referencepath_errorValidationError !== null) {
|
|
543
|
+
let message = 'Object doesn\'t match SSKnowledgeErrorDetailsOutputRepresentation (at "' + path_error + '")\n';
|
|
544
|
+
message += referencepath_errorValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
545
|
+
return new TypeError(message);
|
|
546
|
+
}
|
|
547
|
+
})();
|
|
548
|
+
if (obj_error_union0_error != null) {
|
|
549
|
+
obj_error_union0 = obj_error_union0_error.message;
|
|
550
|
+
}
|
|
551
|
+
let obj_error_union1 = null;
|
|
552
|
+
const obj_error_union1_error = (() => {
|
|
553
|
+
if (obj_error !== null) {
|
|
554
|
+
return new TypeError('Expected "null" but received "' + typeof obj_error + '" (at "' + path_error + '")');
|
|
555
|
+
}
|
|
556
|
+
})();
|
|
557
|
+
if (obj_error_union1_error != null) {
|
|
558
|
+
obj_error_union1 = obj_error_union1_error.message;
|
|
559
|
+
}
|
|
560
|
+
if (obj_error_union0 && obj_error_union1) {
|
|
561
|
+
let message = 'Object doesn\'t match union (at "' + path_error + '")';
|
|
562
|
+
message += '\n' + obj_error_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
563
|
+
message += '\n' + obj_error_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
564
|
+
return new TypeError(message);
|
|
565
|
+
}
|
|
566
|
+
if (obj.generatedDate !== undefined) {
|
|
567
|
+
const obj_generatedDate = obj.generatedDate;
|
|
568
|
+
const path_generatedDate = path + '.generatedDate';
|
|
569
|
+
if (typeof obj_generatedDate !== 'string') {
|
|
570
|
+
return new TypeError('Expected "string" but received "' + typeof obj_generatedDate + '" (at "' + path_generatedDate + '")');
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
const obj_knowledgeQuestionRepresentationList = obj.knowledgeQuestionRepresentationList;
|
|
574
|
+
const path_knowledgeQuestionRepresentationList = path + '.knowledgeQuestionRepresentationList';
|
|
575
|
+
if (!ArrayIsArray(obj_knowledgeQuestionRepresentationList)) {
|
|
576
|
+
return new TypeError('Expected "array" but received "' + typeof obj_knowledgeQuestionRepresentationList + '" (at "' + path_knowledgeQuestionRepresentationList + '")');
|
|
577
|
+
}
|
|
578
|
+
for (let i = 0; i < obj_knowledgeQuestionRepresentationList.length; i++) {
|
|
579
|
+
const obj_knowledgeQuestionRepresentationList_item = obj_knowledgeQuestionRepresentationList[i];
|
|
580
|
+
const path_knowledgeQuestionRepresentationList_item = path_knowledgeQuestionRepresentationList + '[' + i + ']';
|
|
581
|
+
const referencepath_knowledgeQuestionRepresentationList_itemValidationError = validate$2(obj_knowledgeQuestionRepresentationList_item, path_knowledgeQuestionRepresentationList_item);
|
|
582
|
+
if (referencepath_knowledgeQuestionRepresentationList_itemValidationError !== null) {
|
|
583
|
+
let message = 'Object doesn\'t match KnowledgeQuestionRepresentation (at "' + path_knowledgeQuestionRepresentationList_item + '")\n';
|
|
584
|
+
message += referencepath_knowledgeQuestionRepresentationList_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
585
|
+
return new TypeError(message);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
})();
|
|
589
|
+
return v_error === undefined ? null : v_error;
|
|
590
|
+
}
|
|
591
|
+
const RepresentationType$1 = 'KnowledgeQuestionCollectionRepresentation';
|
|
592
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
593
|
+
return input;
|
|
594
|
+
}
|
|
595
|
+
const select$3 = function KnowledgeQuestionCollectionRepresentationSelect() {
|
|
596
|
+
const { selections: SSKnowledgeErrorDetailsOutputRepresentation__selections, opaque: SSKnowledgeErrorDetailsOutputRepresentation__opaque, } = select$7();
|
|
597
|
+
const { selections: KnowledgeQuestionRepresentation__selections, opaque: KnowledgeQuestionRepresentation__opaque, } = select$4();
|
|
598
|
+
return {
|
|
599
|
+
kind: 'Fragment',
|
|
600
|
+
version: VERSION$1,
|
|
601
|
+
private: [],
|
|
602
|
+
selections: [
|
|
603
|
+
{
|
|
604
|
+
name: 'error',
|
|
605
|
+
kind: 'Object',
|
|
606
|
+
nullable: true,
|
|
607
|
+
selections: SSKnowledgeErrorDetailsOutputRepresentation__selections
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
name: 'generatedDate',
|
|
611
|
+
kind: 'Scalar',
|
|
612
|
+
required: false
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
name: 'knowledgeQuestionRepresentationList',
|
|
616
|
+
kind: 'Object',
|
|
617
|
+
plural: true,
|
|
618
|
+
selections: KnowledgeQuestionRepresentation__selections
|
|
619
|
+
}
|
|
620
|
+
]
|
|
621
|
+
};
|
|
622
|
+
};
|
|
623
|
+
function equals$1(existing, incoming) {
|
|
624
|
+
const existing_generatedDate = existing.generatedDate;
|
|
625
|
+
const incoming_generatedDate = incoming.generatedDate;
|
|
626
|
+
// if at least one of these optionals is defined
|
|
627
|
+
if (existing_generatedDate !== undefined || incoming_generatedDate !== undefined) {
|
|
628
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
629
|
+
// not equal
|
|
630
|
+
if (existing_generatedDate === undefined || incoming_generatedDate === undefined) {
|
|
631
|
+
return false;
|
|
632
|
+
}
|
|
633
|
+
if (!(existing_generatedDate === incoming_generatedDate)) {
|
|
634
|
+
return false;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
const existing_error = existing.error;
|
|
638
|
+
const incoming_error = incoming.error;
|
|
639
|
+
if (!(existing_error === incoming_error
|
|
640
|
+
|| (existing_error != null &&
|
|
641
|
+
incoming_error != null &&
|
|
642
|
+
equals$4(existing_error, incoming_error)))) {
|
|
643
|
+
return false;
|
|
644
|
+
}
|
|
645
|
+
const existing_knowledgeQuestionRepresentationList = existing.knowledgeQuestionRepresentationList;
|
|
646
|
+
const incoming_knowledgeQuestionRepresentationList = incoming.knowledgeQuestionRepresentationList;
|
|
647
|
+
const equals_knowledgeQuestionRepresentationList_items = equalsArray(existing_knowledgeQuestionRepresentationList, incoming_knowledgeQuestionRepresentationList, (existing_knowledgeQuestionRepresentationList_item, incoming_knowledgeQuestionRepresentationList_item) => {
|
|
648
|
+
if (!(equals$2(existing_knowledgeQuestionRepresentationList_item, incoming_knowledgeQuestionRepresentationList_item))) {
|
|
649
|
+
return false;
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
if (equals_knowledgeQuestionRepresentationList_items === false) {
|
|
653
|
+
return false;
|
|
654
|
+
}
|
|
655
|
+
return true;
|
|
656
|
+
}
|
|
657
|
+
const ingest$1 = function KnowledgeQuestionCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
658
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
659
|
+
const validateError = validate$1(input);
|
|
660
|
+
if (validateError !== null) {
|
|
661
|
+
throw validateError;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
const key = path.fullPath;
|
|
665
|
+
const ttlToUse = TTL$1;
|
|
666
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "knowledge-questions", VERSION$1, RepresentationType$1, equals$1);
|
|
667
|
+
return createLink(key);
|
|
668
|
+
};
|
|
669
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
670
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
671
|
+
const rootKey = fullPathFactory();
|
|
672
|
+
rootKeySet.set(rootKey, {
|
|
673
|
+
namespace: keyPrefix,
|
|
674
|
+
representationName: RepresentationType$1,
|
|
675
|
+
mergeable: false
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
function select$2(luvio, params) {
|
|
680
|
+
return select$3();
|
|
681
|
+
}
|
|
682
|
+
function keyBuilder$2(luvio, params) {
|
|
683
|
+
return keyPrefix + '::KnowledgeQuestionCollectionRepresentation:(' + 'maxResults:' + params.queryParams.maxResults + ',' + 'recordId:' + params.urlParams.recordId + ')';
|
|
684
|
+
}
|
|
685
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
686
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$2(luvio, resourceParams));
|
|
687
|
+
}
|
|
688
|
+
function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
689
|
+
const { body } = response;
|
|
690
|
+
const key = keyBuilder$2(luvio, resourceParams);
|
|
691
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
692
|
+
const snapshot = luvio.storeLookup({
|
|
693
|
+
recordId: key,
|
|
694
|
+
node: select$2(),
|
|
695
|
+
variables: {},
|
|
696
|
+
}, snapshotRefresh);
|
|
697
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
698
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
699
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
deepFreeze(snapshot.data);
|
|
703
|
+
return snapshot;
|
|
704
|
+
}
|
|
705
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
706
|
+
const key = keyBuilder$2(luvio, params);
|
|
707
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
708
|
+
const storeMetadataParams = {
|
|
709
|
+
ttl: TTL$1,
|
|
710
|
+
namespace: keyPrefix,
|
|
711
|
+
version: VERSION$1,
|
|
712
|
+
representationName: RepresentationType$1
|
|
713
|
+
};
|
|
714
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
715
|
+
return errorSnapshot;
|
|
716
|
+
}
|
|
717
|
+
function createResourceRequest$1(config) {
|
|
718
|
+
const headers = {};
|
|
719
|
+
return {
|
|
720
|
+
baseUri: '/services/data/v65.0',
|
|
721
|
+
basePath: '/connect/self-service/knowledge/get-questions/' + config.urlParams.recordId + '',
|
|
722
|
+
method: 'get',
|
|
723
|
+
body: null,
|
|
724
|
+
urlParams: config.urlParams,
|
|
725
|
+
queryParams: config.queryParams,
|
|
726
|
+
headers,
|
|
727
|
+
priority: 'normal',
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
const adapterName$1 = 'getKnowledgeQuestionsGen';
|
|
732
|
+
const getKnowledgeQuestionsGen_ConfigPropertyMetadata = [
|
|
733
|
+
generateParamConfigMetadata('recordId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
734
|
+
generateParamConfigMetadata('maxResults', false, 1 /* QueryParameter */, 3 /* Integer */),
|
|
735
|
+
];
|
|
736
|
+
const getKnowledgeQuestionsGen_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getKnowledgeQuestionsGen_ConfigPropertyMetadata);
|
|
737
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(getKnowledgeQuestionsGen_ConfigPropertyMetadata);
|
|
738
|
+
function keyBuilder$1(luvio, config) {
|
|
739
|
+
const resourceParams = createResourceParams$1(config);
|
|
740
|
+
return keyBuilder$2(luvio, resourceParams);
|
|
741
|
+
}
|
|
742
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
743
|
+
const config = {};
|
|
744
|
+
typeCheckConfig$3(untrustedConfig, config, getKnowledgeQuestionsGen_ConfigPropertyMetadata);
|
|
745
|
+
return config;
|
|
746
|
+
}
|
|
747
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
748
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
749
|
+
return null;
|
|
750
|
+
}
|
|
751
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
752
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
753
|
+
}
|
|
754
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
755
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
756
|
+
return null;
|
|
757
|
+
}
|
|
758
|
+
return config;
|
|
759
|
+
}
|
|
760
|
+
function adapterFragment(luvio, config) {
|
|
761
|
+
createResourceParams$1(config);
|
|
762
|
+
return select$2();
|
|
763
|
+
}
|
|
764
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
765
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
|
|
766
|
+
config,
|
|
767
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
768
|
+
});
|
|
769
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
770
|
+
}
|
|
771
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
772
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
773
|
+
config,
|
|
774
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
775
|
+
});
|
|
776
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
777
|
+
}
|
|
778
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
779
|
+
const resourceParams = createResourceParams$1(config);
|
|
780
|
+
const request = createResourceRequest$1(resourceParams);
|
|
781
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
782
|
+
.then((response) => {
|
|
783
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
784
|
+
const cache = new StoreKeyMap();
|
|
785
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
786
|
+
return cache;
|
|
787
|
+
});
|
|
788
|
+
}, (response) => {
|
|
789
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
793
|
+
return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
|
|
794
|
+
}
|
|
795
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
796
|
+
const { luvio, config } = context;
|
|
797
|
+
const selector = {
|
|
798
|
+
recordId: keyBuilder$1(luvio, config),
|
|
799
|
+
node: adapterFragment(luvio, config),
|
|
800
|
+
variables: {},
|
|
801
|
+
};
|
|
802
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
803
|
+
config,
|
|
804
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
805
|
+
});
|
|
806
|
+
return cacheSnapshot;
|
|
807
|
+
}
|
|
808
|
+
const getKnowledgeQuestionsGenAdapterFactory = (luvio) => function knowledgeQuestions__getKnowledgeQuestionsGen(untrustedConfig, requestContext) {
|
|
809
|
+
const config = validateAdapterConfig$1(untrustedConfig, getKnowledgeQuestionsGen_ConfigPropertyNames);
|
|
810
|
+
// Invalid or incomplete config
|
|
811
|
+
if (config === null) {
|
|
812
|
+
return null;
|
|
813
|
+
}
|
|
814
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
815
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
816
|
+
};
|
|
817
|
+
|
|
818
|
+
const TTL = 300;
|
|
819
|
+
const VERSION = "9da1d14352ffb992a5fcedd9f17ee5ca";
|
|
820
|
+
function validate(obj, path = 'KnowledgeUpdateQuestionRepresentation') {
|
|
821
|
+
const v_error = (() => {
|
|
822
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
823
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
824
|
+
}
|
|
825
|
+
const obj_error = obj.error;
|
|
826
|
+
const path_error = path + '.error';
|
|
827
|
+
let obj_error_union0 = null;
|
|
828
|
+
const obj_error_union0_error = (() => {
|
|
829
|
+
const referencepath_errorValidationError = validate$4(obj_error, path_error);
|
|
830
|
+
if (referencepath_errorValidationError !== null) {
|
|
831
|
+
let message = 'Object doesn\'t match SSKnowledgeErrorDetailsOutputRepresentation (at "' + path_error + '")\n';
|
|
832
|
+
message += referencepath_errorValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
833
|
+
return new TypeError(message);
|
|
834
|
+
}
|
|
835
|
+
})();
|
|
836
|
+
if (obj_error_union0_error != null) {
|
|
837
|
+
obj_error_union0 = obj_error_union0_error.message;
|
|
838
|
+
}
|
|
839
|
+
let obj_error_union1 = null;
|
|
840
|
+
const obj_error_union1_error = (() => {
|
|
841
|
+
if (obj_error !== null) {
|
|
842
|
+
return new TypeError('Expected "null" but received "' + typeof obj_error + '" (at "' + path_error + '")');
|
|
843
|
+
}
|
|
844
|
+
})();
|
|
845
|
+
if (obj_error_union1_error != null) {
|
|
846
|
+
obj_error_union1 = obj_error_union1_error.message;
|
|
847
|
+
}
|
|
848
|
+
if (obj_error_union0 && obj_error_union1) {
|
|
849
|
+
let message = 'Object doesn\'t match union (at "' + path_error + '")';
|
|
850
|
+
message += '\n' + obj_error_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
851
|
+
message += '\n' + obj_error_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
852
|
+
return new TypeError(message);
|
|
853
|
+
}
|
|
854
|
+
const obj_status = obj.status;
|
|
855
|
+
const path_status = path + '.status';
|
|
856
|
+
let obj_status_union0 = null;
|
|
857
|
+
const obj_status_union0_error = (() => {
|
|
858
|
+
if (typeof obj_status !== 'string') {
|
|
859
|
+
return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
|
|
860
|
+
}
|
|
861
|
+
})();
|
|
862
|
+
if (obj_status_union0_error != null) {
|
|
863
|
+
obj_status_union0 = obj_status_union0_error.message;
|
|
864
|
+
}
|
|
865
|
+
let obj_status_union1 = null;
|
|
866
|
+
const obj_status_union1_error = (() => {
|
|
867
|
+
if (obj_status !== null) {
|
|
868
|
+
return new TypeError('Expected "null" but received "' + typeof obj_status + '" (at "' + path_status + '")');
|
|
869
|
+
}
|
|
870
|
+
})();
|
|
871
|
+
if (obj_status_union1_error != null) {
|
|
872
|
+
obj_status_union1 = obj_status_union1_error.message;
|
|
873
|
+
}
|
|
874
|
+
if (obj_status_union0 && obj_status_union1) {
|
|
875
|
+
let message = 'Object doesn\'t match union (at "' + path_status + '")';
|
|
876
|
+
message += '\n' + obj_status_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
877
|
+
message += '\n' + obj_status_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
878
|
+
return new TypeError(message);
|
|
879
|
+
}
|
|
880
|
+
})();
|
|
881
|
+
return v_error === undefined ? null : v_error;
|
|
882
|
+
}
|
|
883
|
+
const RepresentationType = 'KnowledgeUpdateQuestionRepresentation';
|
|
884
|
+
function keyBuilder(luvio, config) {
|
|
885
|
+
return keyPrefix + '::' + RepresentationType + ':' + (config.id === null ? '' : config.id);
|
|
886
|
+
}
|
|
887
|
+
function keyBuilderFromType(luvio, object) {
|
|
888
|
+
const keyParams = {
|
|
889
|
+
id: object.status
|
|
890
|
+
};
|
|
891
|
+
return keyBuilder(luvio, keyParams);
|
|
892
|
+
}
|
|
893
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
894
|
+
return input;
|
|
895
|
+
}
|
|
896
|
+
const select$1 = function KnowledgeUpdateQuestionRepresentationSelect() {
|
|
897
|
+
const { selections: SSKnowledgeErrorDetailsOutputRepresentation__selections, opaque: SSKnowledgeErrorDetailsOutputRepresentation__opaque, } = select$7();
|
|
898
|
+
return {
|
|
899
|
+
kind: 'Fragment',
|
|
900
|
+
version: VERSION,
|
|
901
|
+
private: [],
|
|
902
|
+
selections: [
|
|
903
|
+
{
|
|
904
|
+
name: 'error',
|
|
905
|
+
kind: 'Object',
|
|
906
|
+
nullable: true,
|
|
907
|
+
selections: SSKnowledgeErrorDetailsOutputRepresentation__selections
|
|
908
|
+
},
|
|
909
|
+
{
|
|
910
|
+
name: 'status',
|
|
911
|
+
kind: 'Scalar'
|
|
912
|
+
}
|
|
913
|
+
]
|
|
914
|
+
};
|
|
915
|
+
};
|
|
916
|
+
function equals(existing, incoming) {
|
|
917
|
+
const existing_error = existing.error;
|
|
918
|
+
const incoming_error = incoming.error;
|
|
919
|
+
if (!(existing_error === incoming_error
|
|
920
|
+
|| (existing_error != null &&
|
|
921
|
+
incoming_error != null &&
|
|
922
|
+
equals$4(existing_error, incoming_error)))) {
|
|
923
|
+
return false;
|
|
924
|
+
}
|
|
925
|
+
const existing_status = existing.status;
|
|
926
|
+
const incoming_status = incoming.status;
|
|
927
|
+
if (!(existing_status === incoming_status)) {
|
|
928
|
+
return false;
|
|
929
|
+
}
|
|
930
|
+
return true;
|
|
931
|
+
}
|
|
932
|
+
const ingest = function KnowledgeUpdateQuestionRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
933
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
934
|
+
const validateError = validate(input);
|
|
935
|
+
if (validateError !== null) {
|
|
936
|
+
throw validateError;
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
const key = keyBuilderFromType(luvio, input);
|
|
940
|
+
const ttlToUse = TTL;
|
|
941
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "knowledge-questions", VERSION, RepresentationType, equals);
|
|
942
|
+
return createLink(key);
|
|
943
|
+
};
|
|
944
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
945
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
946
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
947
|
+
rootKeySet.set(rootKey, {
|
|
948
|
+
namespace: keyPrefix,
|
|
949
|
+
representationName: RepresentationType,
|
|
950
|
+
mergeable: false
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
function select(luvio, params) {
|
|
955
|
+
return select$1();
|
|
956
|
+
}
|
|
957
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
958
|
+
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
959
|
+
}
|
|
960
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
961
|
+
const { body } = response;
|
|
962
|
+
const key = keyBuilderFromType(luvio, body);
|
|
963
|
+
luvio.storeIngest(key, ingest, body);
|
|
964
|
+
const snapshot = luvio.storeLookup({
|
|
965
|
+
recordId: key,
|
|
966
|
+
node: select(),
|
|
967
|
+
variables: {},
|
|
968
|
+
});
|
|
969
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
970
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
971
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
deepFreeze(snapshot.data);
|
|
975
|
+
return snapshot;
|
|
976
|
+
}
|
|
977
|
+
function createResourceRequest(config) {
|
|
978
|
+
const headers = {};
|
|
979
|
+
return {
|
|
980
|
+
baseUri: '/services/data/v65.0',
|
|
981
|
+
basePath: '/connect/self-service/knowledge/update-question/' + config.urlParams.questionId + '',
|
|
982
|
+
method: 'post',
|
|
983
|
+
body: null,
|
|
984
|
+
urlParams: config.urlParams,
|
|
985
|
+
queryParams: {},
|
|
986
|
+
headers,
|
|
987
|
+
priority: 'normal',
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
const adapterName = 'postKnowledgeUpdateQuestion';
|
|
992
|
+
const postKnowledgeUpdateQuestion_ConfigPropertyMetadata = [
|
|
993
|
+
generateParamConfigMetadata('questionId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
994
|
+
];
|
|
995
|
+
const postKnowledgeUpdateQuestion_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, postKnowledgeUpdateQuestion_ConfigPropertyMetadata);
|
|
996
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$3(postKnowledgeUpdateQuestion_ConfigPropertyMetadata);
|
|
997
|
+
function typeCheckConfig(untrustedConfig) {
|
|
998
|
+
const config = {};
|
|
999
|
+
typeCheckConfig$3(untrustedConfig, config, postKnowledgeUpdateQuestion_ConfigPropertyMetadata);
|
|
1000
|
+
return config;
|
|
1001
|
+
}
|
|
1002
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
1003
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1004
|
+
return null;
|
|
1005
|
+
}
|
|
1006
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1007
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1008
|
+
}
|
|
1009
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
1010
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1011
|
+
return null;
|
|
1012
|
+
}
|
|
1013
|
+
return config;
|
|
1014
|
+
}
|
|
1015
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
1016
|
+
const resourceParams = createResourceParams(config);
|
|
1017
|
+
const request = createResourceRequest(resourceParams);
|
|
1018
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1019
|
+
.then((response) => {
|
|
1020
|
+
return luvio.handleSuccessResponse(() => {
|
|
1021
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
1022
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1023
|
+
}, () => {
|
|
1024
|
+
const cache = new StoreKeyMap();
|
|
1025
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
1026
|
+
return cache;
|
|
1027
|
+
});
|
|
1028
|
+
}, (response) => {
|
|
1029
|
+
deepFreeze(response);
|
|
1030
|
+
throw response;
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
1033
|
+
const postKnowledgeUpdateQuestionAdapterFactory = (luvio) => {
|
|
1034
|
+
return function postKnowledgeUpdateQuestion(untrustedConfig) {
|
|
1035
|
+
const config = validateAdapterConfig(untrustedConfig, postKnowledgeUpdateQuestion_ConfigPropertyNames);
|
|
1036
|
+
// Invalid or incomplete config
|
|
1037
|
+
if (config === null) {
|
|
1038
|
+
throw new Error('Invalid config for "postKnowledgeUpdateQuestion"');
|
|
1039
|
+
}
|
|
1040
|
+
return buildNetworkSnapshot(luvio, config);
|
|
1041
|
+
};
|
|
1042
|
+
};
|
|
1043
|
+
|
|
1044
|
+
let getKnowledgeAnswer;
|
|
1045
|
+
let getKnowledgeQuestionsGen;
|
|
1046
|
+
let postKnowledgeUpdateQuestion;
|
|
1047
|
+
// Imperative GET Adapters
|
|
1048
|
+
let getKnowledgeQuestionsGen_imperative;
|
|
1049
|
+
const getKnowledgeQuestionsGenMetadata = {
|
|
1050
|
+
apiFamily: 'knowledgequestions',
|
|
1051
|
+
name: 'getKnowledgeQuestionsGen',
|
|
1052
|
+
ttl: 300,
|
|
1053
|
+
};
|
|
1054
|
+
// Notify Update Available
|
|
1055
|
+
function bindExportsTo(luvio) {
|
|
1056
|
+
// LDS Adapters
|
|
1057
|
+
const getKnowledgeQuestionsGen_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getKnowledgeQuestionsGen', getKnowledgeQuestionsGenAdapterFactory), getKnowledgeQuestionsGenMetadata);
|
|
1058
|
+
function unwrapSnapshotData(factory) {
|
|
1059
|
+
const adapter = factory(luvio);
|
|
1060
|
+
return (config) => adapter(config).then((snapshot) => snapshot.data);
|
|
1061
|
+
}
|
|
1062
|
+
return {
|
|
1063
|
+
getKnowledgeAnswer: unwrapSnapshotData(getKnowledgeAnswerAdapterFactory),
|
|
1064
|
+
getKnowledgeQuestionsGen: createWireAdapterConstructor(luvio, getKnowledgeQuestionsGen_ldsAdapter, getKnowledgeQuestionsGenMetadata),
|
|
1065
|
+
postKnowledgeUpdateQuestion: unwrapSnapshotData(postKnowledgeUpdateQuestionAdapterFactory),
|
|
1066
|
+
// Imperative GET Adapters
|
|
1067
|
+
getKnowledgeQuestionsGen_imperative: createImperativeAdapter(luvio, getKnowledgeQuestionsGen_ldsAdapter, getKnowledgeQuestionsGenMetadata),
|
|
1068
|
+
// Notify Update Availables
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
withDefaultLuvio((luvio) => {
|
|
1072
|
+
({
|
|
1073
|
+
getKnowledgeAnswer,
|
|
1074
|
+
getKnowledgeQuestionsGen,
|
|
1075
|
+
postKnowledgeUpdateQuestion,
|
|
1076
|
+
getKnowledgeQuestionsGen_imperative,
|
|
1077
|
+
} = bindExportsTo(luvio));
|
|
1078
|
+
});
|
|
1079
|
+
|
|
1080
|
+
export { getKnowledgeAnswer, getKnowledgeQuestionsGen, getKnowledgeQuestionsGen_imperative, postKnowledgeUpdateQuestion };
|
|
1081
|
+
// version: 1.366.0-bf15f04cce
|