@salesforce/lds-adapters-service-knowledgesummary 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-knowledgesummary.js +497 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/getKnowledgeSummary.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +1 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +4 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectSelfServiceKnowledgeSummaryByRecordId.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/types/KSGetDataOutputRepresentation.d.ts +41 -0
- package/dist/es/es2018/types/src/generated/types/KSGetDataResponseDataOutputRepresentation.d.ts +35 -0
- package/dist/es/es2018/types/src/generated/types/KSGetDataResponseErrorOutputRepresentation.d.ts +30 -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 +576 -0
- package/src/raml/api.raml +88 -0
- package/src/raml/luvio.raml +27 -0
package/sfdc/index.js
ADDED
|
@@ -0,0 +1,576 @@
|
|
|
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, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, typeCheckConfig as typeCheckConfig$1, createResourceParams as createResourceParams$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 = 'knowledgeSummary';
|
|
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$3 = "1dc3e82fcc3e40bd27e938f77ca5e7c5";
|
|
105
|
+
function validate$3(obj, path = 'KSGetDataResponseDataOutputRepresentation') {
|
|
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
|
+
const obj_isAiGenSummary = obj.isAiGenSummary;
|
|
111
|
+
const path_isAiGenSummary = path + '.isAiGenSummary';
|
|
112
|
+
if (typeof obj_isAiGenSummary !== 'boolean') {
|
|
113
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isAiGenSummary + '" (at "' + path_isAiGenSummary + '")');
|
|
114
|
+
}
|
|
115
|
+
const obj_recordId = obj.recordId;
|
|
116
|
+
const path_recordId = path + '.recordId';
|
|
117
|
+
if (typeof obj_recordId !== 'string') {
|
|
118
|
+
return new TypeError('Expected "string" but received "' + typeof obj_recordId + '" (at "' + path_recordId + '")');
|
|
119
|
+
}
|
|
120
|
+
const obj_summary = obj.summary;
|
|
121
|
+
const path_summary = path + '.summary';
|
|
122
|
+
if (typeof obj_summary !== 'string') {
|
|
123
|
+
return new TypeError('Expected "string" but received "' + typeof obj_summary + '" (at "' + path_summary + '")');
|
|
124
|
+
}
|
|
125
|
+
})();
|
|
126
|
+
return v_error === undefined ? null : v_error;
|
|
127
|
+
}
|
|
128
|
+
const select$4 = function KSGetDataResponseDataOutputRepresentationSelect() {
|
|
129
|
+
return {
|
|
130
|
+
kind: 'Fragment',
|
|
131
|
+
version: VERSION$3,
|
|
132
|
+
private: [],
|
|
133
|
+
selections: [
|
|
134
|
+
{
|
|
135
|
+
name: 'isAiGenSummary',
|
|
136
|
+
kind: 'Scalar'
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: 'recordId',
|
|
140
|
+
kind: 'Scalar'
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: 'summary',
|
|
144
|
+
kind: 'Scalar'
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
function equals$3(existing, incoming) {
|
|
150
|
+
const existing_isAiGenSummary = existing.isAiGenSummary;
|
|
151
|
+
const incoming_isAiGenSummary = incoming.isAiGenSummary;
|
|
152
|
+
if (!(existing_isAiGenSummary === incoming_isAiGenSummary)) {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
const existing_recordId = existing.recordId;
|
|
156
|
+
const incoming_recordId = incoming.recordId;
|
|
157
|
+
if (!(existing_recordId === incoming_recordId)) {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
const existing_summary = existing.summary;
|
|
161
|
+
const incoming_summary = incoming.summary;
|
|
162
|
+
if (!(existing_summary === incoming_summary)) {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const VERSION$2 = "b8f6393045dfea29d40a3bf281367dc1";
|
|
169
|
+
function validate$2(obj, path = 'SSKnowledgeErrorDetailsOutputRepresentation') {
|
|
170
|
+
const v_error = (() => {
|
|
171
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
172
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
173
|
+
}
|
|
174
|
+
const obj_code = obj.code;
|
|
175
|
+
const path_code = path + '.code';
|
|
176
|
+
if (typeof obj_code !== 'number' || (typeof obj_code === 'number' && Math.floor(obj_code) !== obj_code)) {
|
|
177
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_code + '" (at "' + path_code + '")');
|
|
178
|
+
}
|
|
179
|
+
const obj_message = obj.message;
|
|
180
|
+
const path_message = path + '.message';
|
|
181
|
+
if (typeof obj_message !== 'string') {
|
|
182
|
+
return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
183
|
+
}
|
|
184
|
+
})();
|
|
185
|
+
return v_error === undefined ? null : v_error;
|
|
186
|
+
}
|
|
187
|
+
const select$3 = function SSKnowledgeErrorDetailsOutputRepresentationSelect() {
|
|
188
|
+
return {
|
|
189
|
+
kind: 'Fragment',
|
|
190
|
+
version: VERSION$2,
|
|
191
|
+
private: [],
|
|
192
|
+
selections: [
|
|
193
|
+
{
|
|
194
|
+
name: 'code',
|
|
195
|
+
kind: 'Scalar'
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
name: 'message',
|
|
199
|
+
kind: 'Scalar'
|
|
200
|
+
}
|
|
201
|
+
]
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
function equals$2(existing, incoming) {
|
|
205
|
+
const existing_code = existing.code;
|
|
206
|
+
const incoming_code = incoming.code;
|
|
207
|
+
if (!(existing_code === incoming_code)) {
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
const existing_message = existing.message;
|
|
211
|
+
const incoming_message = incoming.message;
|
|
212
|
+
if (!(existing_message === incoming_message)) {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const VERSION$1 = "d16b4de04de2390988e29e5269b43f9b";
|
|
219
|
+
function validate$1(obj, path = 'KSGetDataResponseErrorOutputRepresentation') {
|
|
220
|
+
const v_error = (() => {
|
|
221
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
222
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
223
|
+
}
|
|
224
|
+
const obj_errors = obj.errors;
|
|
225
|
+
const path_errors = path + '.errors';
|
|
226
|
+
if (!ArrayIsArray(obj_errors)) {
|
|
227
|
+
return new TypeError('Expected "array" but received "' + typeof obj_errors + '" (at "' + path_errors + '")');
|
|
228
|
+
}
|
|
229
|
+
for (let i = 0; i < obj_errors.length; i++) {
|
|
230
|
+
const obj_errors_item = obj_errors[i];
|
|
231
|
+
const path_errors_item = path_errors + '[' + i + ']';
|
|
232
|
+
const referencepath_errors_itemValidationError = validate$2(obj_errors_item, path_errors_item);
|
|
233
|
+
if (referencepath_errors_itemValidationError !== null) {
|
|
234
|
+
let message = 'Object doesn\'t match SSKnowledgeErrorDetailsOutputRepresentation (at "' + path_errors_item + '")\n';
|
|
235
|
+
message += referencepath_errors_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
236
|
+
return new TypeError(message);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
})();
|
|
240
|
+
return v_error === undefined ? null : v_error;
|
|
241
|
+
}
|
|
242
|
+
const select$2 = function KSGetDataResponseErrorOutputRepresentationSelect() {
|
|
243
|
+
const { selections: SSKnowledgeErrorDetailsOutputRepresentation__selections, opaque: SSKnowledgeErrorDetailsOutputRepresentation__opaque, } = select$3();
|
|
244
|
+
return {
|
|
245
|
+
kind: 'Fragment',
|
|
246
|
+
version: VERSION$1,
|
|
247
|
+
private: [],
|
|
248
|
+
selections: [
|
|
249
|
+
{
|
|
250
|
+
name: 'errors',
|
|
251
|
+
kind: 'Object',
|
|
252
|
+
plural: true,
|
|
253
|
+
selections: SSKnowledgeErrorDetailsOutputRepresentation__selections
|
|
254
|
+
}
|
|
255
|
+
]
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
function equals$1(existing, incoming) {
|
|
259
|
+
const existing_errors = existing.errors;
|
|
260
|
+
const incoming_errors = incoming.errors;
|
|
261
|
+
const equals_errors_items = equalsArray(existing_errors, incoming_errors, (existing_errors_item, incoming_errors_item) => {
|
|
262
|
+
if (!(equals$2(existing_errors_item, incoming_errors_item))) {
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
if (equals_errors_items === false) {
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
|
+
return true;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
const TTL = 300;
|
|
273
|
+
const VERSION = "85837dbdb6482172ae8f1424d946d292";
|
|
274
|
+
function validate(obj, path = 'KSGetDataOutputRepresentation') {
|
|
275
|
+
const v_error = (() => {
|
|
276
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
277
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
278
|
+
}
|
|
279
|
+
const obj_data = obj.data;
|
|
280
|
+
const path_data = path + '.data';
|
|
281
|
+
const referencepath_dataValidationError = validate$3(obj_data, path_data);
|
|
282
|
+
if (referencepath_dataValidationError !== null) {
|
|
283
|
+
let message = 'Object doesn\'t match KSGetDataResponseDataOutputRepresentation (at "' + path_data + '")\n';
|
|
284
|
+
message += referencepath_dataValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
285
|
+
return new TypeError(message);
|
|
286
|
+
}
|
|
287
|
+
const obj_error = obj.error;
|
|
288
|
+
const path_error = path + '.error';
|
|
289
|
+
const referencepath_errorValidationError = validate$1(obj_error, path_error);
|
|
290
|
+
if (referencepath_errorValidationError !== null) {
|
|
291
|
+
let message = 'Object doesn\'t match KSGetDataResponseErrorOutputRepresentation (at "' + path_error + '")\n';
|
|
292
|
+
message += referencepath_errorValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
293
|
+
return new TypeError(message);
|
|
294
|
+
}
|
|
295
|
+
})();
|
|
296
|
+
return v_error === undefined ? null : v_error;
|
|
297
|
+
}
|
|
298
|
+
const RepresentationType = 'KSGetDataOutputRepresentation';
|
|
299
|
+
function keyBuilder$2(luvio, config) {
|
|
300
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.id;
|
|
301
|
+
}
|
|
302
|
+
function keyBuilderFromType(luvio, object) {
|
|
303
|
+
const keyParams = {
|
|
304
|
+
id: object.data.recordId
|
|
305
|
+
};
|
|
306
|
+
return keyBuilder$2(luvio, keyParams);
|
|
307
|
+
}
|
|
308
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
309
|
+
return input;
|
|
310
|
+
}
|
|
311
|
+
const select$1 = function KSGetDataOutputRepresentationSelect() {
|
|
312
|
+
const { selections: KSGetDataResponseDataOutputRepresentation__selections, opaque: KSGetDataResponseDataOutputRepresentation__opaque, } = select$4();
|
|
313
|
+
const { selections: KSGetDataResponseErrorOutputRepresentation__selections, opaque: KSGetDataResponseErrorOutputRepresentation__opaque, } = select$2();
|
|
314
|
+
return {
|
|
315
|
+
kind: 'Fragment',
|
|
316
|
+
version: VERSION,
|
|
317
|
+
private: [],
|
|
318
|
+
selections: [
|
|
319
|
+
{
|
|
320
|
+
name: 'data',
|
|
321
|
+
kind: 'Object',
|
|
322
|
+
selections: KSGetDataResponseDataOutputRepresentation__selections
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
name: 'error',
|
|
326
|
+
kind: 'Object',
|
|
327
|
+
selections: KSGetDataResponseErrorOutputRepresentation__selections
|
|
328
|
+
}
|
|
329
|
+
]
|
|
330
|
+
};
|
|
331
|
+
};
|
|
332
|
+
function equals(existing, incoming) {
|
|
333
|
+
const existing_data = existing.data;
|
|
334
|
+
const incoming_data = incoming.data;
|
|
335
|
+
if (!(equals$3(existing_data, incoming_data))) {
|
|
336
|
+
return false;
|
|
337
|
+
}
|
|
338
|
+
const existing_error = existing.error;
|
|
339
|
+
const incoming_error = incoming.error;
|
|
340
|
+
if (!(equals$1(existing_error, incoming_error))) {
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
return true;
|
|
344
|
+
}
|
|
345
|
+
const ingest = function KSGetDataOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
346
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
347
|
+
const validateError = validate(input);
|
|
348
|
+
if (validateError !== null) {
|
|
349
|
+
throw validateError;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
const key = keyBuilderFromType(luvio, input);
|
|
353
|
+
const ttlToUse = TTL;
|
|
354
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "knowledgeSummary", VERSION, RepresentationType, equals);
|
|
355
|
+
return createLink(key);
|
|
356
|
+
};
|
|
357
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
358
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
359
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
360
|
+
rootKeySet.set(rootKey, {
|
|
361
|
+
namespace: keyPrefix,
|
|
362
|
+
representationName: RepresentationType,
|
|
363
|
+
mergeable: false
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function select(luvio, params) {
|
|
368
|
+
return select$1();
|
|
369
|
+
}
|
|
370
|
+
function keyBuilder$1(luvio, params) {
|
|
371
|
+
return keyBuilder$2(luvio, {
|
|
372
|
+
id: params.urlParams.recordId
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
376
|
+
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
377
|
+
}
|
|
378
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
379
|
+
const { body } = response;
|
|
380
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
381
|
+
luvio.storeIngest(key, ingest, body);
|
|
382
|
+
const snapshot = luvio.storeLookup({
|
|
383
|
+
recordId: key,
|
|
384
|
+
node: select(),
|
|
385
|
+
variables: {},
|
|
386
|
+
}, snapshotRefresh);
|
|
387
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
388
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
389
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
deepFreeze(snapshot.data);
|
|
393
|
+
return snapshot;
|
|
394
|
+
}
|
|
395
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
396
|
+
const key = keyBuilder$1(luvio, params);
|
|
397
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
398
|
+
const storeMetadataParams = {
|
|
399
|
+
ttl: TTL,
|
|
400
|
+
namespace: keyPrefix,
|
|
401
|
+
version: VERSION,
|
|
402
|
+
representationName: RepresentationType
|
|
403
|
+
};
|
|
404
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
405
|
+
return errorSnapshot;
|
|
406
|
+
}
|
|
407
|
+
function createResourceRequest(config) {
|
|
408
|
+
const headers = {};
|
|
409
|
+
return {
|
|
410
|
+
baseUri: '/services/data/v65.0',
|
|
411
|
+
basePath: '/connect/self-service/knowledge/summary/' + config.urlParams.recordId + '',
|
|
412
|
+
method: 'get',
|
|
413
|
+
body: null,
|
|
414
|
+
urlParams: config.urlParams,
|
|
415
|
+
queryParams: {},
|
|
416
|
+
headers,
|
|
417
|
+
priority: 'normal',
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
function createResourceRequestFromRepresentation(representation) {
|
|
421
|
+
const config = {
|
|
422
|
+
urlParams: {},
|
|
423
|
+
};
|
|
424
|
+
config.urlParams.recordId = representation.data.recordId;
|
|
425
|
+
return createResourceRequest(config);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
const adapterName = 'getKnowledgeSummary';
|
|
429
|
+
const getKnowledgeSummary_ConfigPropertyMetadata = [
|
|
430
|
+
generateParamConfigMetadata('recordId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
431
|
+
];
|
|
432
|
+
const getKnowledgeSummary_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getKnowledgeSummary_ConfigPropertyMetadata);
|
|
433
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$1(getKnowledgeSummary_ConfigPropertyMetadata);
|
|
434
|
+
function keyBuilder(luvio, config) {
|
|
435
|
+
const resourceParams = createResourceParams(config);
|
|
436
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
437
|
+
}
|
|
438
|
+
function typeCheckConfig(untrustedConfig) {
|
|
439
|
+
const config = {};
|
|
440
|
+
typeCheckConfig$1(untrustedConfig, config, getKnowledgeSummary_ConfigPropertyMetadata);
|
|
441
|
+
return config;
|
|
442
|
+
}
|
|
443
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
444
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
445
|
+
return null;
|
|
446
|
+
}
|
|
447
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
448
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
449
|
+
}
|
|
450
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
451
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
452
|
+
return null;
|
|
453
|
+
}
|
|
454
|
+
return config;
|
|
455
|
+
}
|
|
456
|
+
function adapterFragment(luvio, config) {
|
|
457
|
+
createResourceParams(config);
|
|
458
|
+
return select();
|
|
459
|
+
}
|
|
460
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
461
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
462
|
+
config,
|
|
463
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
464
|
+
});
|
|
465
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
466
|
+
}
|
|
467
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
468
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
469
|
+
config,
|
|
470
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
471
|
+
});
|
|
472
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
473
|
+
}
|
|
474
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
475
|
+
const resourceParams = createResourceParams(config);
|
|
476
|
+
const request = createResourceRequest(resourceParams);
|
|
477
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
478
|
+
.then((response) => {
|
|
479
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
480
|
+
const cache = new StoreKeyMap();
|
|
481
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
482
|
+
return cache;
|
|
483
|
+
});
|
|
484
|
+
}, (response) => {
|
|
485
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
489
|
+
return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
|
|
490
|
+
}
|
|
491
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
492
|
+
const { luvio, config } = context;
|
|
493
|
+
const selector = {
|
|
494
|
+
recordId: keyBuilder(luvio, config),
|
|
495
|
+
node: adapterFragment(luvio, config),
|
|
496
|
+
variables: {},
|
|
497
|
+
};
|
|
498
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
499
|
+
config,
|
|
500
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
501
|
+
});
|
|
502
|
+
return cacheSnapshot;
|
|
503
|
+
}
|
|
504
|
+
const getKnowledgeSummaryAdapterFactory = (luvio) => function knowledgeSummary__getKnowledgeSummary(untrustedConfig, requestContext) {
|
|
505
|
+
const config = validateAdapterConfig(untrustedConfig, getKnowledgeSummary_ConfigPropertyNames);
|
|
506
|
+
// Invalid or incomplete config
|
|
507
|
+
if (config === null) {
|
|
508
|
+
return null;
|
|
509
|
+
}
|
|
510
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
511
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
512
|
+
};
|
|
513
|
+
const notifyChangeFactory = (luvio, options) => {
|
|
514
|
+
return function getConnectSelfServiceKnowledgeSummaryByRecordIdNotifyChange(configs) {
|
|
515
|
+
const keys = configs.map(c => keyBuilder$2(luvio, c));
|
|
516
|
+
luvio.getNotifyChangeStoreEntries(keys).then(entries => {
|
|
517
|
+
for (let i = 0, len = entries.length; i < len; i++) {
|
|
518
|
+
const { key, record: val } = entries[i];
|
|
519
|
+
const refreshRequest = createResourceRequestFromRepresentation(val);
|
|
520
|
+
luvio.dispatchResourceRequest(refreshRequest, options)
|
|
521
|
+
.then((response) => {
|
|
522
|
+
return luvio.handleSuccessResponse(() => {
|
|
523
|
+
const { body } = response;
|
|
524
|
+
luvio.storeIngest(key, ingest, body);
|
|
525
|
+
return luvio.storeBroadcast();
|
|
526
|
+
}, () => {
|
|
527
|
+
const cache = new StoreKeyMap();
|
|
528
|
+
getTypeCacheKeys(cache, luvio, response.body);
|
|
529
|
+
return cache;
|
|
530
|
+
});
|
|
531
|
+
}, (error) => {
|
|
532
|
+
return luvio.handleErrorResponse(() => {
|
|
533
|
+
const errorSnapshot = luvio.errorSnapshot(error);
|
|
534
|
+
luvio.storeIngestError(key, errorSnapshot, {
|
|
535
|
+
ttl: TTL,
|
|
536
|
+
namespace: keyPrefix,
|
|
537
|
+
version: VERSION,
|
|
538
|
+
representationName: RepresentationType
|
|
539
|
+
});
|
|
540
|
+
return luvio.storeBroadcast().then(() => errorSnapshot);
|
|
541
|
+
});
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
};
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
let getKnowledgeSummary;
|
|
549
|
+
let getKnowledgeSummaryNotifyChange;
|
|
550
|
+
// Imperative GET Adapters
|
|
551
|
+
let getKnowledgeSummary_imperative;
|
|
552
|
+
// Adapter Metadata
|
|
553
|
+
const getKnowledgeSummaryMetadata = {
|
|
554
|
+
apiFamily: 'knowledgeSummary',
|
|
555
|
+
name: 'getKnowledgeSummary',
|
|
556
|
+
ttl: 300,
|
|
557
|
+
};
|
|
558
|
+
// Notify Update Available
|
|
559
|
+
function bindExportsTo(luvio) {
|
|
560
|
+
// LDS Adapters
|
|
561
|
+
const getKnowledgeSummary_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getKnowledgeSummary', getKnowledgeSummaryAdapterFactory), getKnowledgeSummaryMetadata);
|
|
562
|
+
return {
|
|
563
|
+
getKnowledgeSummary: createWireAdapterConstructor(luvio, getKnowledgeSummary_ldsAdapter, getKnowledgeSummaryMetadata),
|
|
564
|
+
getKnowledgeSummaryNotifyChange: createLDSAdapter(luvio, 'getKnowledgeSummaryNotifyChange', notifyChangeFactory),
|
|
565
|
+
// Imperative GET Adapters
|
|
566
|
+
getKnowledgeSummary_imperative: createImperativeAdapter(luvio, getKnowledgeSummary_ldsAdapter, getKnowledgeSummaryMetadata),
|
|
567
|
+
// Notify Update Availables
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
withDefaultLuvio((luvio) => {
|
|
571
|
+
({ getKnowledgeSummary, getKnowledgeSummaryNotifyChange, getKnowledgeSummary_imperative } =
|
|
572
|
+
bindExportsTo(luvio));
|
|
573
|
+
});
|
|
574
|
+
|
|
575
|
+
export { getKnowledgeSummary, getKnowledgeSummaryNotifyChange, getKnowledgeSummary_imperative };
|
|
576
|
+
// version: 1.366.0-bf15f04cce
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#%RAML 1.0
|
|
2
|
+
securedBy:
|
|
3
|
+
- OAuth2
|
|
4
|
+
title: Salesforce Connect API
|
|
5
|
+
version: '65.0'
|
|
6
|
+
mediaType: application/json
|
|
7
|
+
protocols:
|
|
8
|
+
- https
|
|
9
|
+
baseUri: /services/data/v65.0
|
|
10
|
+
securitySchemes:
|
|
11
|
+
OAuth2:
|
|
12
|
+
type: OAuth 2.0
|
|
13
|
+
settings:
|
|
14
|
+
authorizationUri: https://example.com/oauth/authorize
|
|
15
|
+
accessTokenUri: ''
|
|
16
|
+
authorizationGrants:
|
|
17
|
+
- implicit
|
|
18
|
+
annotationTypes:
|
|
19
|
+
oas-readOnly:
|
|
20
|
+
type: boolean
|
|
21
|
+
allowedTargets: TypeDeclaration
|
|
22
|
+
oas-collectionFormat:
|
|
23
|
+
type: string
|
|
24
|
+
oas-body-name:
|
|
25
|
+
type: string
|
|
26
|
+
allowedTargets: TypeDeclaration
|
|
27
|
+
types:
|
|
28
|
+
SSKnowledgeErrorDetailsOutputRepresentation:
|
|
29
|
+
description: Error Message Representation
|
|
30
|
+
type: object
|
|
31
|
+
properties:
|
|
32
|
+
code:
|
|
33
|
+
description: Get Error Code
|
|
34
|
+
type: integer
|
|
35
|
+
message:
|
|
36
|
+
description: Get Error Message
|
|
37
|
+
type: string
|
|
38
|
+
|
|
39
|
+
KSGetDataOutputRepresentation:
|
|
40
|
+
description: Knowledge Summary Connect API GET Endpoint Output Representation
|
|
41
|
+
type: object
|
|
42
|
+
properties:
|
|
43
|
+
data:
|
|
44
|
+
description: Data node containing record details in a flat structure.
|
|
45
|
+
type: KSGetDataResponseDataOutputRepresentation
|
|
46
|
+
error:
|
|
47
|
+
description: Error node containing error details.
|
|
48
|
+
type: KSGetDataResponseErrorOutputRepresentation
|
|
49
|
+
KSGetDataResponseDataOutputRepresentation:
|
|
50
|
+
description: Knowledge Summary Connect API GET Endpoint Data Output Representation
|
|
51
|
+
type: object
|
|
52
|
+
properties:
|
|
53
|
+
isAiGenSummary:
|
|
54
|
+
description: Describes whether the summary generated by AI
|
|
55
|
+
type: boolean
|
|
56
|
+
recordId:
|
|
57
|
+
description: Record ID of the object
|
|
58
|
+
type: string
|
|
59
|
+
summary:
|
|
60
|
+
description: Summary of the article
|
|
61
|
+
type: string
|
|
62
|
+
KSGetDataResponseErrorOutputRepresentation:
|
|
63
|
+
description: Knowledge Summary Connect API GET Endpoint Error Output Representation
|
|
64
|
+
type: object
|
|
65
|
+
properties:
|
|
66
|
+
errors:
|
|
67
|
+
description: List containing any error details encountered during the connect
|
|
68
|
+
request
|
|
69
|
+
type: array
|
|
70
|
+
items:
|
|
71
|
+
type: SSKnowledgeErrorDetailsOutputRepresentation
|
|
72
|
+
|
|
73
|
+
/connect:
|
|
74
|
+
/self-service/knowledge:
|
|
75
|
+
/summary/{recordId}:
|
|
76
|
+
get:
|
|
77
|
+
displayName: getKnowledgeSummary
|
|
78
|
+
description: Get the knowledge article summary
|
|
79
|
+
responses:
|
|
80
|
+
'200':
|
|
81
|
+
description: Success
|
|
82
|
+
body:
|
|
83
|
+
application/json:
|
|
84
|
+
type: KSGetDataOutputRepresentation
|
|
85
|
+
uriParameters:
|
|
86
|
+
recordId:
|
|
87
|
+
type: string
|
|
88
|
+
required: true
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#%RAML 1.0 Overlay
|
|
2
|
+
extends: ./api.raml
|
|
3
|
+
|
|
4
|
+
uses:
|
|
5
|
+
luvio: luvio://annotations.raml
|
|
6
|
+
|
|
7
|
+
(luvio.keyPrefix): 'knowledgeSummary'
|
|
8
|
+
(luvio.ttl): 900000
|
|
9
|
+
|
|
10
|
+
types:
|
|
11
|
+
KSGetDataOutputRepresentation:
|
|
12
|
+
(luvio.ttl): 300
|
|
13
|
+
(luvio.key):
|
|
14
|
+
id: data.recordId
|
|
15
|
+
KSGetDataResponseDataOutputRepresentation:
|
|
16
|
+
(luvio.ttl): 300
|
|
17
|
+
KSGetDataResponseErrorOutputRepresentation:
|
|
18
|
+
(luvio.ttl): 300
|
|
19
|
+
SSKnowledgeErrorDetailsOutputRepresentation:
|
|
20
|
+
(luvio.ttl): 300
|
|
21
|
+
|
|
22
|
+
/connect/self-service/knowledge/summary/{recordId}:
|
|
23
|
+
get:
|
|
24
|
+
(luvio.adapter):
|
|
25
|
+
name: getKnowledgeSummary
|
|
26
|
+
(luvio.key):
|
|
27
|
+
id: urlParams.recordId
|