@salesforce/lds-adapters-service-knowledge-questions 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.
- package/LICENSE.txt +82 -0
- package/dist/es/es2018/service-knowledge-questions.js +790 -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 +22 -0
- package/dist/es/es2018/types/src/generated/adapters/getKnowledgeQuestionsGen.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/adapters/putKnowledgeUpdateQuestion.d.ts +16 -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/getConnectArticleQuestionsByRecordId.d.ts +18 -0
- package/dist/es/es2018/types/src/generated/resources/postConnectArticleAnswerByRecordId.d.ts +21 -0
- package/dist/es/es2018/types/src/generated/resources/putConnectArticleQuestionsSelectioncountByRecordIdAndQuestionId.d.ts +13 -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 +41 -0
- package/dist/es/es2018/types/src/generated/types/KnowledgeQuestionCollectionRepresentation.d.ts +33 -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 +38 -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 +837 -0
- package/src/raml/api.raml +141 -0
- package/src/raml/luvio.raml +35 -0
package/sfdc/index.js
ADDED
|
@@ -0,0 +1,837 @@
|
|
|
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 TTL$2 = 300;
|
|
105
|
+
const VERSION$3 = "224afab57d30317cfefba7f46d67f106";
|
|
106
|
+
function validate$3(obj, path = 'KnowledgeAnswerRepresentation') {
|
|
107
|
+
const v_error = (() => {
|
|
108
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
109
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
110
|
+
}
|
|
111
|
+
const obj_answer = obj.answer;
|
|
112
|
+
const path_answer = path + '.answer';
|
|
113
|
+
if (typeof obj_answer !== 'string') {
|
|
114
|
+
return new TypeError('Expected "string" but received "' + typeof obj_answer + '" (at "' + path_answer + '")');
|
|
115
|
+
}
|
|
116
|
+
const obj_status = obj.status;
|
|
117
|
+
const path_status = path + '.status';
|
|
118
|
+
if (typeof obj_status !== 'string') {
|
|
119
|
+
return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
|
|
120
|
+
}
|
|
121
|
+
})();
|
|
122
|
+
return v_error === undefined ? null : v_error;
|
|
123
|
+
}
|
|
124
|
+
const RepresentationType$2 = 'KnowledgeAnswerRepresentation';
|
|
125
|
+
function keyBuilder$3(luvio, config) {
|
|
126
|
+
return keyPrefix + '::' + RepresentationType$2 + ':' + config.id;
|
|
127
|
+
}
|
|
128
|
+
function keyBuilderFromType$1(luvio, object) {
|
|
129
|
+
const keyParams = {
|
|
130
|
+
id: object.answer
|
|
131
|
+
};
|
|
132
|
+
return keyBuilder$3(luvio, keyParams);
|
|
133
|
+
}
|
|
134
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
135
|
+
return input;
|
|
136
|
+
}
|
|
137
|
+
const select$6 = function KnowledgeAnswerRepresentationSelect() {
|
|
138
|
+
return {
|
|
139
|
+
kind: 'Fragment',
|
|
140
|
+
version: VERSION$3,
|
|
141
|
+
private: [],
|
|
142
|
+
selections: [
|
|
143
|
+
{
|
|
144
|
+
name: 'answer',
|
|
145
|
+
kind: 'Scalar'
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: 'status',
|
|
149
|
+
kind: 'Scalar'
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
function equals$3(existing, incoming) {
|
|
155
|
+
const existing_answer = existing.answer;
|
|
156
|
+
const incoming_answer = incoming.answer;
|
|
157
|
+
if (!(existing_answer === incoming_answer)) {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
const existing_status = existing.status;
|
|
161
|
+
const incoming_status = incoming.status;
|
|
162
|
+
if (!(existing_status === incoming_status)) {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
const ingest$2 = function KnowledgeAnswerRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
168
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
169
|
+
const validateError = validate$3(input);
|
|
170
|
+
if (validateError !== null) {
|
|
171
|
+
throw validateError;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
const key = keyBuilderFromType$1(luvio, input);
|
|
175
|
+
const ttlToUse = TTL$2;
|
|
176
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "knowledge-questions", VERSION$3, RepresentationType$2, equals$3);
|
|
177
|
+
return createLink(key);
|
|
178
|
+
};
|
|
179
|
+
function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
|
|
180
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
181
|
+
const rootKey = keyBuilderFromType$1(luvio, input);
|
|
182
|
+
rootKeySet.set(rootKey, {
|
|
183
|
+
namespace: keyPrefix,
|
|
184
|
+
representationName: RepresentationType$2,
|
|
185
|
+
mergeable: false
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function select$5(luvio, params) {
|
|
190
|
+
return select$6();
|
|
191
|
+
}
|
|
192
|
+
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
193
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response);
|
|
194
|
+
}
|
|
195
|
+
function ingestSuccess$2(luvio, resourceParams, response) {
|
|
196
|
+
const { body } = response;
|
|
197
|
+
const key = keyBuilderFromType$1(luvio, body);
|
|
198
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
199
|
+
const snapshot = luvio.storeLookup({
|
|
200
|
+
recordId: key,
|
|
201
|
+
node: select$5(),
|
|
202
|
+
variables: {},
|
|
203
|
+
});
|
|
204
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
205
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
206
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
deepFreeze(snapshot.data);
|
|
210
|
+
return snapshot;
|
|
211
|
+
}
|
|
212
|
+
function createResourceRequest$2(config) {
|
|
213
|
+
const headers = {};
|
|
214
|
+
return {
|
|
215
|
+
baseUri: '/services/data/v66.0',
|
|
216
|
+
basePath: '/connect/article/' + config.urlParams.recordId + '/answer',
|
|
217
|
+
method: 'post',
|
|
218
|
+
body: config.body,
|
|
219
|
+
urlParams: config.urlParams,
|
|
220
|
+
queryParams: {},
|
|
221
|
+
headers,
|
|
222
|
+
priority: 'normal',
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const adapterName$2 = 'getKnowledgeAnswer';
|
|
227
|
+
const getKnowledgeAnswer_ConfigPropertyMetadata = [
|
|
228
|
+
generateParamConfigMetadata('recordId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
229
|
+
generateParamConfigMetadata('contextInfo', true, 2 /* Body */, 4 /* Unsupported */),
|
|
230
|
+
generateParamConfigMetadata('metadata', true, 2 /* Body */, 4 /* Unsupported */),
|
|
231
|
+
generateParamConfigMetadata('question', true, 2 /* Body */, 0 /* String */),
|
|
232
|
+
];
|
|
233
|
+
const getKnowledgeAnswer_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getKnowledgeAnswer_ConfigPropertyMetadata);
|
|
234
|
+
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(getKnowledgeAnswer_ConfigPropertyMetadata);
|
|
235
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
236
|
+
const config = {};
|
|
237
|
+
typeCheckConfig$3(untrustedConfig, config, getKnowledgeAnswer_ConfigPropertyMetadata);
|
|
238
|
+
const untrustedConfig_contextInfo = untrustedConfig.contextInfo;
|
|
239
|
+
if (untrustedIsObject(untrustedConfig_contextInfo)) {
|
|
240
|
+
const untrustedConfig_contextInfo_object = {};
|
|
241
|
+
const untrustedConfig_contextInfo_keys = Object.keys(untrustedConfig_contextInfo);
|
|
242
|
+
for (let i = 0, arrayLength = untrustedConfig_contextInfo_keys.length; i < arrayLength; i++) {
|
|
243
|
+
const key = untrustedConfig_contextInfo_keys[i];
|
|
244
|
+
const untrustedConfig_contextInfo_prop = untrustedConfig_contextInfo[key];
|
|
245
|
+
if (typeof untrustedConfig_contextInfo_prop === 'string') {
|
|
246
|
+
if (untrustedConfig_contextInfo_object !== undefined) {
|
|
247
|
+
untrustedConfig_contextInfo_object[key] = untrustedConfig_contextInfo_prop;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (untrustedConfig_contextInfo_object !== undefined && Object.keys(untrustedConfig_contextInfo_object).length >= 0) {
|
|
252
|
+
config.contextInfo = untrustedConfig_contextInfo_object;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
const untrustedConfig_metadata = untrustedConfig.metadata;
|
|
256
|
+
if (untrustedIsObject(untrustedConfig_metadata)) {
|
|
257
|
+
const untrustedConfig_metadata_object = {};
|
|
258
|
+
const untrustedConfig_metadata_keys = Object.keys(untrustedConfig_metadata);
|
|
259
|
+
for (let i = 0, arrayLength = untrustedConfig_metadata_keys.length; i < arrayLength; i++) {
|
|
260
|
+
const key = untrustedConfig_metadata_keys[i];
|
|
261
|
+
const untrustedConfig_metadata_prop = untrustedConfig_metadata[key];
|
|
262
|
+
if (typeof untrustedConfig_metadata_prop === 'string') {
|
|
263
|
+
if (untrustedConfig_metadata_object !== undefined) {
|
|
264
|
+
untrustedConfig_metadata_object[key] = untrustedConfig_metadata_prop;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
if (untrustedConfig_metadata_object !== undefined && Object.keys(untrustedConfig_metadata_object).length >= 0) {
|
|
269
|
+
config.metadata = untrustedConfig_metadata_object;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return config;
|
|
273
|
+
}
|
|
274
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
275
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
279
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
280
|
+
}
|
|
281
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
282
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
285
|
+
return config;
|
|
286
|
+
}
|
|
287
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
288
|
+
const resourceParams = createResourceParams$2(config);
|
|
289
|
+
const request = createResourceRequest$2(resourceParams);
|
|
290
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
291
|
+
.then((response) => {
|
|
292
|
+
return luvio.handleSuccessResponse(() => {
|
|
293
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response);
|
|
294
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
295
|
+
}, () => {
|
|
296
|
+
const cache = new StoreKeyMap();
|
|
297
|
+
getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
|
|
298
|
+
return cache;
|
|
299
|
+
});
|
|
300
|
+
}, (response) => {
|
|
301
|
+
deepFreeze(response);
|
|
302
|
+
throw response;
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
const getKnowledgeAnswerAdapterFactory = (luvio) => {
|
|
306
|
+
return function getKnowledgeAnswer(untrustedConfig) {
|
|
307
|
+
const config = validateAdapterConfig$2(untrustedConfig, getKnowledgeAnswer_ConfigPropertyNames);
|
|
308
|
+
// Invalid or incomplete config
|
|
309
|
+
if (config === null) {
|
|
310
|
+
throw new Error('Invalid config for "getKnowledgeAnswer"');
|
|
311
|
+
}
|
|
312
|
+
return buildNetworkSnapshot$2(luvio, config);
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
const VERSION$2 = "0583cf81b5f0f4d839cf90aa7caddf0a";
|
|
317
|
+
function validate$2(obj, path = 'KnowledgeQuestionRepresentation') {
|
|
318
|
+
const v_error = (() => {
|
|
319
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
320
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
321
|
+
}
|
|
322
|
+
const obj_answer = obj.answer;
|
|
323
|
+
const path_answer = path + '.answer';
|
|
324
|
+
if (typeof obj_answer !== 'string') {
|
|
325
|
+
return new TypeError('Expected "string" but received "' + typeof obj_answer + '" (at "' + path_answer + '")');
|
|
326
|
+
}
|
|
327
|
+
const obj_question = obj.question;
|
|
328
|
+
const path_question = path + '.question';
|
|
329
|
+
if (typeof obj_question !== 'string') {
|
|
330
|
+
return new TypeError('Expected "string" but received "' + typeof obj_question + '" (at "' + path_question + '")');
|
|
331
|
+
}
|
|
332
|
+
const obj_questionId = obj.questionId;
|
|
333
|
+
const path_questionId = path + '.questionId';
|
|
334
|
+
if (typeof obj_questionId !== 'string') {
|
|
335
|
+
return new TypeError('Expected "string" but received "' + typeof obj_questionId + '" (at "' + path_questionId + '")');
|
|
336
|
+
}
|
|
337
|
+
const obj_selectionCount = obj.selectionCount;
|
|
338
|
+
const path_selectionCount = path + '.selectionCount';
|
|
339
|
+
if (typeof obj_selectionCount !== 'number' || (typeof obj_selectionCount === 'number' && Math.floor(obj_selectionCount) !== obj_selectionCount)) {
|
|
340
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_selectionCount + '" (at "' + path_selectionCount + '")');
|
|
341
|
+
}
|
|
342
|
+
})();
|
|
343
|
+
return v_error === undefined ? null : v_error;
|
|
344
|
+
}
|
|
345
|
+
const select$4 = function KnowledgeQuestionRepresentationSelect() {
|
|
346
|
+
return {
|
|
347
|
+
kind: 'Fragment',
|
|
348
|
+
version: VERSION$2,
|
|
349
|
+
private: [],
|
|
350
|
+
selections: [
|
|
351
|
+
{
|
|
352
|
+
name: 'answer',
|
|
353
|
+
kind: 'Scalar'
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
name: 'question',
|
|
357
|
+
kind: 'Scalar'
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
name: 'questionId',
|
|
361
|
+
kind: 'Scalar'
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
name: 'selectionCount',
|
|
365
|
+
kind: 'Scalar'
|
|
366
|
+
}
|
|
367
|
+
]
|
|
368
|
+
};
|
|
369
|
+
};
|
|
370
|
+
function equals$2(existing, incoming) {
|
|
371
|
+
const existing_selectionCount = existing.selectionCount;
|
|
372
|
+
const incoming_selectionCount = incoming.selectionCount;
|
|
373
|
+
if (!(existing_selectionCount === incoming_selectionCount)) {
|
|
374
|
+
return false;
|
|
375
|
+
}
|
|
376
|
+
const existing_answer = existing.answer;
|
|
377
|
+
const incoming_answer = incoming.answer;
|
|
378
|
+
if (!(existing_answer === incoming_answer)) {
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
const existing_question = existing.question;
|
|
382
|
+
const incoming_question = incoming.question;
|
|
383
|
+
if (!(existing_question === incoming_question)) {
|
|
384
|
+
return false;
|
|
385
|
+
}
|
|
386
|
+
const existing_questionId = existing.questionId;
|
|
387
|
+
const incoming_questionId = incoming.questionId;
|
|
388
|
+
if (!(existing_questionId === incoming_questionId)) {
|
|
389
|
+
return false;
|
|
390
|
+
}
|
|
391
|
+
return true;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
const TTL$1 = 300;
|
|
395
|
+
const VERSION$1 = "e2fb301a62e482f53092c6ef8c054fce";
|
|
396
|
+
function validate$1(obj, path = 'KnowledgeQuestionCollectionRepresentation') {
|
|
397
|
+
const v_error = (() => {
|
|
398
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
399
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
400
|
+
}
|
|
401
|
+
if (obj.generatedDate !== undefined) {
|
|
402
|
+
const obj_generatedDate = obj.generatedDate;
|
|
403
|
+
const path_generatedDate = path + '.generatedDate';
|
|
404
|
+
if (typeof obj_generatedDate !== 'string') {
|
|
405
|
+
return new TypeError('Expected "string" but received "' + typeof obj_generatedDate + '" (at "' + path_generatedDate + '")');
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
const obj_knowledgeQuestionRepresentationList = obj.knowledgeQuestionRepresentationList;
|
|
409
|
+
const path_knowledgeQuestionRepresentationList = path + '.knowledgeQuestionRepresentationList';
|
|
410
|
+
if (!ArrayIsArray(obj_knowledgeQuestionRepresentationList)) {
|
|
411
|
+
return new TypeError('Expected "array" but received "' + typeof obj_knowledgeQuestionRepresentationList + '" (at "' + path_knowledgeQuestionRepresentationList + '")');
|
|
412
|
+
}
|
|
413
|
+
for (let i = 0; i < obj_knowledgeQuestionRepresentationList.length; i++) {
|
|
414
|
+
const obj_knowledgeQuestionRepresentationList_item = obj_knowledgeQuestionRepresentationList[i];
|
|
415
|
+
const path_knowledgeQuestionRepresentationList_item = path_knowledgeQuestionRepresentationList + '[' + i + ']';
|
|
416
|
+
const referencepath_knowledgeQuestionRepresentationList_itemValidationError = validate$2(obj_knowledgeQuestionRepresentationList_item, path_knowledgeQuestionRepresentationList_item);
|
|
417
|
+
if (referencepath_knowledgeQuestionRepresentationList_itemValidationError !== null) {
|
|
418
|
+
let message = 'Object doesn\'t match KnowledgeQuestionRepresentation (at "' + path_knowledgeQuestionRepresentationList_item + '")\n';
|
|
419
|
+
message += referencepath_knowledgeQuestionRepresentationList_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
420
|
+
return new TypeError(message);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
})();
|
|
424
|
+
return v_error === undefined ? null : v_error;
|
|
425
|
+
}
|
|
426
|
+
const RepresentationType$1 = 'KnowledgeQuestionCollectionRepresentation';
|
|
427
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
428
|
+
return input;
|
|
429
|
+
}
|
|
430
|
+
const select$3 = function KnowledgeQuestionCollectionRepresentationSelect() {
|
|
431
|
+
const { selections: KnowledgeQuestionRepresentation__selections, opaque: KnowledgeQuestionRepresentation__opaque, } = select$4();
|
|
432
|
+
return {
|
|
433
|
+
kind: 'Fragment',
|
|
434
|
+
version: VERSION$1,
|
|
435
|
+
private: [],
|
|
436
|
+
selections: [
|
|
437
|
+
{
|
|
438
|
+
name: 'generatedDate',
|
|
439
|
+
kind: 'Scalar',
|
|
440
|
+
required: false
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
name: 'knowledgeQuestionRepresentationList',
|
|
444
|
+
kind: 'Object',
|
|
445
|
+
plural: true,
|
|
446
|
+
selections: KnowledgeQuestionRepresentation__selections
|
|
447
|
+
}
|
|
448
|
+
]
|
|
449
|
+
};
|
|
450
|
+
};
|
|
451
|
+
function equals$1(existing, incoming) {
|
|
452
|
+
const existing_generatedDate = existing.generatedDate;
|
|
453
|
+
const incoming_generatedDate = incoming.generatedDate;
|
|
454
|
+
// if at least one of these optionals is defined
|
|
455
|
+
if (existing_generatedDate !== undefined || incoming_generatedDate !== undefined) {
|
|
456
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
457
|
+
// not equal
|
|
458
|
+
if (existing_generatedDate === undefined || incoming_generatedDate === undefined) {
|
|
459
|
+
return false;
|
|
460
|
+
}
|
|
461
|
+
if (!(existing_generatedDate === incoming_generatedDate)) {
|
|
462
|
+
return false;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
const existing_knowledgeQuestionRepresentationList = existing.knowledgeQuestionRepresentationList;
|
|
466
|
+
const incoming_knowledgeQuestionRepresentationList = incoming.knowledgeQuestionRepresentationList;
|
|
467
|
+
const equals_knowledgeQuestionRepresentationList_items = equalsArray(existing_knowledgeQuestionRepresentationList, incoming_knowledgeQuestionRepresentationList, (existing_knowledgeQuestionRepresentationList_item, incoming_knowledgeQuestionRepresentationList_item) => {
|
|
468
|
+
if (!(equals$2(existing_knowledgeQuestionRepresentationList_item, incoming_knowledgeQuestionRepresentationList_item))) {
|
|
469
|
+
return false;
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
if (equals_knowledgeQuestionRepresentationList_items === false) {
|
|
473
|
+
return false;
|
|
474
|
+
}
|
|
475
|
+
return true;
|
|
476
|
+
}
|
|
477
|
+
const ingest$1 = function KnowledgeQuestionCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
478
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
479
|
+
const validateError = validate$1(input);
|
|
480
|
+
if (validateError !== null) {
|
|
481
|
+
throw validateError;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
const key = path.fullPath;
|
|
485
|
+
const ttlToUse = TTL$1;
|
|
486
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "knowledge-questions", VERSION$1, RepresentationType$1, equals$1);
|
|
487
|
+
return createLink(key);
|
|
488
|
+
};
|
|
489
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
490
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
491
|
+
const rootKey = fullPathFactory();
|
|
492
|
+
rootKeySet.set(rootKey, {
|
|
493
|
+
namespace: keyPrefix,
|
|
494
|
+
representationName: RepresentationType$1,
|
|
495
|
+
mergeable: false
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
function select$2(luvio, params) {
|
|
500
|
+
return select$3();
|
|
501
|
+
}
|
|
502
|
+
function keyBuilder$2(luvio, params) {
|
|
503
|
+
return keyPrefix + '::KnowledgeQuestionCollectionRepresentation:(' + 'maxResults:' + params.queryParams.maxResults + ',' + 'recordId:' + params.urlParams.recordId + ')';
|
|
504
|
+
}
|
|
505
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
506
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$2(luvio, resourceParams));
|
|
507
|
+
}
|
|
508
|
+
function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
509
|
+
const { body } = response;
|
|
510
|
+
const key = keyBuilder$2(luvio, resourceParams);
|
|
511
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
512
|
+
const snapshot = luvio.storeLookup({
|
|
513
|
+
recordId: key,
|
|
514
|
+
node: select$2(),
|
|
515
|
+
variables: {},
|
|
516
|
+
}, snapshotRefresh);
|
|
517
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
518
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
519
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
deepFreeze(snapshot.data);
|
|
523
|
+
return snapshot;
|
|
524
|
+
}
|
|
525
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
526
|
+
const key = keyBuilder$2(luvio, params);
|
|
527
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
528
|
+
const storeMetadataParams = {
|
|
529
|
+
ttl: TTL$1,
|
|
530
|
+
namespace: keyPrefix,
|
|
531
|
+
version: VERSION$1,
|
|
532
|
+
representationName: RepresentationType$1
|
|
533
|
+
};
|
|
534
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
535
|
+
return errorSnapshot;
|
|
536
|
+
}
|
|
537
|
+
function createResourceRequest$1(config) {
|
|
538
|
+
const headers = {};
|
|
539
|
+
return {
|
|
540
|
+
baseUri: '/services/data/v66.0',
|
|
541
|
+
basePath: '/connect/article/' + config.urlParams.recordId + '/questions',
|
|
542
|
+
method: 'get',
|
|
543
|
+
body: null,
|
|
544
|
+
urlParams: config.urlParams,
|
|
545
|
+
queryParams: config.queryParams,
|
|
546
|
+
headers,
|
|
547
|
+
priority: 'normal',
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
const adapterName$1 = 'getKnowledgeQuestionsGen';
|
|
552
|
+
const getKnowledgeQuestionsGen_ConfigPropertyMetadata = [
|
|
553
|
+
generateParamConfigMetadata('recordId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
554
|
+
generateParamConfigMetadata('maxResults', false, 1 /* QueryParameter */, 3 /* Integer */),
|
|
555
|
+
];
|
|
556
|
+
const getKnowledgeQuestionsGen_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getKnowledgeQuestionsGen_ConfigPropertyMetadata);
|
|
557
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(getKnowledgeQuestionsGen_ConfigPropertyMetadata);
|
|
558
|
+
function keyBuilder$1(luvio, config) {
|
|
559
|
+
const resourceParams = createResourceParams$1(config);
|
|
560
|
+
return keyBuilder$2(luvio, resourceParams);
|
|
561
|
+
}
|
|
562
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
563
|
+
const config = {};
|
|
564
|
+
typeCheckConfig$3(untrustedConfig, config, getKnowledgeQuestionsGen_ConfigPropertyMetadata);
|
|
565
|
+
return config;
|
|
566
|
+
}
|
|
567
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
568
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
569
|
+
return null;
|
|
570
|
+
}
|
|
571
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
572
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
573
|
+
}
|
|
574
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
575
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
576
|
+
return null;
|
|
577
|
+
}
|
|
578
|
+
return config;
|
|
579
|
+
}
|
|
580
|
+
function adapterFragment(luvio, config) {
|
|
581
|
+
createResourceParams$1(config);
|
|
582
|
+
return select$2();
|
|
583
|
+
}
|
|
584
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
585
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
|
|
586
|
+
config,
|
|
587
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
588
|
+
});
|
|
589
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
590
|
+
}
|
|
591
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
592
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
593
|
+
config,
|
|
594
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
595
|
+
});
|
|
596
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
597
|
+
}
|
|
598
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
599
|
+
const resourceParams = createResourceParams$1(config);
|
|
600
|
+
const request = createResourceRequest$1(resourceParams);
|
|
601
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
602
|
+
.then((response) => {
|
|
603
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
604
|
+
const cache = new StoreKeyMap();
|
|
605
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
606
|
+
return cache;
|
|
607
|
+
});
|
|
608
|
+
}, (response) => {
|
|
609
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
613
|
+
return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
|
|
614
|
+
}
|
|
615
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
616
|
+
const { luvio, config } = context;
|
|
617
|
+
const selector = {
|
|
618
|
+
recordId: keyBuilder$1(luvio, config),
|
|
619
|
+
node: adapterFragment(luvio, config),
|
|
620
|
+
variables: {},
|
|
621
|
+
};
|
|
622
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
623
|
+
config,
|
|
624
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
625
|
+
});
|
|
626
|
+
return cacheSnapshot;
|
|
627
|
+
}
|
|
628
|
+
const getKnowledgeQuestionsGenAdapterFactory = (luvio) => function knowledgeQuestions__getKnowledgeQuestionsGen(untrustedConfig, requestContext) {
|
|
629
|
+
const config = validateAdapterConfig$1(untrustedConfig, getKnowledgeQuestionsGen_ConfigPropertyNames);
|
|
630
|
+
// Invalid or incomplete config
|
|
631
|
+
if (config === null) {
|
|
632
|
+
return null;
|
|
633
|
+
}
|
|
634
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
635
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
636
|
+
};
|
|
637
|
+
|
|
638
|
+
const TTL = 300;
|
|
639
|
+
const VERSION = "2c05b16c1586e5c8b7e6d423d2776998";
|
|
640
|
+
function validate(obj, path = 'KnowledgeUpdateQuestionRepresentation') {
|
|
641
|
+
const v_error = (() => {
|
|
642
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
643
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
644
|
+
}
|
|
645
|
+
const obj_status = obj.status;
|
|
646
|
+
const path_status = path + '.status';
|
|
647
|
+
if (typeof obj_status !== 'string') {
|
|
648
|
+
return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
|
|
649
|
+
}
|
|
650
|
+
})();
|
|
651
|
+
return v_error === undefined ? null : v_error;
|
|
652
|
+
}
|
|
653
|
+
const RepresentationType = 'KnowledgeUpdateQuestionRepresentation';
|
|
654
|
+
function keyBuilder(luvio, config) {
|
|
655
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.id;
|
|
656
|
+
}
|
|
657
|
+
function keyBuilderFromType(luvio, object) {
|
|
658
|
+
const keyParams = {
|
|
659
|
+
id: object.status
|
|
660
|
+
};
|
|
661
|
+
return keyBuilder(luvio, keyParams);
|
|
662
|
+
}
|
|
663
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
664
|
+
return input;
|
|
665
|
+
}
|
|
666
|
+
const select$1 = function KnowledgeUpdateQuestionRepresentationSelect() {
|
|
667
|
+
return {
|
|
668
|
+
kind: 'Fragment',
|
|
669
|
+
version: VERSION,
|
|
670
|
+
private: [],
|
|
671
|
+
selections: [
|
|
672
|
+
{
|
|
673
|
+
name: 'status',
|
|
674
|
+
kind: 'Scalar'
|
|
675
|
+
}
|
|
676
|
+
]
|
|
677
|
+
};
|
|
678
|
+
};
|
|
679
|
+
function equals(existing, incoming) {
|
|
680
|
+
const existing_status = existing.status;
|
|
681
|
+
const incoming_status = incoming.status;
|
|
682
|
+
if (!(existing_status === incoming_status)) {
|
|
683
|
+
return false;
|
|
684
|
+
}
|
|
685
|
+
return true;
|
|
686
|
+
}
|
|
687
|
+
const ingest = function KnowledgeUpdateQuestionRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
688
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
689
|
+
const validateError = validate(input);
|
|
690
|
+
if (validateError !== null) {
|
|
691
|
+
throw validateError;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
const key = keyBuilderFromType(luvio, input);
|
|
695
|
+
const ttlToUse = TTL;
|
|
696
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "knowledge-questions", VERSION, RepresentationType, equals);
|
|
697
|
+
return createLink(key);
|
|
698
|
+
};
|
|
699
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
700
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
701
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
702
|
+
rootKeySet.set(rootKey, {
|
|
703
|
+
namespace: keyPrefix,
|
|
704
|
+
representationName: RepresentationType,
|
|
705
|
+
mergeable: false
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
function select(luvio, params) {
|
|
710
|
+
return select$1();
|
|
711
|
+
}
|
|
712
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
713
|
+
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
714
|
+
}
|
|
715
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
716
|
+
const { body } = response;
|
|
717
|
+
const key = keyBuilderFromType(luvio, body);
|
|
718
|
+
luvio.storeIngest(key, ingest, body);
|
|
719
|
+
const snapshot = luvio.storeLookup({
|
|
720
|
+
recordId: key,
|
|
721
|
+
node: select(),
|
|
722
|
+
variables: {},
|
|
723
|
+
});
|
|
724
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
725
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
726
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
deepFreeze(snapshot.data);
|
|
730
|
+
return snapshot;
|
|
731
|
+
}
|
|
732
|
+
function createResourceRequest(config) {
|
|
733
|
+
const headers = {};
|
|
734
|
+
return {
|
|
735
|
+
baseUri: '/services/data/v66.0',
|
|
736
|
+
basePath: '/connect/article/' + config.urlParams.recordId + '/questions/' + config.urlParams.questionId + '/selectioncount',
|
|
737
|
+
method: 'put',
|
|
738
|
+
body: null,
|
|
739
|
+
urlParams: config.urlParams,
|
|
740
|
+
queryParams: {},
|
|
741
|
+
headers,
|
|
742
|
+
priority: 'normal',
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
const adapterName = 'putKnowledgeUpdateQuestion';
|
|
747
|
+
const putKnowledgeUpdateQuestion_ConfigPropertyMetadata = [
|
|
748
|
+
generateParamConfigMetadata('recordId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
749
|
+
generateParamConfigMetadata('questionId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
750
|
+
];
|
|
751
|
+
const putKnowledgeUpdateQuestion_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, putKnowledgeUpdateQuestion_ConfigPropertyMetadata);
|
|
752
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$3(putKnowledgeUpdateQuestion_ConfigPropertyMetadata);
|
|
753
|
+
function typeCheckConfig(untrustedConfig) {
|
|
754
|
+
const config = {};
|
|
755
|
+
typeCheckConfig$3(untrustedConfig, config, putKnowledgeUpdateQuestion_ConfigPropertyMetadata);
|
|
756
|
+
return config;
|
|
757
|
+
}
|
|
758
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
759
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
760
|
+
return null;
|
|
761
|
+
}
|
|
762
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
763
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
764
|
+
}
|
|
765
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
766
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
767
|
+
return null;
|
|
768
|
+
}
|
|
769
|
+
return config;
|
|
770
|
+
}
|
|
771
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
772
|
+
const resourceParams = createResourceParams(config);
|
|
773
|
+
const request = createResourceRequest(resourceParams);
|
|
774
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
775
|
+
.then((response) => {
|
|
776
|
+
return luvio.handleSuccessResponse(() => {
|
|
777
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
778
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
779
|
+
}, () => {
|
|
780
|
+
const cache = new StoreKeyMap();
|
|
781
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
782
|
+
return cache;
|
|
783
|
+
});
|
|
784
|
+
}, (response) => {
|
|
785
|
+
deepFreeze(response);
|
|
786
|
+
throw response;
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
const putKnowledgeUpdateQuestionAdapterFactory = (luvio) => {
|
|
790
|
+
return function putKnowledgeUpdateQuestion(untrustedConfig) {
|
|
791
|
+
const config = validateAdapterConfig(untrustedConfig, putKnowledgeUpdateQuestion_ConfigPropertyNames);
|
|
792
|
+
// Invalid or incomplete config
|
|
793
|
+
if (config === null) {
|
|
794
|
+
throw new Error('Invalid config for "putKnowledgeUpdateQuestion"');
|
|
795
|
+
}
|
|
796
|
+
return buildNetworkSnapshot(luvio, config);
|
|
797
|
+
};
|
|
798
|
+
};
|
|
799
|
+
|
|
800
|
+
let getKnowledgeAnswer;
|
|
801
|
+
let getKnowledgeQuestionsGen;
|
|
802
|
+
let putKnowledgeUpdateQuestion;
|
|
803
|
+
// Imperative GET Adapters
|
|
804
|
+
let getKnowledgeQuestionsGen_imperative;
|
|
805
|
+
const getKnowledgeQuestionsGenMetadata = {
|
|
806
|
+
apiFamily: 'knowledgequestions',
|
|
807
|
+
name: 'getKnowledgeQuestionsGen',
|
|
808
|
+
ttl: 300,
|
|
809
|
+
};
|
|
810
|
+
// Notify Update Available
|
|
811
|
+
function bindExportsTo(luvio) {
|
|
812
|
+
// LDS Adapters
|
|
813
|
+
const getKnowledgeQuestionsGen_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getKnowledgeQuestionsGen', getKnowledgeQuestionsGenAdapterFactory), getKnowledgeQuestionsGenMetadata);
|
|
814
|
+
function unwrapSnapshotData(factory) {
|
|
815
|
+
const adapter = factory(luvio);
|
|
816
|
+
return (config) => adapter(config).then((snapshot) => snapshot.data);
|
|
817
|
+
}
|
|
818
|
+
return {
|
|
819
|
+
getKnowledgeAnswer: unwrapSnapshotData(getKnowledgeAnswerAdapterFactory),
|
|
820
|
+
getKnowledgeQuestionsGen: createWireAdapterConstructor(luvio, getKnowledgeQuestionsGen_ldsAdapter, getKnowledgeQuestionsGenMetadata),
|
|
821
|
+
putKnowledgeUpdateQuestion: unwrapSnapshotData(putKnowledgeUpdateQuestionAdapterFactory),
|
|
822
|
+
// Imperative GET Adapters
|
|
823
|
+
getKnowledgeQuestionsGen_imperative: createImperativeAdapter(luvio, getKnowledgeQuestionsGen_ldsAdapter, getKnowledgeQuestionsGenMetadata),
|
|
824
|
+
// Notify Update Availables
|
|
825
|
+
};
|
|
826
|
+
}
|
|
827
|
+
withDefaultLuvio((luvio) => {
|
|
828
|
+
({
|
|
829
|
+
getKnowledgeAnswer,
|
|
830
|
+
getKnowledgeQuestionsGen,
|
|
831
|
+
putKnowledgeUpdateQuestion,
|
|
832
|
+
getKnowledgeQuestionsGen_imperative,
|
|
833
|
+
} = bindExportsTo(luvio));
|
|
834
|
+
});
|
|
835
|
+
|
|
836
|
+
export { getKnowledgeAnswer, getKnowledgeQuestionsGen, getKnowledgeQuestionsGen_imperative, putKnowledgeUpdateQuestion };
|
|
837
|
+
// version: 0.1.0-dev1-c978a7b010
|