@salesforce/lds-adapters-industries-serviceprocess 1.100.2
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 +494 -0
- package/dist/types/src/generated/adapters/adapter-utils.d.ts +66 -0
- package/dist/types/src/generated/adapters/getCaseServiceProcessLayoutData.d.ts +26 -0
- package/dist/types/src/generated/artifacts/main.d.ts +1 -0
- package/dist/types/src/generated/artifacts/sfdc.d.ts +3 -0
- package/dist/types/src/generated/resources/getConnectServiceExcellenceServiceCatalogRequestLayoutDataCaseById.d.ts +15 -0
- package/dist/types/src/generated/types/AttributeRepresentation.d.ts +44 -0
- package/dist/types/src/generated/types/GenericObjectOutput.d.ts +29 -0
- package/dist/types/src/generated/types/SectionRepresentation.d.ts +42 -0
- package/dist/types/src/generated/types/ServiceCatalogRequestDataRepresentation.d.ts +34 -0
- package/dist/types/src/generated/types/ServiceProcessRequestLayoutDataRepresentation.d.ts +35 -0
- package/dist/types/src/generated/types/type-utils.d.ts +39 -0
- package/dist/umd/es2018/industries-serviceprocess.js +502 -0
- package/dist/umd/es5/industries-serviceprocess.js +507 -0
- package/package.json +64 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +526 -0
- package/src/raml/api.raml +115 -0
- package/src/raml/luvio.raml +18 -0
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
(function (global, factory) {
|
|
8
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@luvio/engine')) :
|
|
9
|
+
typeof define === 'function' && define.amd ? define(['exports', '@luvio/engine'], factory) :
|
|
10
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.industriesServiceprocess = {}, global.engine));
|
|
11
|
+
})(this, (function (exports, engine) { 'use strict';
|
|
12
|
+
|
|
13
|
+
var ObjectPrototypeHasOwnProperty = Object.prototype.hasOwnProperty;
|
|
14
|
+
var ObjectKeys$1 = Object.keys;
|
|
15
|
+
var ArrayIsArray$1 = Array.isArray;
|
|
16
|
+
/**
|
|
17
|
+
* Validates an adapter config is well-formed.
|
|
18
|
+
* @param config The config to validate.
|
|
19
|
+
* @param adapter The adapter validation configuration.
|
|
20
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
21
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
22
|
+
*/
|
|
23
|
+
function validateConfig(config, adapter, oneOf) {
|
|
24
|
+
var displayName = adapter.displayName;
|
|
25
|
+
var _a = adapter.parameters, required = _a.required, optional = _a.optional, unsupported = _a.unsupported;
|
|
26
|
+
if (config === undefined ||
|
|
27
|
+
required.every(function (req) { return ObjectPrototypeHasOwnProperty.call(config, req); }) === false) {
|
|
28
|
+
throw new TypeError("adapter ".concat(displayName, " configuration must specify ").concat(required.sort().join(', ')));
|
|
29
|
+
}
|
|
30
|
+
if (oneOf && oneOf.some(function (req) { return ObjectPrototypeHasOwnProperty.call(config, req); }) === false) {
|
|
31
|
+
throw new TypeError("adapter ".concat(displayName, " configuration must specify one of ").concat(oneOf.sort().join(', ')));
|
|
32
|
+
}
|
|
33
|
+
if (unsupported !== undefined &&
|
|
34
|
+
unsupported.some(function (req) { return ObjectPrototypeHasOwnProperty.call(config, req); })) {
|
|
35
|
+
throw new TypeError("adapter ".concat(displayName, " does not yet support ").concat(unsupported.sort().join(', ')));
|
|
36
|
+
}
|
|
37
|
+
var supported = required.concat(optional);
|
|
38
|
+
if (ObjectKeys$1(config).some(function (key) { return !supported.includes(key); })) {
|
|
39
|
+
throw new TypeError("adapter ".concat(displayName, " configuration supports only ").concat(supported.sort().join(', ')));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function untrustedIsObject(untrusted) {
|
|
43
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
44
|
+
}
|
|
45
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
46
|
+
return configPropertyNames.parameters.required.every(function (req) { return req in config; });
|
|
47
|
+
}
|
|
48
|
+
var snapshotRefreshOptions = {
|
|
49
|
+
overrides: {
|
|
50
|
+
headers: {
|
|
51
|
+
'Cache-Control': 'no-cache',
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
var keyPrefix = 'serviceprocess';
|
|
56
|
+
|
|
57
|
+
var ObjectFreeze = Object.freeze, ObjectKeys = Object.keys;
|
|
58
|
+
var ArrayIsArray = Array.isArray;
|
|
59
|
+
var JSONStringify = JSON.stringify;
|
|
60
|
+
function createLink(ref) {
|
|
61
|
+
return {
|
|
62
|
+
__ref: engine.serializeStructuredKey(ref),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function validate$4(obj, path) {
|
|
67
|
+
if (path === void 0) { path = 'GenericObjectOutput'; }
|
|
68
|
+
var v_error = (function () {
|
|
69
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
70
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
71
|
+
}
|
|
72
|
+
var obj_value = obj.value;
|
|
73
|
+
var path_value = path + '.value';
|
|
74
|
+
if (typeof obj_value !== 'object' || ArrayIsArray(obj_value) || obj_value === null) {
|
|
75
|
+
return new TypeError('Expected "object" but received "' + typeof obj_value + '" (at "' + path_value + '")');
|
|
76
|
+
}
|
|
77
|
+
})();
|
|
78
|
+
return v_error === undefined ? null : v_error;
|
|
79
|
+
}
|
|
80
|
+
function deepFreeze$4(input) {
|
|
81
|
+
var input_value = input.value;
|
|
82
|
+
ObjectFreeze(input_value);
|
|
83
|
+
ObjectFreeze(input);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function validate$3(obj, path) {
|
|
87
|
+
if (path === void 0) { path = 'ServiceCatalogRequestDataRepresentation'; }
|
|
88
|
+
var v_error = (function () {
|
|
89
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
90
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
91
|
+
}
|
|
92
|
+
var obj_data = obj.data;
|
|
93
|
+
var path_data = path + '.data';
|
|
94
|
+
if (typeof obj_data !== 'object' || ArrayIsArray(obj_data) || obj_data === null) {
|
|
95
|
+
return new TypeError('Expected "object" but received "' + typeof obj_data + '" (at "' + path_data + '")');
|
|
96
|
+
}
|
|
97
|
+
var obj_data_keys = ObjectKeys(obj_data);
|
|
98
|
+
for (var i = 0; i < obj_data_keys.length; i++) {
|
|
99
|
+
var key = obj_data_keys[i];
|
|
100
|
+
var obj_data_prop = obj_data[key];
|
|
101
|
+
var path_data_prop = path_data + '["' + key + '"]';
|
|
102
|
+
var referencepath_data_propValidationError = validate$4(obj_data_prop, path_data_prop);
|
|
103
|
+
if (referencepath_data_propValidationError !== null) {
|
|
104
|
+
var message = 'Object doesn\'t match GenericObjectOutput (at "' + path_data_prop + '")\n';
|
|
105
|
+
message += referencepath_data_propValidationError.message.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
106
|
+
return new TypeError(message);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
})();
|
|
110
|
+
return v_error === undefined ? null : v_error;
|
|
111
|
+
}
|
|
112
|
+
function deepFreeze$3(input) {
|
|
113
|
+
var input_data = input.data;
|
|
114
|
+
var input_data_keys = Object.keys(input_data);
|
|
115
|
+
var input_data_length = input_data_keys.length;
|
|
116
|
+
for (var i = 0; i < input_data_length; i++) {
|
|
117
|
+
var key = input_data_keys[i];
|
|
118
|
+
var input_data_prop = input_data[key];
|
|
119
|
+
deepFreeze$4(input_data_prop);
|
|
120
|
+
}
|
|
121
|
+
ObjectFreeze(input_data);
|
|
122
|
+
ObjectFreeze(input);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function validate$2(obj, path) {
|
|
126
|
+
if (path === void 0) { path = 'AttributeRepresentation'; }
|
|
127
|
+
var v_error = (function () {
|
|
128
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
129
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
130
|
+
}
|
|
131
|
+
var obj_apiName = obj.apiName;
|
|
132
|
+
var path_apiName = path + '.apiName';
|
|
133
|
+
if (typeof obj_apiName !== 'string') {
|
|
134
|
+
return new TypeError('Expected "string" but received "' + typeof obj_apiName + '" (at "' + path_apiName + '")');
|
|
135
|
+
}
|
|
136
|
+
var obj_attributeId = obj.attributeId;
|
|
137
|
+
var path_attributeId = path + '.attributeId';
|
|
138
|
+
if (typeof obj_attributeId !== 'string') {
|
|
139
|
+
return new TypeError('Expected "string" but received "' + typeof obj_attributeId + '" (at "' + path_attributeId + '")');
|
|
140
|
+
}
|
|
141
|
+
var obj_attributeName = obj.attributeName;
|
|
142
|
+
var path_attributeName = path + '.attributeName';
|
|
143
|
+
if (typeof obj_attributeName !== 'string') {
|
|
144
|
+
return new TypeError('Expected "string" but received "' + typeof obj_attributeName + '" (at "' + path_attributeName + '")');
|
|
145
|
+
}
|
|
146
|
+
var obj_childAttributes = obj.childAttributes;
|
|
147
|
+
var path_childAttributes = path + '.childAttributes';
|
|
148
|
+
if (!ArrayIsArray(obj_childAttributes)) {
|
|
149
|
+
return new TypeError('Expected "array" but received "' + typeof obj_childAttributes + '" (at "' + path_childAttributes + '")');
|
|
150
|
+
}
|
|
151
|
+
for (var i = 0; i < obj_childAttributes.length; i++) {
|
|
152
|
+
var obj_childAttributes_item = obj_childAttributes[i];
|
|
153
|
+
var path_childAttributes_item = path_childAttributes + '[' + i + ']';
|
|
154
|
+
var referencepath_childAttributes_itemValidationError = validate$2(obj_childAttributes_item, path_childAttributes_item);
|
|
155
|
+
if (referencepath_childAttributes_itemValidationError !== null) {
|
|
156
|
+
var message = 'Object doesn\'t match AttributeRepresentation (at "' + path_childAttributes_item + '")\n';
|
|
157
|
+
message += referencepath_childAttributes_itemValidationError.message.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
158
|
+
return new TypeError(message);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
var obj_dataType = obj.dataType;
|
|
162
|
+
var path_dataType = path + '.dataType';
|
|
163
|
+
if (typeof obj_dataType !== 'string') {
|
|
164
|
+
return new TypeError('Expected "string" but received "' + typeof obj_dataType + '" (at "' + path_dataType + '")');
|
|
165
|
+
}
|
|
166
|
+
var obj_sortOrder = obj.sortOrder;
|
|
167
|
+
var path_sortOrder = path + '.sortOrder';
|
|
168
|
+
if (typeof obj_sortOrder !== 'string') {
|
|
169
|
+
return new TypeError('Expected "string" but received "' + typeof obj_sortOrder + '" (at "' + path_sortOrder + '")');
|
|
170
|
+
}
|
|
171
|
+
})();
|
|
172
|
+
return v_error === undefined ? null : v_error;
|
|
173
|
+
}
|
|
174
|
+
function deepFreeze$2(input) {
|
|
175
|
+
var input_childAttributes = input.childAttributes;
|
|
176
|
+
for (var i = 0; i < input_childAttributes.length; i++) {
|
|
177
|
+
var input_childAttributes_item = input_childAttributes[i];
|
|
178
|
+
deepFreeze$2(input_childAttributes_item);
|
|
179
|
+
}
|
|
180
|
+
ObjectFreeze(input_childAttributes);
|
|
181
|
+
ObjectFreeze(input);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function validate$1(obj, path) {
|
|
185
|
+
if (path === void 0) { path = 'SectionRepresentation'; }
|
|
186
|
+
var v_error = (function () {
|
|
187
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
188
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
189
|
+
}
|
|
190
|
+
var obj_apiName = obj.apiName;
|
|
191
|
+
var path_apiName = path + '.apiName';
|
|
192
|
+
if (typeof obj_apiName !== 'string') {
|
|
193
|
+
return new TypeError('Expected "string" but received "' + typeof obj_apiName + '" (at "' + path_apiName + '")');
|
|
194
|
+
}
|
|
195
|
+
var obj_attributes = obj.attributes;
|
|
196
|
+
var path_attributes = path + '.attributes';
|
|
197
|
+
if (!ArrayIsArray(obj_attributes)) {
|
|
198
|
+
return new TypeError('Expected "array" but received "' + typeof obj_attributes + '" (at "' + path_attributes + '")');
|
|
199
|
+
}
|
|
200
|
+
for (var i = 0; i < obj_attributes.length; i++) {
|
|
201
|
+
var obj_attributes_item = obj_attributes[i];
|
|
202
|
+
var path_attributes_item = path_attributes + '[' + i + ']';
|
|
203
|
+
var referencepath_attributes_itemValidationError = validate$2(obj_attributes_item, path_attributes_item);
|
|
204
|
+
if (referencepath_attributes_itemValidationError !== null) {
|
|
205
|
+
var message = 'Object doesn\'t match AttributeRepresentation (at "' + path_attributes_item + '")\n';
|
|
206
|
+
message += referencepath_attributes_itemValidationError.message.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
207
|
+
return new TypeError(message);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
var obj_sectionId = obj.sectionId;
|
|
211
|
+
var path_sectionId = path + '.sectionId';
|
|
212
|
+
if (typeof obj_sectionId !== 'string') {
|
|
213
|
+
return new TypeError('Expected "string" but received "' + typeof obj_sectionId + '" (at "' + path_sectionId + '")');
|
|
214
|
+
}
|
|
215
|
+
var obj_sectionName = obj.sectionName;
|
|
216
|
+
var path_sectionName = path + '.sectionName';
|
|
217
|
+
if (typeof obj_sectionName !== 'string') {
|
|
218
|
+
return new TypeError('Expected "string" but received "' + typeof obj_sectionName + '" (at "' + path_sectionName + '")');
|
|
219
|
+
}
|
|
220
|
+
var obj_sectionOrder = obj.sectionOrder;
|
|
221
|
+
var path_sectionOrder = path + '.sectionOrder';
|
|
222
|
+
if (typeof obj_sectionOrder !== 'string') {
|
|
223
|
+
return new TypeError('Expected "string" but received "' + typeof obj_sectionOrder + '" (at "' + path_sectionOrder + '")');
|
|
224
|
+
}
|
|
225
|
+
})();
|
|
226
|
+
return v_error === undefined ? null : v_error;
|
|
227
|
+
}
|
|
228
|
+
function deepFreeze$1(input) {
|
|
229
|
+
var input_attributes = input.attributes;
|
|
230
|
+
for (var i = 0; i < input_attributes.length; i++) {
|
|
231
|
+
var input_attributes_item = input_attributes[i];
|
|
232
|
+
deepFreeze$2(input_attributes_item);
|
|
233
|
+
}
|
|
234
|
+
ObjectFreeze(input_attributes);
|
|
235
|
+
ObjectFreeze(input);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
var TTL = 60000;
|
|
239
|
+
var VERSION = "07b60c128d5c52337e1ff98961cd73e6";
|
|
240
|
+
function validate(obj, path) {
|
|
241
|
+
if (path === void 0) { path = 'ServiceProcessRequestLayoutDataRepresentation'; }
|
|
242
|
+
var v_error = (function () {
|
|
243
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
244
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
245
|
+
}
|
|
246
|
+
var obj_data = obj.data;
|
|
247
|
+
var path_data = path + '.data';
|
|
248
|
+
var referencepath_dataValidationError = validate$3(obj_data, path_data);
|
|
249
|
+
if (referencepath_dataValidationError !== null) {
|
|
250
|
+
var message = 'Object doesn\'t match ServiceCatalogRequestDataRepresentation (at "' + path_data + '")\n';
|
|
251
|
+
message += referencepath_dataValidationError.message.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
252
|
+
return new TypeError(message);
|
|
253
|
+
}
|
|
254
|
+
var obj_sections = obj.sections;
|
|
255
|
+
var path_sections = path + '.sections';
|
|
256
|
+
if (!ArrayIsArray(obj_sections)) {
|
|
257
|
+
return new TypeError('Expected "array" but received "' + typeof obj_sections + '" (at "' + path_sections + '")');
|
|
258
|
+
}
|
|
259
|
+
for (var i = 0; i < obj_sections.length; i++) {
|
|
260
|
+
var obj_sections_item = obj_sections[i];
|
|
261
|
+
var path_sections_item = path_sections + '[' + i + ']';
|
|
262
|
+
var referencepath_sections_itemValidationError = validate$1(obj_sections_item, path_sections_item);
|
|
263
|
+
if (referencepath_sections_itemValidationError !== null) {
|
|
264
|
+
var message = 'Object doesn\'t match SectionRepresentation (at "' + path_sections_item + '")\n';
|
|
265
|
+
message += referencepath_sections_itemValidationError.message.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
266
|
+
return new TypeError(message);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
})();
|
|
270
|
+
return v_error === undefined ? null : v_error;
|
|
271
|
+
}
|
|
272
|
+
var RepresentationType = 'ServiceProcessRequestLayoutDataRepresentation';
|
|
273
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
274
|
+
return input;
|
|
275
|
+
}
|
|
276
|
+
var select$1 = function ServiceProcessRequestLayoutDataRepresentationSelect() {
|
|
277
|
+
return {
|
|
278
|
+
kind: 'Fragment',
|
|
279
|
+
version: VERSION,
|
|
280
|
+
private: [],
|
|
281
|
+
opaque: true
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
function equals(existing, incoming) {
|
|
285
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
return true;
|
|
289
|
+
}
|
|
290
|
+
function deepFreeze(input) {
|
|
291
|
+
var input_data = input.data;
|
|
292
|
+
deepFreeze$3(input_data);
|
|
293
|
+
var input_sections = input.sections;
|
|
294
|
+
for (var i = 0; i < input_sections.length; i++) {
|
|
295
|
+
var input_sections_item = input_sections[i];
|
|
296
|
+
deepFreeze$1(input_sections_item);
|
|
297
|
+
}
|
|
298
|
+
ObjectFreeze(input_sections);
|
|
299
|
+
ObjectFreeze(input);
|
|
300
|
+
}
|
|
301
|
+
var ingest = function ServiceProcessRequestLayoutDataRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
302
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
303
|
+
var validateError = validate(input);
|
|
304
|
+
if (validateError !== null) {
|
|
305
|
+
throw validateError;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
var key = path.fullPath;
|
|
309
|
+
var existingRecord = store.readEntry(key);
|
|
310
|
+
var ttlToUse = TTL;
|
|
311
|
+
var incomingRecord = normalize(input, store.readEntry(key), {
|
|
312
|
+
fullPath: key,
|
|
313
|
+
parent: path.parent,
|
|
314
|
+
propertyName: path.propertyName,
|
|
315
|
+
ttl: ttlToUse
|
|
316
|
+
});
|
|
317
|
+
deepFreeze(input);
|
|
318
|
+
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
319
|
+
luvio.storePublish(key, incomingRecord);
|
|
320
|
+
}
|
|
321
|
+
{
|
|
322
|
+
var storeMetadataParams = {
|
|
323
|
+
ttl: ttlToUse,
|
|
324
|
+
namespace: "serviceprocess",
|
|
325
|
+
version: VERSION,
|
|
326
|
+
representationName: RepresentationType,
|
|
327
|
+
};
|
|
328
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
329
|
+
}
|
|
330
|
+
return createLink(key);
|
|
331
|
+
};
|
|
332
|
+
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
333
|
+
var rootKeySet = new engine.StoreKeyMap();
|
|
334
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
335
|
+
var rootKey = fullPathFactory();
|
|
336
|
+
rootKeySet.set(rootKey, {
|
|
337
|
+
namespace: keyPrefix,
|
|
338
|
+
representationName: RepresentationType,
|
|
339
|
+
mergeable: false
|
|
340
|
+
});
|
|
341
|
+
return rootKeySet;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
function select(luvio, params) {
|
|
345
|
+
return select$1();
|
|
346
|
+
}
|
|
347
|
+
function keyBuilder$1(luvio, params) {
|
|
348
|
+
return keyPrefix + '::ServiceProcessRequestLayoutDataRepresentation:(' + 'Id:' + params.urlParams.Id + ')';
|
|
349
|
+
}
|
|
350
|
+
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
351
|
+
return getTypeCacheKeys(luvio, response, function () { return keyBuilder$1(luvio, resourceParams); });
|
|
352
|
+
}
|
|
353
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
354
|
+
var body = response.body;
|
|
355
|
+
var key = keyBuilder$1(luvio, resourceParams);
|
|
356
|
+
luvio.storeIngest(key, ingest, body);
|
|
357
|
+
var snapshot = luvio.storeLookup({
|
|
358
|
+
recordId: key,
|
|
359
|
+
node: select(),
|
|
360
|
+
variables: {},
|
|
361
|
+
}, snapshotRefresh);
|
|
362
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
363
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
364
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return snapshot;
|
|
368
|
+
}
|
|
369
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
370
|
+
var key = keyBuilder$1(luvio, params);
|
|
371
|
+
var errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
372
|
+
var storeMetadataParams = {
|
|
373
|
+
ttl: TTL,
|
|
374
|
+
namespace: keyPrefix,
|
|
375
|
+
version: VERSION,
|
|
376
|
+
representationName: RepresentationType
|
|
377
|
+
};
|
|
378
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
379
|
+
return errorSnapshot;
|
|
380
|
+
}
|
|
381
|
+
function createResourceRequest(config) {
|
|
382
|
+
var headers = {};
|
|
383
|
+
return {
|
|
384
|
+
baseUri: '/services/data/v58.0',
|
|
385
|
+
basePath: '/connect/service-excellence/service-catalog-request/layout-data/case/' + config.urlParams.Id + '',
|
|
386
|
+
method: 'get',
|
|
387
|
+
body: null,
|
|
388
|
+
urlParams: config.urlParams,
|
|
389
|
+
queryParams: {},
|
|
390
|
+
headers: headers,
|
|
391
|
+
priority: 'normal',
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
var getCaseServiceProcessLayoutData_ConfigPropertyNames = {
|
|
396
|
+
displayName: 'getCaseServiceProcessLayoutData',
|
|
397
|
+
parameters: {
|
|
398
|
+
required: ['Id'],
|
|
399
|
+
optional: []
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
function createResourceParams(config) {
|
|
403
|
+
var resourceParams = {
|
|
404
|
+
urlParams: {
|
|
405
|
+
Id: config.Id
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
return resourceParams;
|
|
409
|
+
}
|
|
410
|
+
function keyBuilder(luvio, config) {
|
|
411
|
+
var resourceParams = createResourceParams(config);
|
|
412
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
413
|
+
}
|
|
414
|
+
function typeCheckConfig(untrustedConfig) {
|
|
415
|
+
var config = {};
|
|
416
|
+
var untrustedConfig_Id = untrustedConfig.Id;
|
|
417
|
+
if (typeof untrustedConfig_Id === 'string') {
|
|
418
|
+
config.Id = untrustedConfig_Id;
|
|
419
|
+
}
|
|
420
|
+
return config;
|
|
421
|
+
}
|
|
422
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
423
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
424
|
+
return null;
|
|
425
|
+
}
|
|
426
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
427
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
428
|
+
}
|
|
429
|
+
var config = typeCheckConfig(untrustedConfig);
|
|
430
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
431
|
+
return null;
|
|
432
|
+
}
|
|
433
|
+
return config;
|
|
434
|
+
}
|
|
435
|
+
function adapterFragment(luvio, config) {
|
|
436
|
+
createResourceParams(config);
|
|
437
|
+
return select();
|
|
438
|
+
}
|
|
439
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
440
|
+
var snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
441
|
+
config: config,
|
|
442
|
+
resolve: function () { return buildNetworkSnapshot(luvio, config, snapshotRefreshOptions); }
|
|
443
|
+
});
|
|
444
|
+
return luvio.storeBroadcast().then(function () { return snapshot; });
|
|
445
|
+
}
|
|
446
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
447
|
+
var snapshot = ingestError(luvio, resourceParams, response, {
|
|
448
|
+
config: config,
|
|
449
|
+
resolve: function () { return buildNetworkSnapshot(luvio, config, snapshotRefreshOptions); }
|
|
450
|
+
});
|
|
451
|
+
return luvio.storeBroadcast().then(function () { return snapshot; });
|
|
452
|
+
}
|
|
453
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
454
|
+
var resourceParams = createResourceParams(config);
|
|
455
|
+
var request = createResourceRequest(resourceParams);
|
|
456
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
457
|
+
.then(function (response) {
|
|
458
|
+
return luvio.handleSuccessResponse(function () { return onFetchResponseSuccess(luvio, config, resourceParams, response); }, function () { return getResponseCacheKeys(luvio, resourceParams, response.body); });
|
|
459
|
+
}, function (response) {
|
|
460
|
+
return luvio.handleErrorResponse(function () { return onFetchResponseError(luvio, config, resourceParams, response); });
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
464
|
+
var luvio = context.luvio, config = context.config;
|
|
465
|
+
var networkPriority = coercedAdapterRequestContext.networkPriority, requestCorrelator = coercedAdapterRequestContext.requestCorrelator, eventObservers = coercedAdapterRequestContext.eventObservers;
|
|
466
|
+
var dispatchOptions = {
|
|
467
|
+
resourceRequestContext: {
|
|
468
|
+
requestCorrelator: requestCorrelator,
|
|
469
|
+
luvioRequestMethod: undefined,
|
|
470
|
+
},
|
|
471
|
+
eventObservers: eventObservers
|
|
472
|
+
};
|
|
473
|
+
if (networkPriority !== 'normal') {
|
|
474
|
+
dispatchOptions.overrides = {
|
|
475
|
+
priority: networkPriority
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
return buildNetworkSnapshot(luvio, config, dispatchOptions);
|
|
479
|
+
}
|
|
480
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
481
|
+
var luvio = context.luvio, config = context.config;
|
|
482
|
+
var selector = {
|
|
483
|
+
recordId: keyBuilder(luvio, config),
|
|
484
|
+
node: adapterFragment(luvio, config),
|
|
485
|
+
variables: {},
|
|
486
|
+
};
|
|
487
|
+
var cacheSnapshot = storeLookup(selector, {
|
|
488
|
+
config: config,
|
|
489
|
+
resolve: function () { return buildNetworkSnapshot(luvio, config, snapshotRefreshOptions); }
|
|
490
|
+
});
|
|
491
|
+
return cacheSnapshot;
|
|
492
|
+
}
|
|
493
|
+
var getCaseServiceProcessLayoutDataAdapterFactory = function (luvio) { return function serviceprocess__getCaseServiceProcessLayoutData(untrustedConfig, requestContext) {
|
|
494
|
+
var config = validateAdapterConfig(untrustedConfig, getCaseServiceProcessLayoutData_ConfigPropertyNames);
|
|
495
|
+
// Invalid or incomplete config
|
|
496
|
+
if (config === null) {
|
|
497
|
+
return null;
|
|
498
|
+
}
|
|
499
|
+
return luvio.applyCachePolicy((requestContext || {}), { config: config, luvio: luvio }, // BuildSnapshotContext
|
|
500
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
501
|
+
}; };
|
|
502
|
+
|
|
503
|
+
exports.getCaseServiceProcessLayoutDataAdapterFactory = getCaseServiceProcessLayoutDataAdapterFactory;
|
|
504
|
+
|
|
505
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
506
|
+
|
|
507
|
+
}));
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@salesforce/lds-adapters-industries-serviceprocess",
|
|
3
|
+
"version": "1.100.2",
|
|
4
|
+
"description": "Connect apis for fetching and updating service processes",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "dist/umd/es2018/industries-serviceprocess.js",
|
|
7
|
+
"module": "dist/es/es2018/industries-serviceprocess.js",
|
|
8
|
+
"types": "dist/types/src/generated/artifacts/main.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"sfdc",
|
|
12
|
+
"src/raml/*"
|
|
13
|
+
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"import": "./dist/es/es2018/industries-serviceprocess.js",
|
|
17
|
+
"require": "./dist/umd/es2018/industries-serviceprocess.js",
|
|
18
|
+
"types": "./dist/types/src/generated/artifacts/main.d.ts"
|
|
19
|
+
},
|
|
20
|
+
"./sfdc": {
|
|
21
|
+
"import": "./sfdc/index.js",
|
|
22
|
+
"types": "./sfdc/index.d.ts",
|
|
23
|
+
"default": "./sfdc/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"contributors": [
|
|
27
|
+
"saksham.bhayana@salesforce.com"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "yarn build:raml && yarn build:services && yarn build:karma",
|
|
31
|
+
"build:karma": "rollup --config rollup.config.karma.js",
|
|
32
|
+
"build:raml": "luvio generate src/raml/luvio.raml src/generated -p '../lds-compiler-plugins'",
|
|
33
|
+
"build:services": "rollup --config rollup.config.js",
|
|
34
|
+
"clean": "rm -rf dist sfdc src/generated karma/dist",
|
|
35
|
+
"start": "karma start",
|
|
36
|
+
"test": "karma start --single-run",
|
|
37
|
+
"test:compat": "karma start --single-run --compat"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@salesforce/lds-bindings": "^1.100.2"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@luvio/cli": "0.135.4",
|
|
44
|
+
"@luvio/compiler": "0.135.4",
|
|
45
|
+
"@luvio/engine": "0.135.4",
|
|
46
|
+
"@luvio/lwc-luvio": "0.135.4",
|
|
47
|
+
"@salesforce/lds-karma": "^1.100.2"
|
|
48
|
+
},
|
|
49
|
+
"nx": {
|
|
50
|
+
"targets": {
|
|
51
|
+
"build": {
|
|
52
|
+
"outputs": [
|
|
53
|
+
"packages/lds-adapters-industries-serviceprocess/dist",
|
|
54
|
+
"packages/lds-adapters-industries-serviceprocess/karma/dist",
|
|
55
|
+
"packages/lds-adapters-industries-serviceprocess/sfdc",
|
|
56
|
+
"packages/lds-adapters-industries-serviceprocess/src/generated"
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"volta": {
|
|
62
|
+
"extends": "../../package.json"
|
|
63
|
+
}
|
|
64
|
+
}
|
package/sfdc/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/types/src/generated/artifacts/sfdc';
|