@salesforce/lds-adapters-industries-serviceprocess 0.131.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/industries-serviceprocess.js +490 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +66 -0
- package/dist/es/es2018/types/src/generated/adapters/getCaseServiceProcessLayoutData.d.ts +26 -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 +3 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectServiceExcellenceServiceCatalogRequestLayoutDataCaseById.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/types/AttributeRepresentation.d.ts +44 -0
- package/dist/es/es2018/types/src/generated/types/GenericObjectOutput.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/ServiceProcessRequestLayoutDataRepresentation.d.ts +39 -0
- package/dist/es/es2018/types/src/generated/types/SvcCatalogItemGroupRepresentation.d.ts +42 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +39 -0
- package/package.json +63 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +522 -0
- package/src/raml/api.raml +109 -0
- package/src/raml/luvio.raml +18 -0
package/sfdc/index.js
ADDED
|
@@ -0,0 +1,522 @@
|
|
|
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, StoreKeyMap } from 'force/luvioEngine';
|
|
18
|
+
|
|
19
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
20
|
+
const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = 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$1(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
|
+
const keyPrefix = 'serviceprocess';
|
|
62
|
+
|
|
63
|
+
const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
64
|
+
const { isArray: ArrayIsArray } = Array;
|
|
65
|
+
const { stringify: JSONStringify } = JSON;
|
|
66
|
+
function deepFreeze$4(value) {
|
|
67
|
+
// No need to freeze primitives
|
|
68
|
+
if (typeof value !== 'object' || value === null) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (ArrayIsArray(value)) {
|
|
72
|
+
for (let i = 0, len = value.length; i < len; i += 1) {
|
|
73
|
+
deepFreeze$4(value[i]);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
const keys = ObjectKeys(value);
|
|
78
|
+
for (let i = 0, len = keys.length; i < len; i += 1) {
|
|
79
|
+
deepFreeze$4(value[keys[i]]);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
ObjectFreeze(value);
|
|
83
|
+
}
|
|
84
|
+
function createLink(ref) {
|
|
85
|
+
return {
|
|
86
|
+
__ref: serializeStructuredKey(ref),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function validate$3(obj, path = 'GenericObjectOutput') {
|
|
91
|
+
const v_error = (() => {
|
|
92
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
93
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
94
|
+
}
|
|
95
|
+
const obj_value = obj.value;
|
|
96
|
+
const path_value = path + '.value';
|
|
97
|
+
if (obj_value === undefined) {
|
|
98
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_value + '" (at "' + path_value + '")');
|
|
99
|
+
}
|
|
100
|
+
})();
|
|
101
|
+
return v_error === undefined ? null : v_error;
|
|
102
|
+
}
|
|
103
|
+
function deepFreeze$3(input) {
|
|
104
|
+
const input_value = input.value;
|
|
105
|
+
deepFreeze$4(input_value);
|
|
106
|
+
ObjectFreeze(input);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function validate$2(obj, path = 'AttributeRepresentation') {
|
|
110
|
+
const v_error = (() => {
|
|
111
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
112
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
113
|
+
}
|
|
114
|
+
const obj_apiName = obj.apiName;
|
|
115
|
+
const path_apiName = path + '.apiName';
|
|
116
|
+
if (typeof obj_apiName !== 'string') {
|
|
117
|
+
return new TypeError('Expected "string" but received "' + typeof obj_apiName + '" (at "' + path_apiName + '")');
|
|
118
|
+
}
|
|
119
|
+
const obj_attributeId = obj.attributeId;
|
|
120
|
+
const path_attributeId = path + '.attributeId';
|
|
121
|
+
if (typeof obj_attributeId !== 'string') {
|
|
122
|
+
return new TypeError('Expected "string" but received "' + typeof obj_attributeId + '" (at "' + path_attributeId + '")');
|
|
123
|
+
}
|
|
124
|
+
const obj_attributeName = obj.attributeName;
|
|
125
|
+
const path_attributeName = path + '.attributeName';
|
|
126
|
+
if (typeof obj_attributeName !== 'string') {
|
|
127
|
+
return new TypeError('Expected "string" but received "' + typeof obj_attributeName + '" (at "' + path_attributeName + '")');
|
|
128
|
+
}
|
|
129
|
+
const obj_childAttributes = obj.childAttributes;
|
|
130
|
+
const path_childAttributes = path + '.childAttributes';
|
|
131
|
+
if (!ArrayIsArray(obj_childAttributes)) {
|
|
132
|
+
return new TypeError('Expected "array" but received "' + typeof obj_childAttributes + '" (at "' + path_childAttributes + '")');
|
|
133
|
+
}
|
|
134
|
+
for (let i = 0; i < obj_childAttributes.length; i++) {
|
|
135
|
+
const obj_childAttributes_item = obj_childAttributes[i];
|
|
136
|
+
const path_childAttributes_item = path_childAttributes + '[' + i + ']';
|
|
137
|
+
const referencepath_childAttributes_itemValidationError = validate$2(obj_childAttributes_item, path_childAttributes_item);
|
|
138
|
+
if (referencepath_childAttributes_itemValidationError !== null) {
|
|
139
|
+
let message = 'Object doesn\'t match AttributeRepresentation (at "' + path_childAttributes_item + '")\n';
|
|
140
|
+
message += referencepath_childAttributes_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
141
|
+
return new TypeError(message);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const obj_dataType = obj.dataType;
|
|
145
|
+
const path_dataType = path + '.dataType';
|
|
146
|
+
if (typeof obj_dataType !== 'string') {
|
|
147
|
+
return new TypeError('Expected "string" but received "' + typeof obj_dataType + '" (at "' + path_dataType + '")');
|
|
148
|
+
}
|
|
149
|
+
const obj_sortOrder = obj.sortOrder;
|
|
150
|
+
const path_sortOrder = path + '.sortOrder';
|
|
151
|
+
if (typeof obj_sortOrder !== 'string') {
|
|
152
|
+
return new TypeError('Expected "string" but received "' + typeof obj_sortOrder + '" (at "' + path_sortOrder + '")');
|
|
153
|
+
}
|
|
154
|
+
})();
|
|
155
|
+
return v_error === undefined ? null : v_error;
|
|
156
|
+
}
|
|
157
|
+
function deepFreeze$2(input) {
|
|
158
|
+
const input_childAttributes = input.childAttributes;
|
|
159
|
+
for (let i = 0; i < input_childAttributes.length; i++) {
|
|
160
|
+
const input_childAttributes_item = input_childAttributes[i];
|
|
161
|
+
deepFreeze$2(input_childAttributes_item);
|
|
162
|
+
}
|
|
163
|
+
ObjectFreeze(input_childAttributes);
|
|
164
|
+
ObjectFreeze(input);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function validate$1(obj, path = 'SvcCatalogItemGroupRepresentation') {
|
|
168
|
+
const v_error = (() => {
|
|
169
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
170
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
171
|
+
}
|
|
172
|
+
const obj_apiName = obj.apiName;
|
|
173
|
+
const path_apiName = path + '.apiName';
|
|
174
|
+
if (typeof obj_apiName !== 'string') {
|
|
175
|
+
return new TypeError('Expected "string" but received "' + typeof obj_apiName + '" (at "' + path_apiName + '")');
|
|
176
|
+
}
|
|
177
|
+
const obj_attributes = obj.attributes;
|
|
178
|
+
const path_attributes = path + '.attributes';
|
|
179
|
+
if (!ArrayIsArray(obj_attributes)) {
|
|
180
|
+
return new TypeError('Expected "array" but received "' + typeof obj_attributes + '" (at "' + path_attributes + '")');
|
|
181
|
+
}
|
|
182
|
+
for (let i = 0; i < obj_attributes.length; i++) {
|
|
183
|
+
const obj_attributes_item = obj_attributes[i];
|
|
184
|
+
const path_attributes_item = path_attributes + '[' + i + ']';
|
|
185
|
+
const referencepath_attributes_itemValidationError = validate$2(obj_attributes_item, path_attributes_item);
|
|
186
|
+
if (referencepath_attributes_itemValidationError !== null) {
|
|
187
|
+
let message = 'Object doesn\'t match AttributeRepresentation (at "' + path_attributes_item + '")\n';
|
|
188
|
+
message += referencepath_attributes_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
189
|
+
return new TypeError(message);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
const obj_groupId = obj.groupId;
|
|
193
|
+
const path_groupId = path + '.groupId';
|
|
194
|
+
if (typeof obj_groupId !== 'string') {
|
|
195
|
+
return new TypeError('Expected "string" but received "' + typeof obj_groupId + '" (at "' + path_groupId + '")');
|
|
196
|
+
}
|
|
197
|
+
const obj_groupName = obj.groupName;
|
|
198
|
+
const path_groupName = path + '.groupName';
|
|
199
|
+
if (typeof obj_groupName !== 'string') {
|
|
200
|
+
return new TypeError('Expected "string" but received "' + typeof obj_groupName + '" (at "' + path_groupName + '")');
|
|
201
|
+
}
|
|
202
|
+
const obj_sortOrder = obj.sortOrder;
|
|
203
|
+
const path_sortOrder = path + '.sortOrder';
|
|
204
|
+
if (typeof obj_sortOrder !== 'string') {
|
|
205
|
+
return new TypeError('Expected "string" but received "' + typeof obj_sortOrder + '" (at "' + path_sortOrder + '")');
|
|
206
|
+
}
|
|
207
|
+
})();
|
|
208
|
+
return v_error === undefined ? null : v_error;
|
|
209
|
+
}
|
|
210
|
+
function deepFreeze$1(input) {
|
|
211
|
+
const input_attributes = input.attributes;
|
|
212
|
+
for (let i = 0; i < input_attributes.length; i++) {
|
|
213
|
+
const input_attributes_item = input_attributes[i];
|
|
214
|
+
deepFreeze$2(input_attributes_item);
|
|
215
|
+
}
|
|
216
|
+
ObjectFreeze(input_attributes);
|
|
217
|
+
ObjectFreeze(input);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const TTL = 60000;
|
|
221
|
+
const VERSION = "3c93758e60084dd8896588d82c17fbbe";
|
|
222
|
+
function validate(obj, path = 'ServiceProcessRequestLayoutDataRepresentation') {
|
|
223
|
+
const v_error = (() => {
|
|
224
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
225
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
226
|
+
}
|
|
227
|
+
const obj_data = obj.data;
|
|
228
|
+
const path_data = path + '.data';
|
|
229
|
+
if (typeof obj_data !== 'object' || ArrayIsArray(obj_data) || obj_data === null) {
|
|
230
|
+
return new TypeError('Expected "object" but received "' + typeof obj_data + '" (at "' + path_data + '")');
|
|
231
|
+
}
|
|
232
|
+
const obj_data_keys = ObjectKeys(obj_data);
|
|
233
|
+
for (let i = 0; i < obj_data_keys.length; i++) {
|
|
234
|
+
const key = obj_data_keys[i];
|
|
235
|
+
const obj_data_prop = obj_data[key];
|
|
236
|
+
const path_data_prop = path_data + '["' + key + '"]';
|
|
237
|
+
const referencepath_data_propValidationError = validate$3(obj_data_prop, path_data_prop);
|
|
238
|
+
if (referencepath_data_propValidationError !== null) {
|
|
239
|
+
let message = 'Object doesn\'t match GenericObjectOutput (at "' + path_data_prop + '")\n';
|
|
240
|
+
message += referencepath_data_propValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
241
|
+
return new TypeError(message);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
const obj_groups = obj.groups;
|
|
245
|
+
const path_groups = path + '.groups';
|
|
246
|
+
if (!ArrayIsArray(obj_groups)) {
|
|
247
|
+
return new TypeError('Expected "array" but received "' + typeof obj_groups + '" (at "' + path_groups + '")');
|
|
248
|
+
}
|
|
249
|
+
for (let i = 0; i < obj_groups.length; i++) {
|
|
250
|
+
const obj_groups_item = obj_groups[i];
|
|
251
|
+
const path_groups_item = path_groups + '[' + i + ']';
|
|
252
|
+
const referencepath_groups_itemValidationError = validate$1(obj_groups_item, path_groups_item);
|
|
253
|
+
if (referencepath_groups_itemValidationError !== null) {
|
|
254
|
+
let message = 'Object doesn\'t match SvcCatalogItemGroupRepresentation (at "' + path_groups_item + '")\n';
|
|
255
|
+
message += referencepath_groups_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
256
|
+
return new TypeError(message);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
})();
|
|
260
|
+
return v_error === undefined ? null : v_error;
|
|
261
|
+
}
|
|
262
|
+
const RepresentationType = 'ServiceProcessRequestLayoutDataRepresentation';
|
|
263
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
264
|
+
return input;
|
|
265
|
+
}
|
|
266
|
+
const select$1 = function ServiceProcessRequestLayoutDataRepresentationSelect() {
|
|
267
|
+
return {
|
|
268
|
+
kind: 'Fragment',
|
|
269
|
+
version: VERSION,
|
|
270
|
+
private: [],
|
|
271
|
+
opaque: true
|
|
272
|
+
};
|
|
273
|
+
};
|
|
274
|
+
function equals(existing, incoming) {
|
|
275
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
return true;
|
|
279
|
+
}
|
|
280
|
+
function deepFreeze(input) {
|
|
281
|
+
const input_data = input.data;
|
|
282
|
+
const input_data_keys = Object.keys(input_data);
|
|
283
|
+
const input_data_length = input_data_keys.length;
|
|
284
|
+
for (let i = 0; i < input_data_length; i++) {
|
|
285
|
+
const key = input_data_keys[i];
|
|
286
|
+
const input_data_prop = input_data[key];
|
|
287
|
+
deepFreeze$3(input_data_prop);
|
|
288
|
+
}
|
|
289
|
+
ObjectFreeze(input_data);
|
|
290
|
+
const input_groups = input.groups;
|
|
291
|
+
for (let i = 0; i < input_groups.length; i++) {
|
|
292
|
+
const input_groups_item = input_groups[i];
|
|
293
|
+
deepFreeze$1(input_groups_item);
|
|
294
|
+
}
|
|
295
|
+
ObjectFreeze(input_groups);
|
|
296
|
+
ObjectFreeze(input);
|
|
297
|
+
}
|
|
298
|
+
const ingest = function ServiceProcessRequestLayoutDataRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
299
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
300
|
+
const validateError = validate(input);
|
|
301
|
+
if (validateError !== null) {
|
|
302
|
+
throw validateError;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
const key = path.fullPath;
|
|
306
|
+
const existingRecord = store.readEntry(key);
|
|
307
|
+
const ttlToUse = TTL;
|
|
308
|
+
let incomingRecord = normalize(input, store.readEntry(key), {
|
|
309
|
+
fullPath: key,
|
|
310
|
+
parent: path.parent,
|
|
311
|
+
propertyName: path.propertyName,
|
|
312
|
+
ttl: ttlToUse
|
|
313
|
+
});
|
|
314
|
+
deepFreeze(input);
|
|
315
|
+
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
316
|
+
luvio.storePublish(key, incomingRecord);
|
|
317
|
+
}
|
|
318
|
+
{
|
|
319
|
+
const storeMetadataParams = {
|
|
320
|
+
ttl: ttlToUse,
|
|
321
|
+
namespace: "serviceprocess",
|
|
322
|
+
version: VERSION,
|
|
323
|
+
representationName: RepresentationType,
|
|
324
|
+
};
|
|
325
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
326
|
+
}
|
|
327
|
+
return createLink(key);
|
|
328
|
+
};
|
|
329
|
+
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
330
|
+
const rootKeySet = new StoreKeyMap();
|
|
331
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
332
|
+
const rootKey = fullPathFactory();
|
|
333
|
+
rootKeySet.set(rootKey, {
|
|
334
|
+
namespace: keyPrefix,
|
|
335
|
+
representationName: RepresentationType,
|
|
336
|
+
mergeable: false
|
|
337
|
+
});
|
|
338
|
+
return rootKeySet;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
function select(luvio, params) {
|
|
342
|
+
return select$1();
|
|
343
|
+
}
|
|
344
|
+
function keyBuilder$1(luvio, params) {
|
|
345
|
+
return keyPrefix + '::ServiceProcessRequestLayoutDataRepresentation:(' + 'Id:' + params.urlParams.Id + ')';
|
|
346
|
+
}
|
|
347
|
+
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
348
|
+
return getTypeCacheKeys(luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
349
|
+
}
|
|
350
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
351
|
+
const { body } = response;
|
|
352
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
353
|
+
luvio.storeIngest(key, ingest, body);
|
|
354
|
+
const snapshot = luvio.storeLookup({
|
|
355
|
+
recordId: key,
|
|
356
|
+
node: select(),
|
|
357
|
+
variables: {},
|
|
358
|
+
}, snapshotRefresh);
|
|
359
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
360
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
361
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
return snapshot;
|
|
365
|
+
}
|
|
366
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
367
|
+
const key = keyBuilder$1(luvio, params);
|
|
368
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
369
|
+
const storeMetadataParams = {
|
|
370
|
+
ttl: TTL,
|
|
371
|
+
namespace: keyPrefix,
|
|
372
|
+
version: VERSION,
|
|
373
|
+
representationName: RepresentationType
|
|
374
|
+
};
|
|
375
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
376
|
+
return errorSnapshot;
|
|
377
|
+
}
|
|
378
|
+
function createResourceRequest(config) {
|
|
379
|
+
const headers = {};
|
|
380
|
+
return {
|
|
381
|
+
baseUri: '/services/data/v58.0',
|
|
382
|
+
basePath: '/connect/service-excellence/service-catalog-request/layout-data/case/' + config.urlParams.Id + '',
|
|
383
|
+
method: 'get',
|
|
384
|
+
body: null,
|
|
385
|
+
urlParams: config.urlParams,
|
|
386
|
+
queryParams: {},
|
|
387
|
+
headers,
|
|
388
|
+
priority: 'normal',
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
const getCaseServiceProcessLayoutData_ConfigPropertyNames = {
|
|
393
|
+
displayName: 'getCaseServiceProcessLayoutData',
|
|
394
|
+
parameters: {
|
|
395
|
+
required: ['Id'],
|
|
396
|
+
optional: []
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
function createResourceParams(config) {
|
|
400
|
+
const resourceParams = {
|
|
401
|
+
urlParams: {
|
|
402
|
+
Id: config.Id
|
|
403
|
+
}
|
|
404
|
+
};
|
|
405
|
+
return resourceParams;
|
|
406
|
+
}
|
|
407
|
+
function keyBuilder(luvio, config) {
|
|
408
|
+
const resourceParams = createResourceParams(config);
|
|
409
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
410
|
+
}
|
|
411
|
+
function typeCheckConfig(untrustedConfig) {
|
|
412
|
+
const config = {};
|
|
413
|
+
const untrustedConfig_Id = untrustedConfig.Id;
|
|
414
|
+
if (typeof untrustedConfig_Id === 'string') {
|
|
415
|
+
config.Id = untrustedConfig_Id;
|
|
416
|
+
}
|
|
417
|
+
return config;
|
|
418
|
+
}
|
|
419
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
420
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
421
|
+
return null;
|
|
422
|
+
}
|
|
423
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
424
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
425
|
+
}
|
|
426
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
427
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
428
|
+
return null;
|
|
429
|
+
}
|
|
430
|
+
return config;
|
|
431
|
+
}
|
|
432
|
+
function adapterFragment(luvio, config) {
|
|
433
|
+
createResourceParams(config);
|
|
434
|
+
return select();
|
|
435
|
+
}
|
|
436
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
437
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
438
|
+
config,
|
|
439
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
440
|
+
});
|
|
441
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
442
|
+
}
|
|
443
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
444
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
445
|
+
config,
|
|
446
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
447
|
+
});
|
|
448
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
449
|
+
}
|
|
450
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
451
|
+
const resourceParams = createResourceParams(config);
|
|
452
|
+
const request = createResourceRequest(resourceParams);
|
|
453
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
454
|
+
.then((response) => {
|
|
455
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys(luvio, resourceParams, response.body));
|
|
456
|
+
}, (response) => {
|
|
457
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
461
|
+
const { luvio, config } = context;
|
|
462
|
+
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
463
|
+
const dispatchOptions = {
|
|
464
|
+
resourceRequestContext: {
|
|
465
|
+
requestCorrelator,
|
|
466
|
+
luvioRequestMethod: undefined,
|
|
467
|
+
},
|
|
468
|
+
eventObservers
|
|
469
|
+
};
|
|
470
|
+
if (networkPriority !== 'normal') {
|
|
471
|
+
dispatchOptions.overrides = {
|
|
472
|
+
priority: networkPriority
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
return buildNetworkSnapshot(luvio, config, dispatchOptions);
|
|
476
|
+
}
|
|
477
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
478
|
+
const { luvio, config } = context;
|
|
479
|
+
const selector = {
|
|
480
|
+
recordId: keyBuilder(luvio, config),
|
|
481
|
+
node: adapterFragment(luvio, config),
|
|
482
|
+
variables: {},
|
|
483
|
+
};
|
|
484
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
485
|
+
config,
|
|
486
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
487
|
+
});
|
|
488
|
+
return cacheSnapshot;
|
|
489
|
+
}
|
|
490
|
+
const getCaseServiceProcessLayoutDataAdapterFactory = (luvio) => function serviceprocess__getCaseServiceProcessLayoutData(untrustedConfig, requestContext) {
|
|
491
|
+
const config = validateAdapterConfig(untrustedConfig, getCaseServiceProcessLayoutData_ConfigPropertyNames);
|
|
492
|
+
// Invalid or incomplete config
|
|
493
|
+
if (config === null) {
|
|
494
|
+
return null;
|
|
495
|
+
}
|
|
496
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
497
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
let getCaseServiceProcessLayoutData;
|
|
501
|
+
// Imperative GET Adapters
|
|
502
|
+
let getCaseServiceProcessLayoutData_imperative;
|
|
503
|
+
// Adapter Metadata
|
|
504
|
+
const getCaseServiceProcessLayoutDataMetadata = { apiFamily: 'serviceprocess', name: 'getCaseServiceProcessLayoutData', ttl: 60000 };
|
|
505
|
+
function bindExportsTo(luvio) {
|
|
506
|
+
// LDS Adapters
|
|
507
|
+
const getCaseServiceProcessLayoutData_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getCaseServiceProcessLayoutData', getCaseServiceProcessLayoutDataAdapterFactory), getCaseServiceProcessLayoutDataMetadata);
|
|
508
|
+
return {
|
|
509
|
+
getCaseServiceProcessLayoutData: createWireAdapterConstructor(luvio, getCaseServiceProcessLayoutData_ldsAdapter, getCaseServiceProcessLayoutDataMetadata),
|
|
510
|
+
// Imperative GET Adapters
|
|
511
|
+
getCaseServiceProcessLayoutData_imperative: createImperativeAdapter(luvio, getCaseServiceProcessLayoutData_ldsAdapter, getCaseServiceProcessLayoutDataMetadata)
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
withDefaultLuvio((luvio) => {
|
|
515
|
+
({
|
|
516
|
+
getCaseServiceProcessLayoutData,
|
|
517
|
+
getCaseServiceProcessLayoutData_imperative
|
|
518
|
+
} = bindExportsTo(luvio));
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
export { getCaseServiceProcessLayoutData, getCaseServiceProcessLayoutData_imperative };
|
|
522
|
+
// version: 0.131.0-c1ec5b7de
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
#%RAML 1.0
|
|
2
|
+
securedBy:
|
|
3
|
+
- OAuth2
|
|
4
|
+
title: Salesforce Connect API
|
|
5
|
+
version: '58.0'
|
|
6
|
+
mediaType: application/json
|
|
7
|
+
protocols:
|
|
8
|
+
- https
|
|
9
|
+
baseUri: /services/data/v58.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
|
+
AttributeRepresentation:
|
|
29
|
+
description: Service process attribute representation
|
|
30
|
+
type: object
|
|
31
|
+
properties:
|
|
32
|
+
apiName:
|
|
33
|
+
description: svc catalog item attribute api name
|
|
34
|
+
type: string
|
|
35
|
+
attributeId:
|
|
36
|
+
description: svc catalog item attribute id
|
|
37
|
+
type: string
|
|
38
|
+
attributeName:
|
|
39
|
+
description: svc catalog item attribute name
|
|
40
|
+
type: string
|
|
41
|
+
childAttributes:
|
|
42
|
+
description: svc catalog item attribute's child attributes
|
|
43
|
+
type: array
|
|
44
|
+
items:
|
|
45
|
+
type: AttributeRepresentation
|
|
46
|
+
dataType:
|
|
47
|
+
description: svc catalog item attribute data type
|
|
48
|
+
type: string
|
|
49
|
+
sortOrder:
|
|
50
|
+
description: svc catalog item attribute order
|
|
51
|
+
type: string
|
|
52
|
+
GenericObjectOutput:
|
|
53
|
+
description: Generic attributes value object
|
|
54
|
+
type: object
|
|
55
|
+
properties:
|
|
56
|
+
value:
|
|
57
|
+
description: Value
|
|
58
|
+
type: any
|
|
59
|
+
ServiceProcessRequestLayoutDataRepresentation:
|
|
60
|
+
description: Service process layout data output representation
|
|
61
|
+
type: object
|
|
62
|
+
properties:
|
|
63
|
+
data:
|
|
64
|
+
description: svc catalog request
|
|
65
|
+
type: object
|
|
66
|
+
properties:
|
|
67
|
+
//:
|
|
68
|
+
type: GenericObjectOutput
|
|
69
|
+
groups:
|
|
70
|
+
description: svc catalog item groups
|
|
71
|
+
type: array
|
|
72
|
+
items:
|
|
73
|
+
type: SvcCatalogItemGroupRepresentation
|
|
74
|
+
SvcCatalogItemGroupRepresentation:
|
|
75
|
+
description: Service process group representation
|
|
76
|
+
type: object
|
|
77
|
+
properties:
|
|
78
|
+
apiName:
|
|
79
|
+
description: svc catalog item group api name
|
|
80
|
+
type: string
|
|
81
|
+
attributes:
|
|
82
|
+
description: svc catalog item group attributes
|
|
83
|
+
type: array
|
|
84
|
+
items:
|
|
85
|
+
type: AttributeRepresentation
|
|
86
|
+
groupId:
|
|
87
|
+
description: svc catalog item group id
|
|
88
|
+
type: string
|
|
89
|
+
groupName:
|
|
90
|
+
description: svc catalog item group name
|
|
91
|
+
type: string
|
|
92
|
+
sortOrder:
|
|
93
|
+
description: svc catalog item group order
|
|
94
|
+
type: string
|
|
95
|
+
/connect/service-excellence/service-catalog-request:
|
|
96
|
+
/layout-data/case/{Id}:
|
|
97
|
+
get:
|
|
98
|
+
displayName: getServiceProcessLayoutData
|
|
99
|
+
description: get svc catalog request layout data
|
|
100
|
+
responses:
|
|
101
|
+
'200':
|
|
102
|
+
description: Success
|
|
103
|
+
body:
|
|
104
|
+
application/json:
|
|
105
|
+
type: ServiceProcessRequestLayoutDataRepresentation
|
|
106
|
+
uriParameters:
|
|
107
|
+
Id:
|
|
108
|
+
type: string
|
|
109
|
+
required: true
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#%RAML 1.0 Overlay
|
|
2
|
+
extends: ./api.raml
|
|
3
|
+
|
|
4
|
+
uses:
|
|
5
|
+
luvio: luvio://annotations.raml
|
|
6
|
+
|
|
7
|
+
(luvio.keyPrefix): 'serviceprocess'
|
|
8
|
+
(luvio.ttl): 360000
|
|
9
|
+
|
|
10
|
+
types:
|
|
11
|
+
ServiceProcessRequestLayoutDataRepresentation:
|
|
12
|
+
(luvio.ttl): 60000
|
|
13
|
+
(luvio.opaque): true
|
|
14
|
+
|
|
15
|
+
/connect/service-excellence/service-catalog-request/layout-data/case/{Id}:
|
|
16
|
+
get:
|
|
17
|
+
(luvio.adapter):
|
|
18
|
+
name: getCaseServiceProcessLayoutData
|