@salesforce/lds-adapters-industries-serviceprocess 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/industries-serviceprocess.js +662 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/fetchServiceProcessDefinition.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/adapters/getCaseServiceProcessLayoutData.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +2 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +5 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectServiceExcellenceServiceCatalogRequestLayoutDataCaseById.d.ts +18 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectServiceExcellenceServiceProcessDefinition.d.ts +17 -0
- package/dist/es/es2018/types/src/generated/types/AttributeRepresentation.d.ts +43 -0
- package/dist/es/es2018/types/src/generated/types/GenericObjectOutput.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/types/ServiceProcessDefinitionRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/ServiceProcessDependencyDetails.d.ts +32 -0
- package/dist/es/es2018/types/src/generated/types/ServiceProcessRequestLayoutDataRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/SvcCatalogItemGroupRepresentation.d.ts +41 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
- package/package.json +71 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +712 -0
- package/src/raml/api.raml +163 -0
- package/src/raml/luvio.raml +26 -0
|
@@ -0,0 +1,662 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$2, typeCheckConfig as typeCheckConfig$2, StoreKeyMap, createResourceParams as createResourceParams$2 } from '@luvio/engine';
|
|
8
|
+
|
|
9
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
10
|
+
const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
|
|
11
|
+
const { isArray: ArrayIsArray$1 } = Array;
|
|
12
|
+
/**
|
|
13
|
+
* Validates an adapter config is well-formed.
|
|
14
|
+
* @param config The config to validate.
|
|
15
|
+
* @param adapter The adapter validation configuration.
|
|
16
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
17
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
18
|
+
*/
|
|
19
|
+
function validateConfig(config, adapter, oneOf) {
|
|
20
|
+
const { displayName } = adapter;
|
|
21
|
+
const { required, optional, unsupported } = adapter.parameters;
|
|
22
|
+
if (config === undefined ||
|
|
23
|
+
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
24
|
+
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
25
|
+
}
|
|
26
|
+
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
27
|
+
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
28
|
+
}
|
|
29
|
+
if (unsupported !== undefined &&
|
|
30
|
+
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
31
|
+
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
32
|
+
}
|
|
33
|
+
const supported = required.concat(optional);
|
|
34
|
+
if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
|
|
35
|
+
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function untrustedIsObject(untrusted) {
|
|
39
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
40
|
+
}
|
|
41
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
42
|
+
return configPropertyNames.parameters.required.every(req => req in config);
|
|
43
|
+
}
|
|
44
|
+
const snapshotRefreshOptions = {
|
|
45
|
+
overrides: {
|
|
46
|
+
headers: {
|
|
47
|
+
'Cache-Control': 'no-cache',
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
|
|
52
|
+
return {
|
|
53
|
+
name,
|
|
54
|
+
required,
|
|
55
|
+
resourceType,
|
|
56
|
+
typeCheckShape,
|
|
57
|
+
isArrayShape,
|
|
58
|
+
coerceFn,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function buildAdapterValidationConfig(displayName, paramsMeta) {
|
|
62
|
+
const required = paramsMeta.filter(p => p.required).map(p => p.name);
|
|
63
|
+
const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
|
|
64
|
+
return {
|
|
65
|
+
displayName,
|
|
66
|
+
parameters: {
|
|
67
|
+
required,
|
|
68
|
+
optional,
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const keyPrefix = 'serviceprocess';
|
|
73
|
+
|
|
74
|
+
const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
75
|
+
const { isArray: ArrayIsArray } = Array;
|
|
76
|
+
const { stringify: JSONStringify } = JSON;
|
|
77
|
+
function createLink(ref) {
|
|
78
|
+
return {
|
|
79
|
+
__ref: serializeStructuredKey(ref),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function validate$5(obj, path = 'AttributeRepresentation') {
|
|
84
|
+
const v_error = (() => {
|
|
85
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
86
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
87
|
+
}
|
|
88
|
+
const obj_apiName = obj.apiName;
|
|
89
|
+
const path_apiName = path + '.apiName';
|
|
90
|
+
if (typeof obj_apiName !== 'string') {
|
|
91
|
+
return new TypeError('Expected "string" but received "' + typeof obj_apiName + '" (at "' + path_apiName + '")');
|
|
92
|
+
}
|
|
93
|
+
const obj_attributeId = obj.attributeId;
|
|
94
|
+
const path_attributeId = path + '.attributeId';
|
|
95
|
+
if (typeof obj_attributeId !== 'string') {
|
|
96
|
+
return new TypeError('Expected "string" but received "' + typeof obj_attributeId + '" (at "' + path_attributeId + '")');
|
|
97
|
+
}
|
|
98
|
+
const obj_attributeName = obj.attributeName;
|
|
99
|
+
const path_attributeName = path + '.attributeName';
|
|
100
|
+
if (typeof obj_attributeName !== 'string') {
|
|
101
|
+
return new TypeError('Expected "string" but received "' + typeof obj_attributeName + '" (at "' + path_attributeName + '")');
|
|
102
|
+
}
|
|
103
|
+
const obj_childAttributes = obj.childAttributes;
|
|
104
|
+
const path_childAttributes = path + '.childAttributes';
|
|
105
|
+
if (!ArrayIsArray(obj_childAttributes)) {
|
|
106
|
+
return new TypeError('Expected "array" but received "' + typeof obj_childAttributes + '" (at "' + path_childAttributes + '")');
|
|
107
|
+
}
|
|
108
|
+
for (let i = 0; i < obj_childAttributes.length; i++) {
|
|
109
|
+
const obj_childAttributes_item = obj_childAttributes[i];
|
|
110
|
+
const path_childAttributes_item = path_childAttributes + '[' + i + ']';
|
|
111
|
+
const referencepath_childAttributes_itemValidationError = validate$5(obj_childAttributes_item, path_childAttributes_item);
|
|
112
|
+
if (referencepath_childAttributes_itemValidationError !== null) {
|
|
113
|
+
let message = 'Object doesn\'t match AttributeRepresentation (at "' + path_childAttributes_item + '")\n';
|
|
114
|
+
message += referencepath_childAttributes_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
115
|
+
return new TypeError(message);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const obj_dataType = obj.dataType;
|
|
119
|
+
const path_dataType = path + '.dataType';
|
|
120
|
+
if (typeof obj_dataType !== 'string') {
|
|
121
|
+
return new TypeError('Expected "string" but received "' + typeof obj_dataType + '" (at "' + path_dataType + '")');
|
|
122
|
+
}
|
|
123
|
+
const obj_sortOrder = obj.sortOrder;
|
|
124
|
+
const path_sortOrder = path + '.sortOrder';
|
|
125
|
+
if (typeof obj_sortOrder !== 'string') {
|
|
126
|
+
return new TypeError('Expected "string" but received "' + typeof obj_sortOrder + '" (at "' + path_sortOrder + '")');
|
|
127
|
+
}
|
|
128
|
+
})();
|
|
129
|
+
return v_error === undefined ? null : v_error;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function validate$4(obj, path = 'GenericObjectOutput') {
|
|
133
|
+
const v_error = (() => {
|
|
134
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
135
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
136
|
+
}
|
|
137
|
+
const obj_value = obj.value;
|
|
138
|
+
const path_value = path + '.value';
|
|
139
|
+
if (obj_value === undefined) {
|
|
140
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_value + '" (at "' + path_value + '")');
|
|
141
|
+
}
|
|
142
|
+
})();
|
|
143
|
+
return v_error === undefined ? null : v_error;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function validate$3(obj, path = 'ServiceProcessDependencyDetails') {
|
|
147
|
+
const v_error = (() => {
|
|
148
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
149
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
150
|
+
}
|
|
151
|
+
const obj_details = obj.details;
|
|
152
|
+
const path_details = path + '.details';
|
|
153
|
+
const referencepath_detailsValidationError = validate$4(obj_details, path_details);
|
|
154
|
+
if (referencepath_detailsValidationError !== null) {
|
|
155
|
+
let message = 'Object doesn\'t match GenericObjectOutput (at "' + path_details + '")\n';
|
|
156
|
+
message += referencepath_detailsValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
157
|
+
return new TypeError(message);
|
|
158
|
+
}
|
|
159
|
+
const obj_type = obj.type;
|
|
160
|
+
const path_type = path + '.type';
|
|
161
|
+
if (typeof obj_type !== 'string') {
|
|
162
|
+
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
163
|
+
}
|
|
164
|
+
})();
|
|
165
|
+
return v_error === undefined ? null : v_error;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const TTL$1 = 300000;
|
|
169
|
+
const VERSION$1 = "33ba038f6b7bf9bf829de107f3cb7bfd";
|
|
170
|
+
function validate$2(obj, path = 'ServiceProcessDefinitionRepresentation') {
|
|
171
|
+
const v_error = (() => {
|
|
172
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
173
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
174
|
+
}
|
|
175
|
+
const obj_attributes = obj.attributes;
|
|
176
|
+
const path_attributes = path + '.attributes';
|
|
177
|
+
if (!ArrayIsArray(obj_attributes)) {
|
|
178
|
+
return new TypeError('Expected "array" but received "' + typeof obj_attributes + '" (at "' + path_attributes + '")');
|
|
179
|
+
}
|
|
180
|
+
for (let i = 0; i < obj_attributes.length; i++) {
|
|
181
|
+
const obj_attributes_item = obj_attributes[i];
|
|
182
|
+
const path_attributes_item = path_attributes + '[' + i + ']';
|
|
183
|
+
const referencepath_attributes_itemValidationError = validate$5(obj_attributes_item, path_attributes_item);
|
|
184
|
+
if (referencepath_attributes_itemValidationError !== null) {
|
|
185
|
+
let message = 'Object doesn\'t match AttributeRepresentation (at "' + path_attributes_item + '")\n';
|
|
186
|
+
message += referencepath_attributes_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
187
|
+
return new TypeError(message);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
const obj_serviceProcessDefinitionMap = obj.serviceProcessDefinitionMap;
|
|
191
|
+
const path_serviceProcessDefinitionMap = path + '.serviceProcessDefinitionMap';
|
|
192
|
+
if (typeof obj_serviceProcessDefinitionMap !== 'object' || ArrayIsArray(obj_serviceProcessDefinitionMap) || obj_serviceProcessDefinitionMap === null) {
|
|
193
|
+
return new TypeError('Expected "object" but received "' + typeof obj_serviceProcessDefinitionMap + '" (at "' + path_serviceProcessDefinitionMap + '")');
|
|
194
|
+
}
|
|
195
|
+
const obj_serviceProcessDefinitionMap_keys = ObjectKeys(obj_serviceProcessDefinitionMap);
|
|
196
|
+
for (let i = 0; i < obj_serviceProcessDefinitionMap_keys.length; i++) {
|
|
197
|
+
const key = obj_serviceProcessDefinitionMap_keys[i];
|
|
198
|
+
const obj_serviceProcessDefinitionMap_prop = obj_serviceProcessDefinitionMap[key];
|
|
199
|
+
const path_serviceProcessDefinitionMap_prop = path_serviceProcessDefinitionMap + '["' + key + '"]';
|
|
200
|
+
if (!ArrayIsArray(obj_serviceProcessDefinitionMap_prop)) {
|
|
201
|
+
return new TypeError('Expected "array" but received "' + typeof obj_serviceProcessDefinitionMap_prop + '" (at "' + path_serviceProcessDefinitionMap_prop + '")');
|
|
202
|
+
}
|
|
203
|
+
for (let i = 0; i < obj_serviceProcessDefinitionMap_prop.length; i++) {
|
|
204
|
+
const obj_serviceProcessDefinitionMap_prop_item = obj_serviceProcessDefinitionMap_prop[i];
|
|
205
|
+
const path_serviceProcessDefinitionMap_prop_item = path_serviceProcessDefinitionMap_prop + '[' + i + ']';
|
|
206
|
+
const referencepath_serviceProcessDefinitionMap_prop_itemValidationError = validate$3(obj_serviceProcessDefinitionMap_prop_item, path_serviceProcessDefinitionMap_prop_item);
|
|
207
|
+
if (referencepath_serviceProcessDefinitionMap_prop_itemValidationError !== null) {
|
|
208
|
+
let message = 'Object doesn\'t match ServiceProcessDependencyDetails (at "' + path_serviceProcessDefinitionMap_prop_item + '")\n';
|
|
209
|
+
message += referencepath_serviceProcessDefinitionMap_prop_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
210
|
+
return new TypeError(message);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
})();
|
|
215
|
+
return v_error === undefined ? null : v_error;
|
|
216
|
+
}
|
|
217
|
+
const RepresentationType$1 = 'ServiceProcessDefinitionRepresentation';
|
|
218
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
219
|
+
return input;
|
|
220
|
+
}
|
|
221
|
+
const select$3 = function ServiceProcessDefinitionRepresentationSelect() {
|
|
222
|
+
return {
|
|
223
|
+
kind: 'Fragment',
|
|
224
|
+
version: VERSION$1,
|
|
225
|
+
private: [],
|
|
226
|
+
opaque: true
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
function equals$1(existing, incoming) {
|
|
230
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
const ingest$1 = function ServiceProcessDefinitionRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
236
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
237
|
+
const validateError = validate$2(input);
|
|
238
|
+
if (validateError !== null) {
|
|
239
|
+
throw validateError;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
const key = path.fullPath;
|
|
243
|
+
const ttlToUse = TTL$1;
|
|
244
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "serviceprocess", VERSION$1, RepresentationType$1, equals$1);
|
|
245
|
+
return createLink(key);
|
|
246
|
+
};
|
|
247
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
248
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
249
|
+
const rootKey = fullPathFactory();
|
|
250
|
+
rootKeySet.set(rootKey, {
|
|
251
|
+
namespace: keyPrefix,
|
|
252
|
+
representationName: RepresentationType$1,
|
|
253
|
+
mergeable: false
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function select$2(luvio, params) {
|
|
258
|
+
return select$3();
|
|
259
|
+
}
|
|
260
|
+
function keyBuilder$3(luvio, params) {
|
|
261
|
+
return keyPrefix + '::ServiceProcessDefinitionRepresentation:(' + 'includeAttributes:' + params.queryParams.includeAttributes + ',' + 'productId:' + params.queryParams.productId + ',' + 'serviceProcessDefinitionId:' + params.queryParams.serviceProcessDefinitionId + ')';
|
|
262
|
+
}
|
|
263
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
264
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$3(luvio, resourceParams));
|
|
265
|
+
}
|
|
266
|
+
function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
267
|
+
const { body } = response;
|
|
268
|
+
const key = keyBuilder$3(luvio, resourceParams);
|
|
269
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
270
|
+
const snapshot = luvio.storeLookup({
|
|
271
|
+
recordId: key,
|
|
272
|
+
node: select$2(),
|
|
273
|
+
variables: {},
|
|
274
|
+
}, snapshotRefresh);
|
|
275
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
276
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
277
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
deepFreeze(snapshot.data);
|
|
281
|
+
return snapshot;
|
|
282
|
+
}
|
|
283
|
+
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
284
|
+
const key = keyBuilder$3(luvio, params);
|
|
285
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
286
|
+
const storeMetadataParams = {
|
|
287
|
+
ttl: TTL$1,
|
|
288
|
+
namespace: keyPrefix,
|
|
289
|
+
version: VERSION$1,
|
|
290
|
+
representationName: RepresentationType$1
|
|
291
|
+
};
|
|
292
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
293
|
+
return errorSnapshot;
|
|
294
|
+
}
|
|
295
|
+
function createResourceRequest$1(config) {
|
|
296
|
+
const headers = {};
|
|
297
|
+
return {
|
|
298
|
+
baseUri: '/services/data/v66.0',
|
|
299
|
+
basePath: '/connect/service-excellence/service-process-definition',
|
|
300
|
+
method: 'get',
|
|
301
|
+
body: null,
|
|
302
|
+
urlParams: {},
|
|
303
|
+
queryParams: config.queryParams,
|
|
304
|
+
headers,
|
|
305
|
+
priority: 'normal',
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
const adapterName$1 = 'fetchServiceProcessDefinition';
|
|
310
|
+
const fetchServiceProcessDefinition_ConfigPropertyMetadata = [
|
|
311
|
+
generateParamConfigMetadata('includeAttributes', false, 1 /* QueryParameter */, 1 /* Boolean */),
|
|
312
|
+
generateParamConfigMetadata('productId', false, 1 /* QueryParameter */, 0 /* String */),
|
|
313
|
+
generateParamConfigMetadata('serviceProcessDefinitionId', false, 1 /* QueryParameter */, 0 /* String */),
|
|
314
|
+
];
|
|
315
|
+
const fetchServiceProcessDefinition_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, fetchServiceProcessDefinition_ConfigPropertyMetadata);
|
|
316
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$2(fetchServiceProcessDefinition_ConfigPropertyMetadata);
|
|
317
|
+
function keyBuilder$2(luvio, config) {
|
|
318
|
+
const resourceParams = createResourceParams$1(config);
|
|
319
|
+
return keyBuilder$3(luvio, resourceParams);
|
|
320
|
+
}
|
|
321
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
322
|
+
const config = {};
|
|
323
|
+
typeCheckConfig$2(untrustedConfig, config, fetchServiceProcessDefinition_ConfigPropertyMetadata);
|
|
324
|
+
return config;
|
|
325
|
+
}
|
|
326
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
327
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
328
|
+
return null;
|
|
329
|
+
}
|
|
330
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
331
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
332
|
+
}
|
|
333
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
334
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
335
|
+
return null;
|
|
336
|
+
}
|
|
337
|
+
return config;
|
|
338
|
+
}
|
|
339
|
+
function adapterFragment$1(luvio, config) {
|
|
340
|
+
createResourceParams$1(config);
|
|
341
|
+
return select$2();
|
|
342
|
+
}
|
|
343
|
+
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
344
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
|
|
345
|
+
config,
|
|
346
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
347
|
+
});
|
|
348
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
349
|
+
}
|
|
350
|
+
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
351
|
+
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
352
|
+
config,
|
|
353
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
354
|
+
});
|
|
355
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
356
|
+
}
|
|
357
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
358
|
+
const resourceParams = createResourceParams$1(config);
|
|
359
|
+
const request = createResourceRequest$1(resourceParams);
|
|
360
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
361
|
+
.then((response) => {
|
|
362
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
|
|
363
|
+
const cache = new StoreKeyMap();
|
|
364
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
365
|
+
return cache;
|
|
366
|
+
});
|
|
367
|
+
}, (response) => {
|
|
368
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
372
|
+
return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
|
|
373
|
+
}
|
|
374
|
+
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
375
|
+
const { luvio, config } = context;
|
|
376
|
+
const selector = {
|
|
377
|
+
recordId: keyBuilder$2(luvio, config),
|
|
378
|
+
node: adapterFragment$1(luvio, config),
|
|
379
|
+
variables: {},
|
|
380
|
+
};
|
|
381
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
382
|
+
config,
|
|
383
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
384
|
+
});
|
|
385
|
+
return cacheSnapshot;
|
|
386
|
+
}
|
|
387
|
+
const fetchServiceProcessDefinitionAdapterFactory = (luvio) => function serviceprocess__fetchServiceProcessDefinition(untrustedConfig, requestContext) {
|
|
388
|
+
const config = validateAdapterConfig$1(untrustedConfig, fetchServiceProcessDefinition_ConfigPropertyNames);
|
|
389
|
+
// Invalid or incomplete config
|
|
390
|
+
if (config === null) {
|
|
391
|
+
return null;
|
|
392
|
+
}
|
|
393
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
394
|
+
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
function validate$1(obj, path = 'SvcCatalogItemGroupRepresentation') {
|
|
398
|
+
const v_error = (() => {
|
|
399
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
400
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
401
|
+
}
|
|
402
|
+
const obj_apiName = obj.apiName;
|
|
403
|
+
const path_apiName = path + '.apiName';
|
|
404
|
+
if (typeof obj_apiName !== 'string') {
|
|
405
|
+
return new TypeError('Expected "string" but received "' + typeof obj_apiName + '" (at "' + path_apiName + '")');
|
|
406
|
+
}
|
|
407
|
+
const obj_attributes = obj.attributes;
|
|
408
|
+
const path_attributes = path + '.attributes';
|
|
409
|
+
if (!ArrayIsArray(obj_attributes)) {
|
|
410
|
+
return new TypeError('Expected "array" but received "' + typeof obj_attributes + '" (at "' + path_attributes + '")');
|
|
411
|
+
}
|
|
412
|
+
for (let i = 0; i < obj_attributes.length; i++) {
|
|
413
|
+
const obj_attributes_item = obj_attributes[i];
|
|
414
|
+
const path_attributes_item = path_attributes + '[' + i + ']';
|
|
415
|
+
const referencepath_attributes_itemValidationError = validate$5(obj_attributes_item, path_attributes_item);
|
|
416
|
+
if (referencepath_attributes_itemValidationError !== null) {
|
|
417
|
+
let message = 'Object doesn\'t match AttributeRepresentation (at "' + path_attributes_item + '")\n';
|
|
418
|
+
message += referencepath_attributes_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
419
|
+
return new TypeError(message);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
const obj_groupId = obj.groupId;
|
|
423
|
+
const path_groupId = path + '.groupId';
|
|
424
|
+
if (typeof obj_groupId !== 'string') {
|
|
425
|
+
return new TypeError('Expected "string" but received "' + typeof obj_groupId + '" (at "' + path_groupId + '")');
|
|
426
|
+
}
|
|
427
|
+
const obj_groupName = obj.groupName;
|
|
428
|
+
const path_groupName = path + '.groupName';
|
|
429
|
+
if (typeof obj_groupName !== 'string') {
|
|
430
|
+
return new TypeError('Expected "string" but received "' + typeof obj_groupName + '" (at "' + path_groupName + '")');
|
|
431
|
+
}
|
|
432
|
+
const obj_sortOrder = obj.sortOrder;
|
|
433
|
+
const path_sortOrder = path + '.sortOrder';
|
|
434
|
+
if (typeof obj_sortOrder !== 'string') {
|
|
435
|
+
return new TypeError('Expected "string" but received "' + typeof obj_sortOrder + '" (at "' + path_sortOrder + '")');
|
|
436
|
+
}
|
|
437
|
+
})();
|
|
438
|
+
return v_error === undefined ? null : v_error;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
const TTL = 60000;
|
|
442
|
+
const VERSION = "3c93758e60084dd8896588d82c17fbbe";
|
|
443
|
+
function validate(obj, path = 'ServiceProcessRequestLayoutDataRepresentation') {
|
|
444
|
+
const v_error = (() => {
|
|
445
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
446
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
447
|
+
}
|
|
448
|
+
const obj_data = obj.data;
|
|
449
|
+
const path_data = path + '.data';
|
|
450
|
+
if (typeof obj_data !== 'object' || ArrayIsArray(obj_data) || obj_data === null) {
|
|
451
|
+
return new TypeError('Expected "object" but received "' + typeof obj_data + '" (at "' + path_data + '")');
|
|
452
|
+
}
|
|
453
|
+
const obj_data_keys = ObjectKeys(obj_data);
|
|
454
|
+
for (let i = 0; i < obj_data_keys.length; i++) {
|
|
455
|
+
const key = obj_data_keys[i];
|
|
456
|
+
const obj_data_prop = obj_data[key];
|
|
457
|
+
const path_data_prop = path_data + '["' + key + '"]';
|
|
458
|
+
const referencepath_data_propValidationError = validate$4(obj_data_prop, path_data_prop);
|
|
459
|
+
if (referencepath_data_propValidationError !== null) {
|
|
460
|
+
let message = 'Object doesn\'t match GenericObjectOutput (at "' + path_data_prop + '")\n';
|
|
461
|
+
message += referencepath_data_propValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
462
|
+
return new TypeError(message);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
const obj_groups = obj.groups;
|
|
466
|
+
const path_groups = path + '.groups';
|
|
467
|
+
if (!ArrayIsArray(obj_groups)) {
|
|
468
|
+
return new TypeError('Expected "array" but received "' + typeof obj_groups + '" (at "' + path_groups + '")');
|
|
469
|
+
}
|
|
470
|
+
for (let i = 0; i < obj_groups.length; i++) {
|
|
471
|
+
const obj_groups_item = obj_groups[i];
|
|
472
|
+
const path_groups_item = path_groups + '[' + i + ']';
|
|
473
|
+
const referencepath_groups_itemValidationError = validate$1(obj_groups_item, path_groups_item);
|
|
474
|
+
if (referencepath_groups_itemValidationError !== null) {
|
|
475
|
+
let message = 'Object doesn\'t match SvcCatalogItemGroupRepresentation (at "' + path_groups_item + '")\n';
|
|
476
|
+
message += referencepath_groups_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
477
|
+
return new TypeError(message);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
})();
|
|
481
|
+
return v_error === undefined ? null : v_error;
|
|
482
|
+
}
|
|
483
|
+
const RepresentationType = 'ServiceProcessRequestLayoutDataRepresentation';
|
|
484
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
485
|
+
return input;
|
|
486
|
+
}
|
|
487
|
+
const select$1 = function ServiceProcessRequestLayoutDataRepresentationSelect() {
|
|
488
|
+
return {
|
|
489
|
+
kind: 'Fragment',
|
|
490
|
+
version: VERSION,
|
|
491
|
+
private: [],
|
|
492
|
+
opaque: true
|
|
493
|
+
};
|
|
494
|
+
};
|
|
495
|
+
function equals(existing, incoming) {
|
|
496
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
497
|
+
return false;
|
|
498
|
+
}
|
|
499
|
+
return true;
|
|
500
|
+
}
|
|
501
|
+
const ingest = function ServiceProcessRequestLayoutDataRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
502
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
503
|
+
const validateError = validate(input);
|
|
504
|
+
if (validateError !== null) {
|
|
505
|
+
throw validateError;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
const key = path.fullPath;
|
|
509
|
+
const ttlToUse = TTL;
|
|
510
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "serviceprocess", VERSION, RepresentationType, equals);
|
|
511
|
+
return createLink(key);
|
|
512
|
+
};
|
|
513
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
514
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
515
|
+
const rootKey = fullPathFactory();
|
|
516
|
+
rootKeySet.set(rootKey, {
|
|
517
|
+
namespace: keyPrefix,
|
|
518
|
+
representationName: RepresentationType,
|
|
519
|
+
mergeable: false
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
function select(luvio, params) {
|
|
524
|
+
return select$1();
|
|
525
|
+
}
|
|
526
|
+
function keyBuilder$1(luvio, params) {
|
|
527
|
+
return keyPrefix + '::ServiceProcessRequestLayoutDataRepresentation:(' + 'showLookupAttributeDetails:' + params.queryParams.showLookupAttributeDetails + ',' + 'Id:' + params.urlParams.Id + ')';
|
|
528
|
+
}
|
|
529
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
530
|
+
getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
531
|
+
}
|
|
532
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
533
|
+
const { body } = response;
|
|
534
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
535
|
+
luvio.storeIngest(key, ingest, body);
|
|
536
|
+
const snapshot = luvio.storeLookup({
|
|
537
|
+
recordId: key,
|
|
538
|
+
node: select(),
|
|
539
|
+
variables: {},
|
|
540
|
+
}, snapshotRefresh);
|
|
541
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
542
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
543
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
deepFreeze(snapshot.data);
|
|
547
|
+
return snapshot;
|
|
548
|
+
}
|
|
549
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
550
|
+
const key = keyBuilder$1(luvio, params);
|
|
551
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
552
|
+
const storeMetadataParams = {
|
|
553
|
+
ttl: TTL,
|
|
554
|
+
namespace: keyPrefix,
|
|
555
|
+
version: VERSION,
|
|
556
|
+
representationName: RepresentationType
|
|
557
|
+
};
|
|
558
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
559
|
+
return errorSnapshot;
|
|
560
|
+
}
|
|
561
|
+
function createResourceRequest(config) {
|
|
562
|
+
const headers = {};
|
|
563
|
+
return {
|
|
564
|
+
baseUri: '/services/data/v66.0',
|
|
565
|
+
basePath: '/connect/service-excellence/service-catalog-request/layout-data/case/' + config.urlParams.Id + '',
|
|
566
|
+
method: 'get',
|
|
567
|
+
body: null,
|
|
568
|
+
urlParams: config.urlParams,
|
|
569
|
+
queryParams: config.queryParams,
|
|
570
|
+
headers,
|
|
571
|
+
priority: 'normal',
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
const adapterName = 'getCaseServiceProcessLayoutData';
|
|
576
|
+
const getCaseServiceProcessLayoutData_ConfigPropertyMetadata = [
|
|
577
|
+
generateParamConfigMetadata('Id', true, 0 /* UrlParameter */, 0 /* String */),
|
|
578
|
+
generateParamConfigMetadata('showLookupAttributeDetails', false, 1 /* QueryParameter */, 1 /* Boolean */),
|
|
579
|
+
];
|
|
580
|
+
const getCaseServiceProcessLayoutData_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getCaseServiceProcessLayoutData_ConfigPropertyMetadata);
|
|
581
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$2(getCaseServiceProcessLayoutData_ConfigPropertyMetadata);
|
|
582
|
+
function keyBuilder(luvio, config) {
|
|
583
|
+
const resourceParams = createResourceParams(config);
|
|
584
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
585
|
+
}
|
|
586
|
+
function typeCheckConfig(untrustedConfig) {
|
|
587
|
+
const config = {};
|
|
588
|
+
typeCheckConfig$2(untrustedConfig, config, getCaseServiceProcessLayoutData_ConfigPropertyMetadata);
|
|
589
|
+
return config;
|
|
590
|
+
}
|
|
591
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
592
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
593
|
+
return null;
|
|
594
|
+
}
|
|
595
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
596
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
597
|
+
}
|
|
598
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
599
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
600
|
+
return null;
|
|
601
|
+
}
|
|
602
|
+
return config;
|
|
603
|
+
}
|
|
604
|
+
function adapterFragment(luvio, config) {
|
|
605
|
+
createResourceParams(config);
|
|
606
|
+
return select();
|
|
607
|
+
}
|
|
608
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
609
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
610
|
+
config,
|
|
611
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
612
|
+
});
|
|
613
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
614
|
+
}
|
|
615
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
616
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
617
|
+
config,
|
|
618
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
619
|
+
});
|
|
620
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
621
|
+
}
|
|
622
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
623
|
+
const resourceParams = createResourceParams(config);
|
|
624
|
+
const request = createResourceRequest(resourceParams);
|
|
625
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
626
|
+
.then((response) => {
|
|
627
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
628
|
+
const cache = new StoreKeyMap();
|
|
629
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
630
|
+
return cache;
|
|
631
|
+
});
|
|
632
|
+
}, (response) => {
|
|
633
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
637
|
+
return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
|
|
638
|
+
}
|
|
639
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
640
|
+
const { luvio, config } = context;
|
|
641
|
+
const selector = {
|
|
642
|
+
recordId: keyBuilder(luvio, config),
|
|
643
|
+
node: adapterFragment(luvio, config),
|
|
644
|
+
variables: {},
|
|
645
|
+
};
|
|
646
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
647
|
+
config,
|
|
648
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
649
|
+
});
|
|
650
|
+
return cacheSnapshot;
|
|
651
|
+
}
|
|
652
|
+
const getCaseServiceProcessLayoutDataAdapterFactory = (luvio) => function serviceprocess__getCaseServiceProcessLayoutData(untrustedConfig, requestContext) {
|
|
653
|
+
const config = validateAdapterConfig(untrustedConfig, getCaseServiceProcessLayoutData_ConfigPropertyNames);
|
|
654
|
+
// Invalid or incomplete config
|
|
655
|
+
if (config === null) {
|
|
656
|
+
return null;
|
|
657
|
+
}
|
|
658
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
659
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
660
|
+
};
|
|
661
|
+
|
|
662
|
+
export { fetchServiceProcessDefinitionAdapterFactory, getCaseServiceProcessLayoutDataAdapterFactory };
|