@salesforce/lds-adapters-industries-serviceprocess 1.124.2 → 1.124.4

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