@salesforce/lds-adapters-sales-enablementmeasureconnectfamily 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/sales-enablementmeasureconnectfamily.js +866 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/getContributingRecordsInfoForMilestone.d.ts +27 -0
- package/dist/es/es2018/types/src/generated/adapters/triggerOnDemandComputation.d.ts +15 -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 +4 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectEnablementContributingRecordsTaskMeasureProgressByTaskMeasureProgressId.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/resources/patchConnectEnablementOnDemandComputationProgramsByProgramId.d.ts +12 -0
- package/dist/es/es2018/types/src/generated/types/ContributingRecordFieldInfoRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/ContributingRecordFieldsValueRepresentation.d.ts +37 -0
- package/dist/es/es2018/types/src/generated/types/MilestoneProgressContributingRecordsRepresentation.d.ts +52 -0
- package/dist/es/es2018/types/src/generated/types/OnDemandComputationResponseRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
- package/package.json +67 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +911 -0
- package/src/raml/api.raml +131 -0
- package/src/raml/luvio.raml +26 -0
|
@@ -0,0 +1,866 @@
|
|
|
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, StoreKeyMap, createResourceParams as createResourceParams$2, typeCheckConfig as typeCheckConfig$2, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1 } from '@luvio/engine';
|
|
8
|
+
|
|
9
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
10
|
+
const { keys: ObjectKeys, create: ObjectCreate } = 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(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 = 'EnablementMeasureConnectFamily';
|
|
73
|
+
|
|
74
|
+
const { isArray: ArrayIsArray } = Array;
|
|
75
|
+
function equalsArray(a, b, equalsItem) {
|
|
76
|
+
const aLength = a.length;
|
|
77
|
+
const bLength = b.length;
|
|
78
|
+
if (aLength !== bLength) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
for (let i = 0; i < aLength; i++) {
|
|
82
|
+
if (equalsItem(a[i], b[i]) === false) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
function createLink(ref) {
|
|
89
|
+
return {
|
|
90
|
+
__ref: serializeStructuredKey(ref),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const TTL$1 = 5000;
|
|
95
|
+
const VERSION$3 = "06f642b78c6dc5286bb5b43198feed06";
|
|
96
|
+
function validate$3(obj, path = 'OnDemandComputationResponseRepresentation') {
|
|
97
|
+
const v_error = (() => {
|
|
98
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
99
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
100
|
+
}
|
|
101
|
+
const obj_enablementProgramId = obj.enablementProgramId;
|
|
102
|
+
const path_enablementProgramId = path + '.enablementProgramId';
|
|
103
|
+
if (typeof obj_enablementProgramId !== 'string') {
|
|
104
|
+
return new TypeError('Expected "string" but received "' + typeof obj_enablementProgramId + '" (at "' + path_enablementProgramId + '")');
|
|
105
|
+
}
|
|
106
|
+
})();
|
|
107
|
+
return v_error === undefined ? null : v_error;
|
|
108
|
+
}
|
|
109
|
+
const RepresentationType$1 = 'OnDemandComputationResponseRepresentation';
|
|
110
|
+
function keyBuilder$2(luvio, config) {
|
|
111
|
+
return keyPrefix + '::' + RepresentationType$1 + ':' + config.enablementProgramId;
|
|
112
|
+
}
|
|
113
|
+
function keyBuilderFromType(luvio, object) {
|
|
114
|
+
const keyParams = {
|
|
115
|
+
enablementProgramId: object.enablementProgramId
|
|
116
|
+
};
|
|
117
|
+
return keyBuilder$2(luvio, keyParams);
|
|
118
|
+
}
|
|
119
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
120
|
+
return input;
|
|
121
|
+
}
|
|
122
|
+
const select$5 = function OnDemandComputationResponseRepresentationSelect() {
|
|
123
|
+
return {
|
|
124
|
+
kind: 'Fragment',
|
|
125
|
+
version: VERSION$3,
|
|
126
|
+
private: [],
|
|
127
|
+
selections: [
|
|
128
|
+
{
|
|
129
|
+
name: 'enablementProgramId',
|
|
130
|
+
kind: 'Scalar'
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
function equals$3(existing, incoming) {
|
|
136
|
+
const existing_enablementProgramId = existing.enablementProgramId;
|
|
137
|
+
const incoming_enablementProgramId = incoming.enablementProgramId;
|
|
138
|
+
if (!(existing_enablementProgramId === incoming_enablementProgramId)) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
const ingest$1 = function OnDemandComputationResponseRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
144
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
145
|
+
const validateError = validate$3(input);
|
|
146
|
+
if (validateError !== null) {
|
|
147
|
+
throw validateError;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
const key = keyBuilderFromType(luvio, input);
|
|
151
|
+
const ttlToUse = TTL$1;
|
|
152
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "EnablementMeasureConnectFamily", VERSION$3, RepresentationType$1, equals$3);
|
|
153
|
+
return createLink(key);
|
|
154
|
+
};
|
|
155
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
156
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
157
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
158
|
+
rootKeySet.set(rootKey, {
|
|
159
|
+
namespace: keyPrefix,
|
|
160
|
+
representationName: RepresentationType$1,
|
|
161
|
+
mergeable: false
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function select$4(luvio, params) {
|
|
166
|
+
return select$5();
|
|
167
|
+
}
|
|
168
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
169
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response);
|
|
170
|
+
}
|
|
171
|
+
function ingestSuccess$1(luvio, resourceParams, response) {
|
|
172
|
+
const { body } = response;
|
|
173
|
+
const key = keyBuilderFromType(luvio, body);
|
|
174
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
175
|
+
const snapshot = luvio.storeLookup({
|
|
176
|
+
recordId: key,
|
|
177
|
+
node: select$4(),
|
|
178
|
+
variables: {},
|
|
179
|
+
});
|
|
180
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
181
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
182
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
deepFreeze(snapshot.data);
|
|
186
|
+
return snapshot;
|
|
187
|
+
}
|
|
188
|
+
function createResourceRequest$1(config) {
|
|
189
|
+
const headers = {};
|
|
190
|
+
return {
|
|
191
|
+
baseUri: '/services/data/v66.0',
|
|
192
|
+
basePath: '/connect/enablement/on-demand-computation/programs/' + config.urlParams.programId + '',
|
|
193
|
+
method: 'patch',
|
|
194
|
+
body: null,
|
|
195
|
+
urlParams: config.urlParams,
|
|
196
|
+
queryParams: {},
|
|
197
|
+
headers,
|
|
198
|
+
priority: 'normal',
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const adapterName$1 = 'triggerOnDemandComputation';
|
|
203
|
+
const triggerOnDemandComputation_ConfigPropertyMetadata = [
|
|
204
|
+
generateParamConfigMetadata('programId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
205
|
+
];
|
|
206
|
+
const triggerOnDemandComputation_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, triggerOnDemandComputation_ConfigPropertyMetadata);
|
|
207
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$2(triggerOnDemandComputation_ConfigPropertyMetadata);
|
|
208
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
209
|
+
const config = {};
|
|
210
|
+
typeCheckConfig$2(untrustedConfig, config, triggerOnDemandComputation_ConfigPropertyMetadata);
|
|
211
|
+
return config;
|
|
212
|
+
}
|
|
213
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
214
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
218
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
219
|
+
}
|
|
220
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
221
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
return config;
|
|
225
|
+
}
|
|
226
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
227
|
+
const resourceParams = createResourceParams$1(config);
|
|
228
|
+
const request = createResourceRequest$1(resourceParams);
|
|
229
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
230
|
+
.then((response) => {
|
|
231
|
+
return luvio.handleSuccessResponse(() => {
|
|
232
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response);
|
|
233
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
234
|
+
}, () => {
|
|
235
|
+
const cache = new StoreKeyMap();
|
|
236
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
237
|
+
return cache;
|
|
238
|
+
});
|
|
239
|
+
}, (response) => {
|
|
240
|
+
deepFreeze(response);
|
|
241
|
+
throw response;
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
const triggerOnDemandComputationAdapterFactory = (luvio) => {
|
|
245
|
+
return function triggerOnDemandComputation(untrustedConfig) {
|
|
246
|
+
const config = validateAdapterConfig$1(untrustedConfig, triggerOnDemandComputation_ConfigPropertyNames);
|
|
247
|
+
// Invalid or incomplete config
|
|
248
|
+
if (config === null) {
|
|
249
|
+
throw new Error('Invalid config for "triggerOnDemandComputation"');
|
|
250
|
+
}
|
|
251
|
+
return buildNetworkSnapshot$1(luvio, config);
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
const VERSION$2 = "ad12fb131e66578581e978c238ecbf1f";
|
|
256
|
+
function validate$2(obj, path = 'ContributingRecordFieldInfoRepresentation') {
|
|
257
|
+
const v_error = (() => {
|
|
258
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
259
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
260
|
+
}
|
|
261
|
+
const obj_apiName = obj.apiName;
|
|
262
|
+
const path_apiName = path + '.apiName';
|
|
263
|
+
let obj_apiName_union0 = null;
|
|
264
|
+
const obj_apiName_union0_error = (() => {
|
|
265
|
+
if (typeof obj_apiName !== 'string') {
|
|
266
|
+
return new TypeError('Expected "string" but received "' + typeof obj_apiName + '" (at "' + path_apiName + '")');
|
|
267
|
+
}
|
|
268
|
+
})();
|
|
269
|
+
if (obj_apiName_union0_error != null) {
|
|
270
|
+
obj_apiName_union0 = obj_apiName_union0_error.message;
|
|
271
|
+
}
|
|
272
|
+
let obj_apiName_union1 = null;
|
|
273
|
+
const obj_apiName_union1_error = (() => {
|
|
274
|
+
if (obj_apiName !== null) {
|
|
275
|
+
return new TypeError('Expected "null" but received "' + typeof obj_apiName + '" (at "' + path_apiName + '")');
|
|
276
|
+
}
|
|
277
|
+
})();
|
|
278
|
+
if (obj_apiName_union1_error != null) {
|
|
279
|
+
obj_apiName_union1 = obj_apiName_union1_error.message;
|
|
280
|
+
}
|
|
281
|
+
if (obj_apiName_union0 && obj_apiName_union1) {
|
|
282
|
+
let message = 'Object doesn\'t match union (at "' + path_apiName + '")';
|
|
283
|
+
message += '\n' + obj_apiName_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
284
|
+
message += '\n' + obj_apiName_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
285
|
+
return new TypeError(message);
|
|
286
|
+
}
|
|
287
|
+
const obj_dataType = obj.dataType;
|
|
288
|
+
const path_dataType = path + '.dataType';
|
|
289
|
+
let obj_dataType_union0 = null;
|
|
290
|
+
const obj_dataType_union0_error = (() => {
|
|
291
|
+
if (typeof obj_dataType !== 'string') {
|
|
292
|
+
return new TypeError('Expected "string" but received "' + typeof obj_dataType + '" (at "' + path_dataType + '")');
|
|
293
|
+
}
|
|
294
|
+
})();
|
|
295
|
+
if (obj_dataType_union0_error != null) {
|
|
296
|
+
obj_dataType_union0 = obj_dataType_union0_error.message;
|
|
297
|
+
}
|
|
298
|
+
let obj_dataType_union1 = null;
|
|
299
|
+
const obj_dataType_union1_error = (() => {
|
|
300
|
+
if (obj_dataType !== null) {
|
|
301
|
+
return new TypeError('Expected "null" but received "' + typeof obj_dataType + '" (at "' + path_dataType + '")');
|
|
302
|
+
}
|
|
303
|
+
})();
|
|
304
|
+
if (obj_dataType_union1_error != null) {
|
|
305
|
+
obj_dataType_union1 = obj_dataType_union1_error.message;
|
|
306
|
+
}
|
|
307
|
+
if (obj_dataType_union0 && obj_dataType_union1) {
|
|
308
|
+
let message = 'Object doesn\'t match union (at "' + path_dataType + '")';
|
|
309
|
+
message += '\n' + obj_dataType_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
310
|
+
message += '\n' + obj_dataType_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
311
|
+
return new TypeError(message);
|
|
312
|
+
}
|
|
313
|
+
const obj_label = obj.label;
|
|
314
|
+
const path_label = path + '.label';
|
|
315
|
+
let obj_label_union0 = null;
|
|
316
|
+
const obj_label_union0_error = (() => {
|
|
317
|
+
if (typeof obj_label !== 'string') {
|
|
318
|
+
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
319
|
+
}
|
|
320
|
+
})();
|
|
321
|
+
if (obj_label_union0_error != null) {
|
|
322
|
+
obj_label_union0 = obj_label_union0_error.message;
|
|
323
|
+
}
|
|
324
|
+
let obj_label_union1 = null;
|
|
325
|
+
const obj_label_union1_error = (() => {
|
|
326
|
+
if (obj_label !== null) {
|
|
327
|
+
return new TypeError('Expected "null" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
328
|
+
}
|
|
329
|
+
})();
|
|
330
|
+
if (obj_label_union1_error != null) {
|
|
331
|
+
obj_label_union1 = obj_label_union1_error.message;
|
|
332
|
+
}
|
|
333
|
+
if (obj_label_union0 && obj_label_union1) {
|
|
334
|
+
let message = 'Object doesn\'t match union (at "' + path_label + '")';
|
|
335
|
+
message += '\n' + obj_label_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
336
|
+
message += '\n' + obj_label_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
337
|
+
return new TypeError(message);
|
|
338
|
+
}
|
|
339
|
+
})();
|
|
340
|
+
return v_error === undefined ? null : v_error;
|
|
341
|
+
}
|
|
342
|
+
const select$3 = function ContributingRecordFieldInfoRepresentationSelect() {
|
|
343
|
+
return {
|
|
344
|
+
kind: 'Fragment',
|
|
345
|
+
version: VERSION$2,
|
|
346
|
+
private: [],
|
|
347
|
+
selections: [
|
|
348
|
+
{
|
|
349
|
+
name: 'apiName',
|
|
350
|
+
kind: 'Scalar'
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
name: 'dataType',
|
|
354
|
+
kind: 'Scalar'
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
name: 'label',
|
|
358
|
+
kind: 'Scalar'
|
|
359
|
+
}
|
|
360
|
+
]
|
|
361
|
+
};
|
|
362
|
+
};
|
|
363
|
+
function equals$2(existing, incoming) {
|
|
364
|
+
const existing_apiName = existing.apiName;
|
|
365
|
+
const incoming_apiName = incoming.apiName;
|
|
366
|
+
if (!(existing_apiName === incoming_apiName)) {
|
|
367
|
+
return false;
|
|
368
|
+
}
|
|
369
|
+
const existing_dataType = existing.dataType;
|
|
370
|
+
const incoming_dataType = incoming.dataType;
|
|
371
|
+
if (!(existing_dataType === incoming_dataType)) {
|
|
372
|
+
return false;
|
|
373
|
+
}
|
|
374
|
+
const existing_label = existing.label;
|
|
375
|
+
const incoming_label = incoming.label;
|
|
376
|
+
if (!(existing_label === incoming_label)) {
|
|
377
|
+
return false;
|
|
378
|
+
}
|
|
379
|
+
return true;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
const VERSION$1 = "1b50012cdea40e92974c92748eeb3fa7";
|
|
383
|
+
function validate$1(obj, path = 'ContributingRecordFieldsValueRepresentation') {
|
|
384
|
+
const v_error = (() => {
|
|
385
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
386
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
387
|
+
}
|
|
388
|
+
const obj_aggregationFieldValue = obj.aggregationFieldValue;
|
|
389
|
+
const path_aggregationFieldValue = path + '.aggregationFieldValue';
|
|
390
|
+
let obj_aggregationFieldValue_union0 = null;
|
|
391
|
+
const obj_aggregationFieldValue_union0_error = (() => {
|
|
392
|
+
if (typeof obj_aggregationFieldValue !== 'string') {
|
|
393
|
+
return new TypeError('Expected "string" but received "' + typeof obj_aggregationFieldValue + '" (at "' + path_aggregationFieldValue + '")');
|
|
394
|
+
}
|
|
395
|
+
})();
|
|
396
|
+
if (obj_aggregationFieldValue_union0_error != null) {
|
|
397
|
+
obj_aggregationFieldValue_union0 = obj_aggregationFieldValue_union0_error.message;
|
|
398
|
+
}
|
|
399
|
+
let obj_aggregationFieldValue_union1 = null;
|
|
400
|
+
const obj_aggregationFieldValue_union1_error = (() => {
|
|
401
|
+
if (obj_aggregationFieldValue !== null) {
|
|
402
|
+
return new TypeError('Expected "null" but received "' + typeof obj_aggregationFieldValue + '" (at "' + path_aggregationFieldValue + '")');
|
|
403
|
+
}
|
|
404
|
+
})();
|
|
405
|
+
if (obj_aggregationFieldValue_union1_error != null) {
|
|
406
|
+
obj_aggregationFieldValue_union1 = obj_aggregationFieldValue_union1_error.message;
|
|
407
|
+
}
|
|
408
|
+
if (obj_aggregationFieldValue_union0 && obj_aggregationFieldValue_union1) {
|
|
409
|
+
let message = 'Object doesn\'t match union (at "' + path_aggregationFieldValue + '")';
|
|
410
|
+
message += '\n' + obj_aggregationFieldValue_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
411
|
+
message += '\n' + obj_aggregationFieldValue_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
412
|
+
return new TypeError(message);
|
|
413
|
+
}
|
|
414
|
+
const obj_dateFilterFieldValue = obj.dateFilterFieldValue;
|
|
415
|
+
const path_dateFilterFieldValue = path + '.dateFilterFieldValue';
|
|
416
|
+
let obj_dateFilterFieldValue_union0 = null;
|
|
417
|
+
const obj_dateFilterFieldValue_union0_error = (() => {
|
|
418
|
+
if (typeof obj_dateFilterFieldValue !== 'string') {
|
|
419
|
+
return new TypeError('Expected "string" but received "' + typeof obj_dateFilterFieldValue + '" (at "' + path_dateFilterFieldValue + '")');
|
|
420
|
+
}
|
|
421
|
+
})();
|
|
422
|
+
if (obj_dateFilterFieldValue_union0_error != null) {
|
|
423
|
+
obj_dateFilterFieldValue_union0 = obj_dateFilterFieldValue_union0_error.message;
|
|
424
|
+
}
|
|
425
|
+
let obj_dateFilterFieldValue_union1 = null;
|
|
426
|
+
const obj_dateFilterFieldValue_union1_error = (() => {
|
|
427
|
+
if (obj_dateFilterFieldValue !== null) {
|
|
428
|
+
return new TypeError('Expected "null" but received "' + typeof obj_dateFilterFieldValue + '" (at "' + path_dateFilterFieldValue + '")');
|
|
429
|
+
}
|
|
430
|
+
})();
|
|
431
|
+
if (obj_dateFilterFieldValue_union1_error != null) {
|
|
432
|
+
obj_dateFilterFieldValue_union1 = obj_dateFilterFieldValue_union1_error.message;
|
|
433
|
+
}
|
|
434
|
+
if (obj_dateFilterFieldValue_union0 && obj_dateFilterFieldValue_union1) {
|
|
435
|
+
let message = 'Object doesn\'t match union (at "' + path_dateFilterFieldValue + '")';
|
|
436
|
+
message += '\n' + obj_dateFilterFieldValue_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
437
|
+
message += '\n' + obj_dateFilterFieldValue_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
438
|
+
return new TypeError(message);
|
|
439
|
+
}
|
|
440
|
+
const obj_displayFieldValue = obj.displayFieldValue;
|
|
441
|
+
const path_displayFieldValue = path + '.displayFieldValue';
|
|
442
|
+
let obj_displayFieldValue_union0 = null;
|
|
443
|
+
const obj_displayFieldValue_union0_error = (() => {
|
|
444
|
+
if (typeof obj_displayFieldValue !== 'string') {
|
|
445
|
+
return new TypeError('Expected "string" but received "' + typeof obj_displayFieldValue + '" (at "' + path_displayFieldValue + '")');
|
|
446
|
+
}
|
|
447
|
+
})();
|
|
448
|
+
if (obj_displayFieldValue_union0_error != null) {
|
|
449
|
+
obj_displayFieldValue_union0 = obj_displayFieldValue_union0_error.message;
|
|
450
|
+
}
|
|
451
|
+
let obj_displayFieldValue_union1 = null;
|
|
452
|
+
const obj_displayFieldValue_union1_error = (() => {
|
|
453
|
+
if (obj_displayFieldValue !== null) {
|
|
454
|
+
return new TypeError('Expected "null" but received "' + typeof obj_displayFieldValue + '" (at "' + path_displayFieldValue + '")');
|
|
455
|
+
}
|
|
456
|
+
})();
|
|
457
|
+
if (obj_displayFieldValue_union1_error != null) {
|
|
458
|
+
obj_displayFieldValue_union1 = obj_displayFieldValue_union1_error.message;
|
|
459
|
+
}
|
|
460
|
+
if (obj_displayFieldValue_union0 && obj_displayFieldValue_union1) {
|
|
461
|
+
let message = 'Object doesn\'t match union (at "' + path_displayFieldValue + '")';
|
|
462
|
+
message += '\n' + obj_displayFieldValue_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
463
|
+
message += '\n' + obj_displayFieldValue_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
464
|
+
return new TypeError(message);
|
|
465
|
+
}
|
|
466
|
+
const obj_recordId = obj.recordId;
|
|
467
|
+
const path_recordId = path + '.recordId';
|
|
468
|
+
if (typeof obj_recordId !== 'string') {
|
|
469
|
+
return new TypeError('Expected "string" but received "' + typeof obj_recordId + '" (at "' + path_recordId + '")');
|
|
470
|
+
}
|
|
471
|
+
})();
|
|
472
|
+
return v_error === undefined ? null : v_error;
|
|
473
|
+
}
|
|
474
|
+
const select$2 = function ContributingRecordFieldsValueRepresentationSelect() {
|
|
475
|
+
return {
|
|
476
|
+
kind: 'Fragment',
|
|
477
|
+
version: VERSION$1,
|
|
478
|
+
private: [],
|
|
479
|
+
selections: [
|
|
480
|
+
{
|
|
481
|
+
name: 'aggregationFieldValue',
|
|
482
|
+
kind: 'Scalar'
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
name: 'dateFilterFieldValue',
|
|
486
|
+
kind: 'Scalar'
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
name: 'displayFieldValue',
|
|
490
|
+
kind: 'Scalar'
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
name: 'recordId',
|
|
494
|
+
kind: 'Scalar'
|
|
495
|
+
}
|
|
496
|
+
]
|
|
497
|
+
};
|
|
498
|
+
};
|
|
499
|
+
function equals$1(existing, incoming) {
|
|
500
|
+
const existing_recordId = existing.recordId;
|
|
501
|
+
const incoming_recordId = incoming.recordId;
|
|
502
|
+
if (!(existing_recordId === incoming_recordId)) {
|
|
503
|
+
return false;
|
|
504
|
+
}
|
|
505
|
+
const existing_aggregationFieldValue = existing.aggregationFieldValue;
|
|
506
|
+
const incoming_aggregationFieldValue = incoming.aggregationFieldValue;
|
|
507
|
+
if (!(existing_aggregationFieldValue === incoming_aggregationFieldValue)) {
|
|
508
|
+
return false;
|
|
509
|
+
}
|
|
510
|
+
const existing_dateFilterFieldValue = existing.dateFilterFieldValue;
|
|
511
|
+
const incoming_dateFilterFieldValue = incoming.dateFilterFieldValue;
|
|
512
|
+
if (!(existing_dateFilterFieldValue === incoming_dateFilterFieldValue)) {
|
|
513
|
+
return false;
|
|
514
|
+
}
|
|
515
|
+
const existing_displayFieldValue = existing.displayFieldValue;
|
|
516
|
+
const incoming_displayFieldValue = incoming.displayFieldValue;
|
|
517
|
+
if (!(existing_displayFieldValue === incoming_displayFieldValue)) {
|
|
518
|
+
return false;
|
|
519
|
+
}
|
|
520
|
+
return true;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
const TTL = 5000;
|
|
524
|
+
const VERSION = "a40560a4894d717e0f73660f0311f293";
|
|
525
|
+
function validate(obj, path = 'MilestoneProgressContributingRecordsRepresentation') {
|
|
526
|
+
const v_error = (() => {
|
|
527
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
528
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
529
|
+
}
|
|
530
|
+
const obj_aggregationField = obj.aggregationField;
|
|
531
|
+
const path_aggregationField = path + '.aggregationField';
|
|
532
|
+
const referencepath_aggregationFieldValidationError = validate$2(obj_aggregationField, path_aggregationField);
|
|
533
|
+
if (referencepath_aggregationFieldValidationError !== null) {
|
|
534
|
+
let message = 'Object doesn\'t match ContributingRecordFieldInfoRepresentation (at "' + path_aggregationField + '")\n';
|
|
535
|
+
message += referencepath_aggregationFieldValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
536
|
+
return new TypeError(message);
|
|
537
|
+
}
|
|
538
|
+
const obj_aggregationType = obj.aggregationType;
|
|
539
|
+
const path_aggregationType = path + '.aggregationType';
|
|
540
|
+
if (typeof obj_aggregationType !== 'string') {
|
|
541
|
+
return new TypeError('Expected "string" but received "' + typeof obj_aggregationType + '" (at "' + path_aggregationType + '")');
|
|
542
|
+
}
|
|
543
|
+
const obj_dateFilterField = obj.dateFilterField;
|
|
544
|
+
const path_dateFilterField = path + '.dateFilterField';
|
|
545
|
+
const referencepath_dateFilterFieldValidationError = validate$2(obj_dateFilterField, path_dateFilterField);
|
|
546
|
+
if (referencepath_dateFilterFieldValidationError !== null) {
|
|
547
|
+
let message = 'Object doesn\'t match ContributingRecordFieldInfoRepresentation (at "' + path_dateFilterField + '")\n';
|
|
548
|
+
message += referencepath_dateFilterFieldValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
549
|
+
return new TypeError(message);
|
|
550
|
+
}
|
|
551
|
+
const obj_displayField = obj.displayField;
|
|
552
|
+
const path_displayField = path + '.displayField';
|
|
553
|
+
const referencepath_displayFieldValidationError = validate$2(obj_displayField, path_displayField);
|
|
554
|
+
if (referencepath_displayFieldValidationError !== null) {
|
|
555
|
+
let message = 'Object doesn\'t match ContributingRecordFieldInfoRepresentation (at "' + path_displayField + '")\n';
|
|
556
|
+
message += referencepath_displayFieldValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
557
|
+
return new TypeError(message);
|
|
558
|
+
}
|
|
559
|
+
const obj_inaccessibleRecordCount = obj.inaccessibleRecordCount;
|
|
560
|
+
const path_inaccessibleRecordCount = path + '.inaccessibleRecordCount';
|
|
561
|
+
if (typeof obj_inaccessibleRecordCount !== 'number' || (typeof obj_inaccessibleRecordCount === 'number' && Math.floor(obj_inaccessibleRecordCount) !== obj_inaccessibleRecordCount)) {
|
|
562
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_inaccessibleRecordCount + '" (at "' + path_inaccessibleRecordCount + '")');
|
|
563
|
+
}
|
|
564
|
+
const obj_measureName = obj.measureName;
|
|
565
|
+
const path_measureName = path + '.measureName';
|
|
566
|
+
if (typeof obj_measureName !== 'string') {
|
|
567
|
+
return new TypeError('Expected "string" but received "' + typeof obj_measureName + '" (at "' + path_measureName + '")');
|
|
568
|
+
}
|
|
569
|
+
const obj_records = obj.records;
|
|
570
|
+
const path_records = path + '.records';
|
|
571
|
+
if (!ArrayIsArray(obj_records)) {
|
|
572
|
+
return new TypeError('Expected "array" but received "' + typeof obj_records + '" (at "' + path_records + '")');
|
|
573
|
+
}
|
|
574
|
+
for (let i = 0; i < obj_records.length; i++) {
|
|
575
|
+
const obj_records_item = obj_records[i];
|
|
576
|
+
const path_records_item = path_records + '[' + i + ']';
|
|
577
|
+
const referencepath_records_itemValidationError = validate$1(obj_records_item, path_records_item);
|
|
578
|
+
if (referencepath_records_itemValidationError !== null) {
|
|
579
|
+
let message = 'Object doesn\'t match ContributingRecordFieldsValueRepresentation (at "' + path_records_item + '")\n';
|
|
580
|
+
message += referencepath_records_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
581
|
+
return new TypeError(message);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
const obj_sourceObjectApiName = obj.sourceObjectApiName;
|
|
585
|
+
const path_sourceObjectApiName = path + '.sourceObjectApiName';
|
|
586
|
+
if (typeof obj_sourceObjectApiName !== 'string') {
|
|
587
|
+
return new TypeError('Expected "string" but received "' + typeof obj_sourceObjectApiName + '" (at "' + path_sourceObjectApiName + '")');
|
|
588
|
+
}
|
|
589
|
+
const obj_taskMeasureProgressId = obj.taskMeasureProgressId;
|
|
590
|
+
const path_taskMeasureProgressId = path + '.taskMeasureProgressId';
|
|
591
|
+
if (typeof obj_taskMeasureProgressId !== 'string') {
|
|
592
|
+
return new TypeError('Expected "string" but received "' + typeof obj_taskMeasureProgressId + '" (at "' + path_taskMeasureProgressId + '")');
|
|
593
|
+
}
|
|
594
|
+
})();
|
|
595
|
+
return v_error === undefined ? null : v_error;
|
|
596
|
+
}
|
|
597
|
+
const RepresentationType = 'MilestoneProgressContributingRecordsRepresentation';
|
|
598
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
599
|
+
return input;
|
|
600
|
+
}
|
|
601
|
+
const select$1 = function MilestoneProgressContributingRecordsRepresentationSelect() {
|
|
602
|
+
const { selections: ContributingRecordFieldInfoRepresentation__selections, opaque: ContributingRecordFieldInfoRepresentation__opaque, } = select$3();
|
|
603
|
+
const { selections: ContributingRecordFieldsValueRepresentation__selections, opaque: ContributingRecordFieldsValueRepresentation__opaque, } = select$2();
|
|
604
|
+
return {
|
|
605
|
+
kind: 'Fragment',
|
|
606
|
+
version: VERSION,
|
|
607
|
+
private: [],
|
|
608
|
+
selections: [
|
|
609
|
+
{
|
|
610
|
+
name: 'aggregationField',
|
|
611
|
+
kind: 'Object',
|
|
612
|
+
selections: ContributingRecordFieldInfoRepresentation__selections
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
name: 'aggregationType',
|
|
616
|
+
kind: 'Scalar'
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
name: 'dateFilterField',
|
|
620
|
+
kind: 'Object',
|
|
621
|
+
selections: ContributingRecordFieldInfoRepresentation__selections
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
name: 'displayField',
|
|
625
|
+
kind: 'Object',
|
|
626
|
+
selections: ContributingRecordFieldInfoRepresentation__selections
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
name: 'inaccessibleRecordCount',
|
|
630
|
+
kind: 'Scalar'
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
name: 'measureName',
|
|
634
|
+
kind: 'Scalar'
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
name: 'records',
|
|
638
|
+
kind: 'Object',
|
|
639
|
+
plural: true,
|
|
640
|
+
selections: ContributingRecordFieldsValueRepresentation__selections
|
|
641
|
+
},
|
|
642
|
+
{
|
|
643
|
+
name: 'sourceObjectApiName',
|
|
644
|
+
kind: 'Scalar'
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
name: 'taskMeasureProgressId',
|
|
648
|
+
kind: 'Scalar'
|
|
649
|
+
}
|
|
650
|
+
]
|
|
651
|
+
};
|
|
652
|
+
};
|
|
653
|
+
function equals(existing, incoming) {
|
|
654
|
+
const existing_inaccessibleRecordCount = existing.inaccessibleRecordCount;
|
|
655
|
+
const incoming_inaccessibleRecordCount = incoming.inaccessibleRecordCount;
|
|
656
|
+
if (!(existing_inaccessibleRecordCount === incoming_inaccessibleRecordCount)) {
|
|
657
|
+
return false;
|
|
658
|
+
}
|
|
659
|
+
const existing_aggregationType = existing.aggregationType;
|
|
660
|
+
const incoming_aggregationType = incoming.aggregationType;
|
|
661
|
+
if (!(existing_aggregationType === incoming_aggregationType)) {
|
|
662
|
+
return false;
|
|
663
|
+
}
|
|
664
|
+
const existing_measureName = existing.measureName;
|
|
665
|
+
const incoming_measureName = incoming.measureName;
|
|
666
|
+
if (!(existing_measureName === incoming_measureName)) {
|
|
667
|
+
return false;
|
|
668
|
+
}
|
|
669
|
+
const existing_sourceObjectApiName = existing.sourceObjectApiName;
|
|
670
|
+
const incoming_sourceObjectApiName = incoming.sourceObjectApiName;
|
|
671
|
+
if (!(existing_sourceObjectApiName === incoming_sourceObjectApiName)) {
|
|
672
|
+
return false;
|
|
673
|
+
}
|
|
674
|
+
const existing_taskMeasureProgressId = existing.taskMeasureProgressId;
|
|
675
|
+
const incoming_taskMeasureProgressId = incoming.taskMeasureProgressId;
|
|
676
|
+
if (!(existing_taskMeasureProgressId === incoming_taskMeasureProgressId)) {
|
|
677
|
+
return false;
|
|
678
|
+
}
|
|
679
|
+
const existing_aggregationField = existing.aggregationField;
|
|
680
|
+
const incoming_aggregationField = incoming.aggregationField;
|
|
681
|
+
if (!(equals$2(existing_aggregationField, incoming_aggregationField))) {
|
|
682
|
+
return false;
|
|
683
|
+
}
|
|
684
|
+
const existing_dateFilterField = existing.dateFilterField;
|
|
685
|
+
const incoming_dateFilterField = incoming.dateFilterField;
|
|
686
|
+
if (!(equals$2(existing_dateFilterField, incoming_dateFilterField))) {
|
|
687
|
+
return false;
|
|
688
|
+
}
|
|
689
|
+
const existing_displayField = existing.displayField;
|
|
690
|
+
const incoming_displayField = incoming.displayField;
|
|
691
|
+
if (!(equals$2(existing_displayField, incoming_displayField))) {
|
|
692
|
+
return false;
|
|
693
|
+
}
|
|
694
|
+
const existing_records = existing.records;
|
|
695
|
+
const incoming_records = incoming.records;
|
|
696
|
+
const equals_records_items = equalsArray(existing_records, incoming_records, (existing_records_item, incoming_records_item) => {
|
|
697
|
+
if (!(equals$1(existing_records_item, incoming_records_item))) {
|
|
698
|
+
return false;
|
|
699
|
+
}
|
|
700
|
+
});
|
|
701
|
+
if (equals_records_items === false) {
|
|
702
|
+
return false;
|
|
703
|
+
}
|
|
704
|
+
return true;
|
|
705
|
+
}
|
|
706
|
+
const ingest = function MilestoneProgressContributingRecordsRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
707
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
708
|
+
const validateError = validate(input);
|
|
709
|
+
if (validateError !== null) {
|
|
710
|
+
throw validateError;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
const key = path.fullPath;
|
|
714
|
+
const ttlToUse = TTL;
|
|
715
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "EnablementMeasureConnectFamily", VERSION, RepresentationType, equals);
|
|
716
|
+
return createLink(key);
|
|
717
|
+
};
|
|
718
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
719
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
720
|
+
const rootKey = fullPathFactory();
|
|
721
|
+
rootKeySet.set(rootKey, {
|
|
722
|
+
namespace: keyPrefix,
|
|
723
|
+
representationName: RepresentationType,
|
|
724
|
+
mergeable: false
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
function select(luvio, params) {
|
|
729
|
+
return select$1();
|
|
730
|
+
}
|
|
731
|
+
function keyBuilder$1(luvio, params) {
|
|
732
|
+
return keyPrefix + '::MilestoneProgressContributingRecordsRepresentation:(' + 'taskMeasureProgressId:' + params.urlParams.taskMeasureProgressId + ')';
|
|
733
|
+
}
|
|
734
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
735
|
+
getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
736
|
+
}
|
|
737
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
738
|
+
const { body } = response;
|
|
739
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
740
|
+
luvio.storeIngest(key, ingest, body);
|
|
741
|
+
const snapshot = luvio.storeLookup({
|
|
742
|
+
recordId: key,
|
|
743
|
+
node: select(),
|
|
744
|
+
variables: {},
|
|
745
|
+
}, snapshotRefresh);
|
|
746
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
747
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
748
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
deepFreeze(snapshot.data);
|
|
752
|
+
return snapshot;
|
|
753
|
+
}
|
|
754
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
755
|
+
const key = keyBuilder$1(luvio, params);
|
|
756
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
757
|
+
const storeMetadataParams = {
|
|
758
|
+
ttl: TTL,
|
|
759
|
+
namespace: keyPrefix,
|
|
760
|
+
version: VERSION,
|
|
761
|
+
representationName: RepresentationType
|
|
762
|
+
};
|
|
763
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
764
|
+
return errorSnapshot;
|
|
765
|
+
}
|
|
766
|
+
function createResourceRequest(config) {
|
|
767
|
+
const headers = {};
|
|
768
|
+
return {
|
|
769
|
+
baseUri: '/services/data/v66.0',
|
|
770
|
+
basePath: '/connect/enablement/contributing-records/taskMeasureProgress/' + config.urlParams.taskMeasureProgressId + '',
|
|
771
|
+
method: 'get',
|
|
772
|
+
body: null,
|
|
773
|
+
urlParams: config.urlParams,
|
|
774
|
+
queryParams: {},
|
|
775
|
+
headers,
|
|
776
|
+
priority: 'normal',
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
const adapterName = 'getContributingRecordsInfoForMilestone';
|
|
781
|
+
const getContributingRecordsInfoForMilestone_ConfigPropertyMetadata = [
|
|
782
|
+
generateParamConfigMetadata('taskMeasureProgressId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
783
|
+
];
|
|
784
|
+
const getContributingRecordsInfoForMilestone_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getContributingRecordsInfoForMilestone_ConfigPropertyMetadata);
|
|
785
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$2(getContributingRecordsInfoForMilestone_ConfigPropertyMetadata);
|
|
786
|
+
function keyBuilder(luvio, config) {
|
|
787
|
+
const resourceParams = createResourceParams(config);
|
|
788
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
789
|
+
}
|
|
790
|
+
function typeCheckConfig(untrustedConfig) {
|
|
791
|
+
const config = {};
|
|
792
|
+
typeCheckConfig$2(untrustedConfig, config, getContributingRecordsInfoForMilestone_ConfigPropertyMetadata);
|
|
793
|
+
return config;
|
|
794
|
+
}
|
|
795
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
796
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
797
|
+
return null;
|
|
798
|
+
}
|
|
799
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
800
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
801
|
+
}
|
|
802
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
803
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
804
|
+
return null;
|
|
805
|
+
}
|
|
806
|
+
return config;
|
|
807
|
+
}
|
|
808
|
+
function adapterFragment(luvio, config) {
|
|
809
|
+
createResourceParams(config);
|
|
810
|
+
return select();
|
|
811
|
+
}
|
|
812
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
813
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
814
|
+
config,
|
|
815
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
816
|
+
});
|
|
817
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
818
|
+
}
|
|
819
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
820
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
821
|
+
config,
|
|
822
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
823
|
+
});
|
|
824
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
825
|
+
}
|
|
826
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
827
|
+
const resourceParams = createResourceParams(config);
|
|
828
|
+
const request = createResourceRequest(resourceParams);
|
|
829
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
830
|
+
.then((response) => {
|
|
831
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
832
|
+
const cache = new StoreKeyMap();
|
|
833
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
834
|
+
return cache;
|
|
835
|
+
});
|
|
836
|
+
}, (response) => {
|
|
837
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
841
|
+
return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
|
|
842
|
+
}
|
|
843
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
844
|
+
const { luvio, config } = context;
|
|
845
|
+
const selector = {
|
|
846
|
+
recordId: keyBuilder(luvio, config),
|
|
847
|
+
node: adapterFragment(luvio, config),
|
|
848
|
+
variables: {},
|
|
849
|
+
};
|
|
850
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
851
|
+
config,
|
|
852
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
853
|
+
});
|
|
854
|
+
return cacheSnapshot;
|
|
855
|
+
}
|
|
856
|
+
const getContributingRecordsInfoForMilestoneAdapterFactory = (luvio) => function EnablementMeasureConnectFamily__getContributingRecordsInfoForMilestone(untrustedConfig, requestContext) {
|
|
857
|
+
const config = validateAdapterConfig(untrustedConfig, getContributingRecordsInfoForMilestone_ConfigPropertyNames);
|
|
858
|
+
// Invalid or incomplete config
|
|
859
|
+
if (config === null) {
|
|
860
|
+
return null;
|
|
861
|
+
}
|
|
862
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
863
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
864
|
+
};
|
|
865
|
+
|
|
866
|
+
export { getContributingRecordsInfoForMilestoneAdapterFactory, triggerOnDemandComputationAdapterFactory };
|