@salesforce/lds-adapters-service-milestones 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/service-milestones.js +1030 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/getBusinessHours.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/adapters/getMilestonesDataManager.d.ts +27 -0
- package/dist/es/es2018/types/src/generated/adapters/markMilestoneCompleted.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +3 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +6 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectMilestonesBusinessHours.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectMilestonesMilestonesDataManagerByRecordId.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/resources/putConnectMilestonesMilestoneCompleted.d.ts +12 -0
- package/dist/es/es2018/types/src/generated/types/BusinessHoursRepresentation.d.ts +32 -0
- package/dist/es/es2018/types/src/generated/types/MilestoneCompletedRepresentation.d.ts +41 -0
- package/dist/es/es2018/types/src/generated/types/MilestonesDataManagerRepresentation.d.ts +58 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
- package/package.json +66 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +1083 -0
- package/src/raml/api.raml +131 -0
- package/src/raml/luvio.raml +32 -0
package/sfdc/index.js
ADDED
|
@@ -0,0 +1,1083 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* ATTENTION!
|
|
9
|
+
* THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
|
|
10
|
+
* If you would like to contribute to LDS, please follow the steps outlined in the git repo.
|
|
11
|
+
* Any changes made to this file in p4 will be automatically overwritten.
|
|
12
|
+
* *******************************************************************************************
|
|
13
|
+
*/
|
|
14
|
+
/* proxy-compat-disable */
|
|
15
|
+
import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
|
|
16
|
+
import { withDefaultLuvio } from 'force/ldsEngine';
|
|
17
|
+
import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$2, StoreKeyMap, createResourceParams as createResourceParams$3, typeCheckConfig as typeCheckConfig$3 } from 'force/luvioEngine';
|
|
18
|
+
|
|
19
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
20
|
+
const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
|
|
21
|
+
const { isArray: ArrayIsArray$1 } = Array;
|
|
22
|
+
/**
|
|
23
|
+
* Validates an adapter config is well-formed.
|
|
24
|
+
* @param config The config to validate.
|
|
25
|
+
* @param adapter The adapter validation configuration.
|
|
26
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
27
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
28
|
+
*/
|
|
29
|
+
function validateConfig(config, adapter, oneOf) {
|
|
30
|
+
const { displayName } = adapter;
|
|
31
|
+
const { required, optional, unsupported } = adapter.parameters;
|
|
32
|
+
if (config === undefined ||
|
|
33
|
+
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
34
|
+
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
35
|
+
}
|
|
36
|
+
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
37
|
+
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
38
|
+
}
|
|
39
|
+
if (unsupported !== undefined &&
|
|
40
|
+
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
41
|
+
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
42
|
+
}
|
|
43
|
+
const supported = required.concat(optional);
|
|
44
|
+
if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
|
|
45
|
+
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function untrustedIsObject(untrusted) {
|
|
49
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
50
|
+
}
|
|
51
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
52
|
+
return configPropertyNames.parameters.required.every(req => req in config);
|
|
53
|
+
}
|
|
54
|
+
const snapshotRefreshOptions = {
|
|
55
|
+
overrides: {
|
|
56
|
+
headers: {
|
|
57
|
+
'Cache-Control': 'no-cache',
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
|
|
62
|
+
return {
|
|
63
|
+
name,
|
|
64
|
+
required,
|
|
65
|
+
resourceType,
|
|
66
|
+
typeCheckShape,
|
|
67
|
+
isArrayShape,
|
|
68
|
+
coerceFn,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function buildAdapterValidationConfig(displayName, paramsMeta) {
|
|
72
|
+
const required = paramsMeta.filter(p => p.required).map(p => p.name);
|
|
73
|
+
const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
|
|
74
|
+
return {
|
|
75
|
+
displayName,
|
|
76
|
+
parameters: {
|
|
77
|
+
required,
|
|
78
|
+
optional,
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const keyPrefix = 'Milestones';
|
|
83
|
+
|
|
84
|
+
const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
85
|
+
const { isArray: ArrayIsArray } = Array;
|
|
86
|
+
const { stringify: JSONStringify } = JSON;
|
|
87
|
+
function equalsArray(a, b, equalsItem) {
|
|
88
|
+
const aLength = a.length;
|
|
89
|
+
const bLength = b.length;
|
|
90
|
+
if (aLength !== bLength) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
for (let i = 0; i < aLength; i++) {
|
|
94
|
+
if (equalsItem(a[i], b[i]) === false) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
function equalsObject(a, b, equalsProp) {
|
|
101
|
+
const aKeys = ObjectKeys(a).sort();
|
|
102
|
+
const bKeys = ObjectKeys(b).sort();
|
|
103
|
+
const aKeysLength = aKeys.length;
|
|
104
|
+
const bKeysLength = bKeys.length;
|
|
105
|
+
if (aKeysLength !== bKeysLength) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
for (let i = 0; i < aKeys.length; i++) {
|
|
109
|
+
const key = aKeys[i];
|
|
110
|
+
if (key !== bKeys[i]) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
if (equalsProp(a[key], b[key]) === false) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
function createLink(ref) {
|
|
120
|
+
return {
|
|
121
|
+
__ref: serializeStructuredKey(ref),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const TTL$2 = 100;
|
|
126
|
+
const VERSION$2 = "77385f3d3c79cead805a91e3f9f1f94b";
|
|
127
|
+
function validate$2(obj, path = 'BusinessHoursRepresentation') {
|
|
128
|
+
const v_error = (() => {
|
|
129
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
130
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
131
|
+
}
|
|
132
|
+
const obj_endTime = obj.endTime;
|
|
133
|
+
const path_endTime = path + '.endTime';
|
|
134
|
+
let obj_endTime_union0 = null;
|
|
135
|
+
const obj_endTime_union0_error = (() => {
|
|
136
|
+
if (typeof obj_endTime !== 'string') {
|
|
137
|
+
return new TypeError('Expected "string" but received "' + typeof obj_endTime + '" (at "' + path_endTime + '")');
|
|
138
|
+
}
|
|
139
|
+
})();
|
|
140
|
+
if (obj_endTime_union0_error != null) {
|
|
141
|
+
obj_endTime_union0 = obj_endTime_union0_error.message;
|
|
142
|
+
}
|
|
143
|
+
let obj_endTime_union1 = null;
|
|
144
|
+
const obj_endTime_union1_error = (() => {
|
|
145
|
+
if (obj_endTime !== null) {
|
|
146
|
+
return new TypeError('Expected "null" but received "' + typeof obj_endTime + '" (at "' + path_endTime + '")');
|
|
147
|
+
}
|
|
148
|
+
})();
|
|
149
|
+
if (obj_endTime_union1_error != null) {
|
|
150
|
+
obj_endTime_union1 = obj_endTime_union1_error.message;
|
|
151
|
+
}
|
|
152
|
+
if (obj_endTime_union0 && obj_endTime_union1) {
|
|
153
|
+
let message = 'Object doesn\'t match union (at "' + path_endTime + '")';
|
|
154
|
+
message += '\n' + obj_endTime_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
155
|
+
message += '\n' + obj_endTime_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
156
|
+
return new TypeError(message);
|
|
157
|
+
}
|
|
158
|
+
const obj_startTime = obj.startTime;
|
|
159
|
+
const path_startTime = path + '.startTime';
|
|
160
|
+
let obj_startTime_union0 = null;
|
|
161
|
+
const obj_startTime_union0_error = (() => {
|
|
162
|
+
if (typeof obj_startTime !== 'string') {
|
|
163
|
+
return new TypeError('Expected "string" but received "' + typeof obj_startTime + '" (at "' + path_startTime + '")');
|
|
164
|
+
}
|
|
165
|
+
})();
|
|
166
|
+
if (obj_startTime_union0_error != null) {
|
|
167
|
+
obj_startTime_union0 = obj_startTime_union0_error.message;
|
|
168
|
+
}
|
|
169
|
+
let obj_startTime_union1 = null;
|
|
170
|
+
const obj_startTime_union1_error = (() => {
|
|
171
|
+
if (obj_startTime !== null) {
|
|
172
|
+
return new TypeError('Expected "null" but received "' + typeof obj_startTime + '" (at "' + path_startTime + '")');
|
|
173
|
+
}
|
|
174
|
+
})();
|
|
175
|
+
if (obj_startTime_union1_error != null) {
|
|
176
|
+
obj_startTime_union1 = obj_startTime_union1_error.message;
|
|
177
|
+
}
|
|
178
|
+
if (obj_startTime_union0 && obj_startTime_union1) {
|
|
179
|
+
let message = 'Object doesn\'t match union (at "' + path_startTime + '")';
|
|
180
|
+
message += '\n' + obj_startTime_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
181
|
+
message += '\n' + obj_startTime_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
182
|
+
return new TypeError(message);
|
|
183
|
+
}
|
|
184
|
+
})();
|
|
185
|
+
return v_error === undefined ? null : v_error;
|
|
186
|
+
}
|
|
187
|
+
const RepresentationType$2 = 'BusinessHoursRepresentation';
|
|
188
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
189
|
+
return input;
|
|
190
|
+
}
|
|
191
|
+
const select$5 = function BusinessHoursRepresentationSelect() {
|
|
192
|
+
return {
|
|
193
|
+
kind: 'Fragment',
|
|
194
|
+
version: VERSION$2,
|
|
195
|
+
private: [],
|
|
196
|
+
selections: [
|
|
197
|
+
{
|
|
198
|
+
name: 'endTime',
|
|
199
|
+
kind: 'Scalar'
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
name: 'startTime',
|
|
203
|
+
kind: 'Scalar'
|
|
204
|
+
}
|
|
205
|
+
]
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
function equals$2(existing, incoming) {
|
|
209
|
+
const existing_endTime = existing.endTime;
|
|
210
|
+
const incoming_endTime = incoming.endTime;
|
|
211
|
+
if (!(existing_endTime === incoming_endTime)) {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
const existing_startTime = existing.startTime;
|
|
215
|
+
const incoming_startTime = incoming.startTime;
|
|
216
|
+
if (!(existing_startTime === incoming_startTime)) {
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
return true;
|
|
220
|
+
}
|
|
221
|
+
const ingest$2 = function BusinessHoursRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
222
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
223
|
+
const validateError = validate$2(input);
|
|
224
|
+
if (validateError !== null) {
|
|
225
|
+
throw validateError;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
const key = path.fullPath;
|
|
229
|
+
const ttlToUse = TTL$2;
|
|
230
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "Milestones", VERSION$2, RepresentationType$2, equals$2);
|
|
231
|
+
return createLink(key);
|
|
232
|
+
};
|
|
233
|
+
function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
|
|
234
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
235
|
+
const rootKey = fullPathFactory();
|
|
236
|
+
rootKeySet.set(rootKey, {
|
|
237
|
+
namespace: keyPrefix,
|
|
238
|
+
representationName: RepresentationType$2,
|
|
239
|
+
mergeable: false
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function select$4(luvio, params) {
|
|
244
|
+
return select$5();
|
|
245
|
+
}
|
|
246
|
+
function keyBuilder$4(luvio, params) {
|
|
247
|
+
return keyPrefix + '::BusinessHoursRepresentation:(' + 'businessHoursId:' + params.queryParams.businessHoursId + ',' + 'getNextDayBusinessHours:' + params.queryParams.getNextDayBusinessHours + ')';
|
|
248
|
+
}
|
|
249
|
+
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
250
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$4(luvio, resourceParams));
|
|
251
|
+
}
|
|
252
|
+
function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
|
|
253
|
+
const { body } = response;
|
|
254
|
+
const key = keyBuilder$4(luvio, resourceParams);
|
|
255
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
256
|
+
const snapshot = luvio.storeLookup({
|
|
257
|
+
recordId: key,
|
|
258
|
+
node: select$4(),
|
|
259
|
+
variables: {},
|
|
260
|
+
}, snapshotRefresh);
|
|
261
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
262
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
263
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
deepFreeze(snapshot.data);
|
|
267
|
+
return snapshot;
|
|
268
|
+
}
|
|
269
|
+
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
270
|
+
const key = keyBuilder$4(luvio, params);
|
|
271
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
272
|
+
const storeMetadataParams = {
|
|
273
|
+
ttl: TTL$2,
|
|
274
|
+
namespace: keyPrefix,
|
|
275
|
+
version: VERSION$2,
|
|
276
|
+
representationName: RepresentationType$2
|
|
277
|
+
};
|
|
278
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
279
|
+
return errorSnapshot;
|
|
280
|
+
}
|
|
281
|
+
function createResourceRequest$2(config) {
|
|
282
|
+
const headers = {};
|
|
283
|
+
return {
|
|
284
|
+
baseUri: '/services/data/v66.0',
|
|
285
|
+
basePath: '/connect/milestones/business-hours',
|
|
286
|
+
method: 'get',
|
|
287
|
+
body: null,
|
|
288
|
+
urlParams: {},
|
|
289
|
+
queryParams: config.queryParams,
|
|
290
|
+
headers,
|
|
291
|
+
priority: 'normal',
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
const adapterName$2 = 'getBusinessHours';
|
|
296
|
+
const getBusinessHours_ConfigPropertyMetadata = [
|
|
297
|
+
generateParamConfigMetadata('businessHoursId', false, 1 /* QueryParameter */, 4 /* Unsupported */),
|
|
298
|
+
generateParamConfigMetadata('getNextDayBusinessHours', false, 1 /* QueryParameter */, 4 /* Unsupported */),
|
|
299
|
+
];
|
|
300
|
+
const getBusinessHours_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getBusinessHours_ConfigPropertyMetadata);
|
|
301
|
+
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(getBusinessHours_ConfigPropertyMetadata);
|
|
302
|
+
function keyBuilder$3(luvio, config) {
|
|
303
|
+
const resourceParams = createResourceParams$2(config);
|
|
304
|
+
return keyBuilder$4(luvio, resourceParams);
|
|
305
|
+
}
|
|
306
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
307
|
+
const config = {};
|
|
308
|
+
const untrustedConfig_businessHoursId = untrustedConfig.businessHoursId;
|
|
309
|
+
if (typeof untrustedConfig_businessHoursId === 'string') {
|
|
310
|
+
config.businessHoursId = untrustedConfig_businessHoursId;
|
|
311
|
+
}
|
|
312
|
+
if (untrustedConfig_businessHoursId === null) {
|
|
313
|
+
config.businessHoursId = untrustedConfig_businessHoursId;
|
|
314
|
+
}
|
|
315
|
+
const untrustedConfig_getNextDayBusinessHours = untrustedConfig.getNextDayBusinessHours;
|
|
316
|
+
if (typeof untrustedConfig_getNextDayBusinessHours === 'boolean') {
|
|
317
|
+
config.getNextDayBusinessHours = untrustedConfig_getNextDayBusinessHours;
|
|
318
|
+
}
|
|
319
|
+
if (untrustedConfig_getNextDayBusinessHours === null) {
|
|
320
|
+
config.getNextDayBusinessHours = untrustedConfig_getNextDayBusinessHours;
|
|
321
|
+
}
|
|
322
|
+
return config;
|
|
323
|
+
}
|
|
324
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
325
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
326
|
+
return null;
|
|
327
|
+
}
|
|
328
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
329
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
330
|
+
}
|
|
331
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
332
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
333
|
+
return null;
|
|
334
|
+
}
|
|
335
|
+
return config;
|
|
336
|
+
}
|
|
337
|
+
function adapterFragment$1(luvio, config) {
|
|
338
|
+
createResourceParams$2(config);
|
|
339
|
+
return select$4();
|
|
340
|
+
}
|
|
341
|
+
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
342
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
|
|
343
|
+
config,
|
|
344
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
345
|
+
});
|
|
346
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
347
|
+
}
|
|
348
|
+
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
349
|
+
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
350
|
+
config,
|
|
351
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
352
|
+
});
|
|
353
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
354
|
+
}
|
|
355
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
356
|
+
const resourceParams = createResourceParams$2(config);
|
|
357
|
+
const request = createResourceRequest$2(resourceParams);
|
|
358
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
359
|
+
.then((response) => {
|
|
360
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
|
|
361
|
+
const cache = new StoreKeyMap();
|
|
362
|
+
getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
|
|
363
|
+
return cache;
|
|
364
|
+
});
|
|
365
|
+
}, (response) => {
|
|
366
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
370
|
+
return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
|
|
371
|
+
}
|
|
372
|
+
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
373
|
+
const { luvio, config } = context;
|
|
374
|
+
const selector = {
|
|
375
|
+
recordId: keyBuilder$3(luvio, config),
|
|
376
|
+
node: adapterFragment$1(luvio, config),
|
|
377
|
+
variables: {},
|
|
378
|
+
};
|
|
379
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
380
|
+
config,
|
|
381
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
382
|
+
});
|
|
383
|
+
return cacheSnapshot;
|
|
384
|
+
}
|
|
385
|
+
const getBusinessHoursAdapterFactory = (luvio) => function Milestones__getBusinessHours(untrustedConfig, requestContext) {
|
|
386
|
+
const config = validateAdapterConfig$2(untrustedConfig, getBusinessHours_ConfigPropertyNames);
|
|
387
|
+
// Invalid or incomplete config
|
|
388
|
+
if (config === null) {
|
|
389
|
+
return null;
|
|
390
|
+
}
|
|
391
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
392
|
+
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
const TTL$1 = 100;
|
|
396
|
+
const VERSION$1 = "a2cd71d2b2939f60d03c222feec15f36";
|
|
397
|
+
function validate$1(obj, path = 'MilestonesDataManagerRepresentation') {
|
|
398
|
+
const v_error = (() => {
|
|
399
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
400
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
401
|
+
}
|
|
402
|
+
const obj_actualTimeRemaining = obj.actualTimeRemaining;
|
|
403
|
+
const path_actualTimeRemaining = path + '.actualTimeRemaining';
|
|
404
|
+
if (typeof obj_actualTimeRemaining !== 'object' || ArrayIsArray(obj_actualTimeRemaining) || obj_actualTimeRemaining === null) {
|
|
405
|
+
return new TypeError('Expected "object" but received "' + typeof obj_actualTimeRemaining + '" (at "' + path_actualTimeRemaining + '")');
|
|
406
|
+
}
|
|
407
|
+
const obj_actualTimeRemaining_keys = ObjectKeys(obj_actualTimeRemaining);
|
|
408
|
+
for (let i = 0; i < obj_actualTimeRemaining_keys.length; i++) {
|
|
409
|
+
const key = obj_actualTimeRemaining_keys[i];
|
|
410
|
+
const obj_actualTimeRemaining_prop = obj_actualTimeRemaining[key];
|
|
411
|
+
const path_actualTimeRemaining_prop = path_actualTimeRemaining + '["' + key + '"]';
|
|
412
|
+
if (typeof obj_actualTimeRemaining_prop !== 'string') {
|
|
413
|
+
return new TypeError('Expected "string" but received "' + typeof obj_actualTimeRemaining_prop + '" (at "' + path_actualTimeRemaining_prop + '")');
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
const obj_fields = obj.fields;
|
|
417
|
+
const path_fields = path + '.fields';
|
|
418
|
+
if (!ArrayIsArray(obj_fields)) {
|
|
419
|
+
return new TypeError('Expected "array" but received "' + typeof obj_fields + '" (at "' + path_fields + '")');
|
|
420
|
+
}
|
|
421
|
+
for (let i = 0; i < obj_fields.length; i++) {
|
|
422
|
+
const obj_fields_item = obj_fields[i];
|
|
423
|
+
const path_fields_item = path_fields + '[' + i + ']';
|
|
424
|
+
if (typeof obj_fields_item !== 'string') {
|
|
425
|
+
return new TypeError('Expected "string" but received "' + typeof obj_fields_item + '" (at "' + path_fields_item + '")');
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
const obj_ignoreBusinessHours = obj.ignoreBusinessHours;
|
|
429
|
+
const path_ignoreBusinessHours = path + '.ignoreBusinessHours';
|
|
430
|
+
let obj_ignoreBusinessHours_union0 = null;
|
|
431
|
+
const obj_ignoreBusinessHours_union0_error = (() => {
|
|
432
|
+
if (typeof obj_ignoreBusinessHours !== 'boolean') {
|
|
433
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_ignoreBusinessHours + '" (at "' + path_ignoreBusinessHours + '")');
|
|
434
|
+
}
|
|
435
|
+
})();
|
|
436
|
+
if (obj_ignoreBusinessHours_union0_error != null) {
|
|
437
|
+
obj_ignoreBusinessHours_union0 = obj_ignoreBusinessHours_union0_error.message;
|
|
438
|
+
}
|
|
439
|
+
let obj_ignoreBusinessHours_union1 = null;
|
|
440
|
+
const obj_ignoreBusinessHours_union1_error = (() => {
|
|
441
|
+
if (obj_ignoreBusinessHours !== null) {
|
|
442
|
+
return new TypeError('Expected "null" but received "' + typeof obj_ignoreBusinessHours + '" (at "' + path_ignoreBusinessHours + '")');
|
|
443
|
+
}
|
|
444
|
+
})();
|
|
445
|
+
if (obj_ignoreBusinessHours_union1_error != null) {
|
|
446
|
+
obj_ignoreBusinessHours_union1 = obj_ignoreBusinessHours_union1_error.message;
|
|
447
|
+
}
|
|
448
|
+
if (obj_ignoreBusinessHours_union0 && obj_ignoreBusinessHours_union1) {
|
|
449
|
+
let message = 'Object doesn\'t match union (at "' + path_ignoreBusinessHours + '")';
|
|
450
|
+
message += '\n' + obj_ignoreBusinessHours_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
451
|
+
message += '\n' + obj_ignoreBusinessHours_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
452
|
+
return new TypeError(message);
|
|
453
|
+
}
|
|
454
|
+
const obj_milestoneAgreementTypeMap = obj.milestoneAgreementTypeMap;
|
|
455
|
+
const path_milestoneAgreementTypeMap = path + '.milestoneAgreementTypeMap';
|
|
456
|
+
if (typeof obj_milestoneAgreementTypeMap !== 'object' || ArrayIsArray(obj_milestoneAgreementTypeMap) || obj_milestoneAgreementTypeMap === null) {
|
|
457
|
+
return new TypeError('Expected "object" but received "' + typeof obj_milestoneAgreementTypeMap + '" (at "' + path_milestoneAgreementTypeMap + '")');
|
|
458
|
+
}
|
|
459
|
+
const obj_milestoneAgreementTypeMap_keys = ObjectKeys(obj_milestoneAgreementTypeMap);
|
|
460
|
+
for (let i = 0; i < obj_milestoneAgreementTypeMap_keys.length; i++) {
|
|
461
|
+
const key = obj_milestoneAgreementTypeMap_keys[i];
|
|
462
|
+
const obj_milestoneAgreementTypeMap_prop = obj_milestoneAgreementTypeMap[key];
|
|
463
|
+
const path_milestoneAgreementTypeMap_prop = path_milestoneAgreementTypeMap + '["' + key + '"]';
|
|
464
|
+
if (typeof obj_milestoneAgreementTypeMap_prop !== 'string') {
|
|
465
|
+
return new TypeError('Expected "string" but received "' + typeof obj_milestoneAgreementTypeMap_prop + '" (at "' + path_milestoneAgreementTypeMap_prop + '")');
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
const obj_overdueMilestoneIgnoreBusinessHours = obj.overdueMilestoneIgnoreBusinessHours;
|
|
469
|
+
const path_overdueMilestoneIgnoreBusinessHours = path + '.overdueMilestoneIgnoreBusinessHours';
|
|
470
|
+
let obj_overdueMilestoneIgnoreBusinessHours_union0 = null;
|
|
471
|
+
const obj_overdueMilestoneIgnoreBusinessHours_union0_error = (() => {
|
|
472
|
+
if (typeof obj_overdueMilestoneIgnoreBusinessHours !== 'boolean') {
|
|
473
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_overdueMilestoneIgnoreBusinessHours + '" (at "' + path_overdueMilestoneIgnoreBusinessHours + '")');
|
|
474
|
+
}
|
|
475
|
+
})();
|
|
476
|
+
if (obj_overdueMilestoneIgnoreBusinessHours_union0_error != null) {
|
|
477
|
+
obj_overdueMilestoneIgnoreBusinessHours_union0 = obj_overdueMilestoneIgnoreBusinessHours_union0_error.message;
|
|
478
|
+
}
|
|
479
|
+
let obj_overdueMilestoneIgnoreBusinessHours_union1 = null;
|
|
480
|
+
const obj_overdueMilestoneIgnoreBusinessHours_union1_error = (() => {
|
|
481
|
+
if (obj_overdueMilestoneIgnoreBusinessHours !== null) {
|
|
482
|
+
return new TypeError('Expected "null" but received "' + typeof obj_overdueMilestoneIgnoreBusinessHours + '" (at "' + path_overdueMilestoneIgnoreBusinessHours + '")');
|
|
483
|
+
}
|
|
484
|
+
})();
|
|
485
|
+
if (obj_overdueMilestoneIgnoreBusinessHours_union1_error != null) {
|
|
486
|
+
obj_overdueMilestoneIgnoreBusinessHours_union1 = obj_overdueMilestoneIgnoreBusinessHours_union1_error.message;
|
|
487
|
+
}
|
|
488
|
+
if (obj_overdueMilestoneIgnoreBusinessHours_union0 && obj_overdueMilestoneIgnoreBusinessHours_union1) {
|
|
489
|
+
let message = 'Object doesn\'t match union (at "' + path_overdueMilestoneIgnoreBusinessHours + '")';
|
|
490
|
+
message += '\n' + obj_overdueMilestoneIgnoreBusinessHours_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
491
|
+
message += '\n' + obj_overdueMilestoneIgnoreBusinessHours_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
492
|
+
return new TypeError(message);
|
|
493
|
+
}
|
|
494
|
+
const obj_recordIds = obj.recordIds;
|
|
495
|
+
const path_recordIds = path + '.recordIds';
|
|
496
|
+
if (!ArrayIsArray(obj_recordIds)) {
|
|
497
|
+
return new TypeError('Expected "array" but received "' + typeof obj_recordIds + '" (at "' + path_recordIds + '")');
|
|
498
|
+
}
|
|
499
|
+
for (let i = 0; i < obj_recordIds.length; i++) {
|
|
500
|
+
const obj_recordIds_item = obj_recordIds[i];
|
|
501
|
+
const path_recordIds_item = path_recordIds + '[' + i + ']';
|
|
502
|
+
if (typeof obj_recordIds_item !== 'string') {
|
|
503
|
+
return new TypeError('Expected "string" but received "' + typeof obj_recordIds_item + '" (at "' + path_recordIds_item + '")');
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
const obj_slaExitDate = obj.slaExitDate;
|
|
507
|
+
const path_slaExitDate = path + '.slaExitDate';
|
|
508
|
+
let obj_slaExitDate_union0 = null;
|
|
509
|
+
const obj_slaExitDate_union0_error = (() => {
|
|
510
|
+
if (typeof obj_slaExitDate !== 'string') {
|
|
511
|
+
return new TypeError('Expected "string" but received "' + typeof obj_slaExitDate + '" (at "' + path_slaExitDate + '")');
|
|
512
|
+
}
|
|
513
|
+
})();
|
|
514
|
+
if (obj_slaExitDate_union0_error != null) {
|
|
515
|
+
obj_slaExitDate_union0 = obj_slaExitDate_union0_error.message;
|
|
516
|
+
}
|
|
517
|
+
let obj_slaExitDate_union1 = null;
|
|
518
|
+
const obj_slaExitDate_union1_error = (() => {
|
|
519
|
+
if (obj_slaExitDate !== null) {
|
|
520
|
+
return new TypeError('Expected "null" but received "' + typeof obj_slaExitDate + '" (at "' + path_slaExitDate + '")');
|
|
521
|
+
}
|
|
522
|
+
})();
|
|
523
|
+
if (obj_slaExitDate_union1_error != null) {
|
|
524
|
+
obj_slaExitDate_union1 = obj_slaExitDate_union1_error.message;
|
|
525
|
+
}
|
|
526
|
+
if (obj_slaExitDate_union0 && obj_slaExitDate_union1) {
|
|
527
|
+
let message = 'Object doesn\'t match union (at "' + path_slaExitDate + '")';
|
|
528
|
+
message += '\n' + obj_slaExitDate_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
529
|
+
message += '\n' + obj_slaExitDate_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
530
|
+
return new TypeError(message);
|
|
531
|
+
}
|
|
532
|
+
const obj_stopStartDate = obj.stopStartDate;
|
|
533
|
+
const path_stopStartDate = path + '.stopStartDate';
|
|
534
|
+
let obj_stopStartDate_union0 = null;
|
|
535
|
+
const obj_stopStartDate_union0_error = (() => {
|
|
536
|
+
if (typeof obj_stopStartDate !== 'string') {
|
|
537
|
+
return new TypeError('Expected "string" but received "' + typeof obj_stopStartDate + '" (at "' + path_stopStartDate + '")');
|
|
538
|
+
}
|
|
539
|
+
})();
|
|
540
|
+
if (obj_stopStartDate_union0_error != null) {
|
|
541
|
+
obj_stopStartDate_union0 = obj_stopStartDate_union0_error.message;
|
|
542
|
+
}
|
|
543
|
+
let obj_stopStartDate_union1 = null;
|
|
544
|
+
const obj_stopStartDate_union1_error = (() => {
|
|
545
|
+
if (obj_stopStartDate !== null) {
|
|
546
|
+
return new TypeError('Expected "null" but received "' + typeof obj_stopStartDate + '" (at "' + path_stopStartDate + '")');
|
|
547
|
+
}
|
|
548
|
+
})();
|
|
549
|
+
if (obj_stopStartDate_union1_error != null) {
|
|
550
|
+
obj_stopStartDate_union1 = obj_stopStartDate_union1_error.message;
|
|
551
|
+
}
|
|
552
|
+
if (obj_stopStartDate_union0 && obj_stopStartDate_union1) {
|
|
553
|
+
let message = 'Object doesn\'t match union (at "' + path_stopStartDate + '")';
|
|
554
|
+
message += '\n' + obj_stopStartDate_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
555
|
+
message += '\n' + obj_stopStartDate_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
556
|
+
return new TypeError(message);
|
|
557
|
+
}
|
|
558
|
+
})();
|
|
559
|
+
return v_error === undefined ? null : v_error;
|
|
560
|
+
}
|
|
561
|
+
const RepresentationType$1 = 'MilestonesDataManagerRepresentation';
|
|
562
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
563
|
+
return input;
|
|
564
|
+
}
|
|
565
|
+
const select$3 = function MilestonesDataManagerRepresentationSelect() {
|
|
566
|
+
return {
|
|
567
|
+
kind: 'Fragment',
|
|
568
|
+
version: VERSION$1,
|
|
569
|
+
private: [],
|
|
570
|
+
selections: [
|
|
571
|
+
{
|
|
572
|
+
name: 'actualTimeRemaining',
|
|
573
|
+
kind: 'Scalar',
|
|
574
|
+
map: true
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
name: 'fields',
|
|
578
|
+
kind: 'Scalar',
|
|
579
|
+
plural: true
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
name: 'ignoreBusinessHours',
|
|
583
|
+
kind: 'Scalar'
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
name: 'milestoneAgreementTypeMap',
|
|
587
|
+
kind: 'Scalar',
|
|
588
|
+
map: true
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
name: 'overdueMilestoneIgnoreBusinessHours',
|
|
592
|
+
kind: 'Scalar'
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
name: 'recordIds',
|
|
596
|
+
kind: 'Scalar',
|
|
597
|
+
plural: true
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
name: 'slaExitDate',
|
|
601
|
+
kind: 'Scalar'
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
name: 'stopStartDate',
|
|
605
|
+
kind: 'Scalar'
|
|
606
|
+
}
|
|
607
|
+
]
|
|
608
|
+
};
|
|
609
|
+
};
|
|
610
|
+
function equals$1(existing, incoming) {
|
|
611
|
+
const existing_actualTimeRemaining = existing.actualTimeRemaining;
|
|
612
|
+
const incoming_actualTimeRemaining = incoming.actualTimeRemaining;
|
|
613
|
+
const equals_actualTimeRemaining_props = equalsObject(existing_actualTimeRemaining, incoming_actualTimeRemaining, (existing_actualTimeRemaining_prop, incoming_actualTimeRemaining_prop) => {
|
|
614
|
+
if (!(existing_actualTimeRemaining_prop === incoming_actualTimeRemaining_prop)) {
|
|
615
|
+
return false;
|
|
616
|
+
}
|
|
617
|
+
});
|
|
618
|
+
if (equals_actualTimeRemaining_props === false) {
|
|
619
|
+
return false;
|
|
620
|
+
}
|
|
621
|
+
const existing_fields = existing.fields;
|
|
622
|
+
const incoming_fields = incoming.fields;
|
|
623
|
+
const equals_fields_items = equalsArray(existing_fields, incoming_fields, (existing_fields_item, incoming_fields_item) => {
|
|
624
|
+
if (!(existing_fields_item === incoming_fields_item)) {
|
|
625
|
+
return false;
|
|
626
|
+
}
|
|
627
|
+
});
|
|
628
|
+
if (equals_fields_items === false) {
|
|
629
|
+
return false;
|
|
630
|
+
}
|
|
631
|
+
const existing_ignoreBusinessHours = existing.ignoreBusinessHours;
|
|
632
|
+
const incoming_ignoreBusinessHours = incoming.ignoreBusinessHours;
|
|
633
|
+
if (!(existing_ignoreBusinessHours === incoming_ignoreBusinessHours)) {
|
|
634
|
+
return false;
|
|
635
|
+
}
|
|
636
|
+
const existing_milestoneAgreementTypeMap = existing.milestoneAgreementTypeMap;
|
|
637
|
+
const incoming_milestoneAgreementTypeMap = incoming.milestoneAgreementTypeMap;
|
|
638
|
+
const equals_milestoneAgreementTypeMap_props = equalsObject(existing_milestoneAgreementTypeMap, incoming_milestoneAgreementTypeMap, (existing_milestoneAgreementTypeMap_prop, incoming_milestoneAgreementTypeMap_prop) => {
|
|
639
|
+
if (!(existing_milestoneAgreementTypeMap_prop === incoming_milestoneAgreementTypeMap_prop)) {
|
|
640
|
+
return false;
|
|
641
|
+
}
|
|
642
|
+
});
|
|
643
|
+
if (equals_milestoneAgreementTypeMap_props === false) {
|
|
644
|
+
return false;
|
|
645
|
+
}
|
|
646
|
+
const existing_overdueMilestoneIgnoreBusinessHours = existing.overdueMilestoneIgnoreBusinessHours;
|
|
647
|
+
const incoming_overdueMilestoneIgnoreBusinessHours = incoming.overdueMilestoneIgnoreBusinessHours;
|
|
648
|
+
if (!(existing_overdueMilestoneIgnoreBusinessHours === incoming_overdueMilestoneIgnoreBusinessHours)) {
|
|
649
|
+
return false;
|
|
650
|
+
}
|
|
651
|
+
const existing_recordIds = existing.recordIds;
|
|
652
|
+
const incoming_recordIds = incoming.recordIds;
|
|
653
|
+
const equals_recordIds_items = equalsArray(existing_recordIds, incoming_recordIds, (existing_recordIds_item, incoming_recordIds_item) => {
|
|
654
|
+
if (!(existing_recordIds_item === incoming_recordIds_item)) {
|
|
655
|
+
return false;
|
|
656
|
+
}
|
|
657
|
+
});
|
|
658
|
+
if (equals_recordIds_items === false) {
|
|
659
|
+
return false;
|
|
660
|
+
}
|
|
661
|
+
const existing_slaExitDate = existing.slaExitDate;
|
|
662
|
+
const incoming_slaExitDate = incoming.slaExitDate;
|
|
663
|
+
if (!(existing_slaExitDate === incoming_slaExitDate)) {
|
|
664
|
+
return false;
|
|
665
|
+
}
|
|
666
|
+
const existing_stopStartDate = existing.stopStartDate;
|
|
667
|
+
const incoming_stopStartDate = incoming.stopStartDate;
|
|
668
|
+
if (!(existing_stopStartDate === incoming_stopStartDate)) {
|
|
669
|
+
return false;
|
|
670
|
+
}
|
|
671
|
+
return true;
|
|
672
|
+
}
|
|
673
|
+
const ingest$1 = function MilestonesDataManagerRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
674
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
675
|
+
const validateError = validate$1(input);
|
|
676
|
+
if (validateError !== null) {
|
|
677
|
+
throw validateError;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
const key = path.fullPath;
|
|
681
|
+
const ttlToUse = TTL$1;
|
|
682
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "Milestones", VERSION$1, RepresentationType$1, equals$1);
|
|
683
|
+
return createLink(key);
|
|
684
|
+
};
|
|
685
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
686
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
687
|
+
const rootKey = fullPathFactory();
|
|
688
|
+
rootKeySet.set(rootKey, {
|
|
689
|
+
namespace: keyPrefix,
|
|
690
|
+
representationName: RepresentationType$1,
|
|
691
|
+
mergeable: false
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
function select$2(luvio, params) {
|
|
696
|
+
return select$3();
|
|
697
|
+
}
|
|
698
|
+
function keyBuilder$2(luvio, params) {
|
|
699
|
+
return keyPrefix + '::MilestonesDataManagerRepresentation:(' + 'recordId:' + params.urlParams.recordId + ')';
|
|
700
|
+
}
|
|
701
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
702
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$2(luvio, resourceParams));
|
|
703
|
+
}
|
|
704
|
+
function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
705
|
+
const { body } = response;
|
|
706
|
+
const key = keyBuilder$2(luvio, resourceParams);
|
|
707
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
708
|
+
const snapshot = luvio.storeLookup({
|
|
709
|
+
recordId: key,
|
|
710
|
+
node: select$2(),
|
|
711
|
+
variables: {},
|
|
712
|
+
}, snapshotRefresh);
|
|
713
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
714
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
715
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
deepFreeze(snapshot.data);
|
|
719
|
+
return snapshot;
|
|
720
|
+
}
|
|
721
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
722
|
+
const key = keyBuilder$2(luvio, params);
|
|
723
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
724
|
+
const storeMetadataParams = {
|
|
725
|
+
ttl: TTL$1,
|
|
726
|
+
namespace: keyPrefix,
|
|
727
|
+
version: VERSION$1,
|
|
728
|
+
representationName: RepresentationType$1
|
|
729
|
+
};
|
|
730
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
731
|
+
return errorSnapshot;
|
|
732
|
+
}
|
|
733
|
+
function createResourceRequest$1(config) {
|
|
734
|
+
const headers = {};
|
|
735
|
+
return {
|
|
736
|
+
baseUri: '/services/data/v66.0',
|
|
737
|
+
basePath: '/connect/milestones/milestones-data-manager/' + config.urlParams.recordId + '',
|
|
738
|
+
method: 'get',
|
|
739
|
+
body: null,
|
|
740
|
+
urlParams: config.urlParams,
|
|
741
|
+
queryParams: {},
|
|
742
|
+
headers,
|
|
743
|
+
priority: 'normal',
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
const adapterName$1 = 'getMilestonesDataManager';
|
|
748
|
+
const getMilestonesDataManager_ConfigPropertyMetadata = [
|
|
749
|
+
generateParamConfigMetadata('recordId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
750
|
+
];
|
|
751
|
+
const getMilestonesDataManager_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getMilestonesDataManager_ConfigPropertyMetadata);
|
|
752
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(getMilestonesDataManager_ConfigPropertyMetadata);
|
|
753
|
+
function keyBuilder$1(luvio, config) {
|
|
754
|
+
const resourceParams = createResourceParams$1(config);
|
|
755
|
+
return keyBuilder$2(luvio, resourceParams);
|
|
756
|
+
}
|
|
757
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
758
|
+
const config = {};
|
|
759
|
+
typeCheckConfig$3(untrustedConfig, config, getMilestonesDataManager_ConfigPropertyMetadata);
|
|
760
|
+
return config;
|
|
761
|
+
}
|
|
762
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
763
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
764
|
+
return null;
|
|
765
|
+
}
|
|
766
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
767
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
768
|
+
}
|
|
769
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
770
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
771
|
+
return null;
|
|
772
|
+
}
|
|
773
|
+
return config;
|
|
774
|
+
}
|
|
775
|
+
function adapterFragment(luvio, config) {
|
|
776
|
+
createResourceParams$1(config);
|
|
777
|
+
return select$2();
|
|
778
|
+
}
|
|
779
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
780
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
|
|
781
|
+
config,
|
|
782
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
783
|
+
});
|
|
784
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
785
|
+
}
|
|
786
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
787
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
788
|
+
config,
|
|
789
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
790
|
+
});
|
|
791
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
792
|
+
}
|
|
793
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
794
|
+
const resourceParams = createResourceParams$1(config);
|
|
795
|
+
const request = createResourceRequest$1(resourceParams);
|
|
796
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
797
|
+
.then((response) => {
|
|
798
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
799
|
+
const cache = new StoreKeyMap();
|
|
800
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
801
|
+
return cache;
|
|
802
|
+
});
|
|
803
|
+
}, (response) => {
|
|
804
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
808
|
+
return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
|
|
809
|
+
}
|
|
810
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
811
|
+
const { luvio, config } = context;
|
|
812
|
+
const selector = {
|
|
813
|
+
recordId: keyBuilder$1(luvio, config),
|
|
814
|
+
node: adapterFragment(luvio, config),
|
|
815
|
+
variables: {},
|
|
816
|
+
};
|
|
817
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
818
|
+
config,
|
|
819
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
820
|
+
});
|
|
821
|
+
return cacheSnapshot;
|
|
822
|
+
}
|
|
823
|
+
const getMilestonesDataManagerAdapterFactory = (luvio) => function Milestones__getMilestonesDataManager(untrustedConfig, requestContext) {
|
|
824
|
+
const config = validateAdapterConfig$1(untrustedConfig, getMilestonesDataManager_ConfigPropertyNames);
|
|
825
|
+
// Invalid or incomplete config
|
|
826
|
+
if (config === null) {
|
|
827
|
+
return null;
|
|
828
|
+
}
|
|
829
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
830
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
831
|
+
};
|
|
832
|
+
|
|
833
|
+
const TTL = 100;
|
|
834
|
+
const VERSION = "2225350c2bb6b0628fe14b755cc2f9ee";
|
|
835
|
+
function validate(obj, path = 'MilestoneCompletedRepresentation') {
|
|
836
|
+
const v_error = (() => {
|
|
837
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
838
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
839
|
+
}
|
|
840
|
+
const obj_completed = obj.completed;
|
|
841
|
+
const path_completed = path + '.completed';
|
|
842
|
+
let obj_completed_union0 = null;
|
|
843
|
+
const obj_completed_union0_error = (() => {
|
|
844
|
+
if (typeof obj_completed !== 'boolean') {
|
|
845
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_completed + '" (at "' + path_completed + '")');
|
|
846
|
+
}
|
|
847
|
+
})();
|
|
848
|
+
if (obj_completed_union0_error != null) {
|
|
849
|
+
obj_completed_union0 = obj_completed_union0_error.message;
|
|
850
|
+
}
|
|
851
|
+
let obj_completed_union1 = null;
|
|
852
|
+
const obj_completed_union1_error = (() => {
|
|
853
|
+
if (obj_completed !== null) {
|
|
854
|
+
return new TypeError('Expected "null" but received "' + typeof obj_completed + '" (at "' + path_completed + '")');
|
|
855
|
+
}
|
|
856
|
+
})();
|
|
857
|
+
if (obj_completed_union1_error != null) {
|
|
858
|
+
obj_completed_union1 = obj_completed_union1_error.message;
|
|
859
|
+
}
|
|
860
|
+
if (obj_completed_union0 && obj_completed_union1) {
|
|
861
|
+
let message = 'Object doesn\'t match union (at "' + path_completed + '")';
|
|
862
|
+
message += '\n' + obj_completed_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
863
|
+
message += '\n' + obj_completed_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
864
|
+
return new TypeError(message);
|
|
865
|
+
}
|
|
866
|
+
const obj_milestoneId = obj.milestoneId;
|
|
867
|
+
const path_milestoneId = path + '.milestoneId';
|
|
868
|
+
let obj_milestoneId_union0 = null;
|
|
869
|
+
const obj_milestoneId_union0_error = (() => {
|
|
870
|
+
if (typeof obj_milestoneId !== 'string') {
|
|
871
|
+
return new TypeError('Expected "string" but received "' + typeof obj_milestoneId + '" (at "' + path_milestoneId + '")');
|
|
872
|
+
}
|
|
873
|
+
})();
|
|
874
|
+
if (obj_milestoneId_union0_error != null) {
|
|
875
|
+
obj_milestoneId_union0 = obj_milestoneId_union0_error.message;
|
|
876
|
+
}
|
|
877
|
+
let obj_milestoneId_union1 = null;
|
|
878
|
+
const obj_milestoneId_union1_error = (() => {
|
|
879
|
+
if (obj_milestoneId !== null) {
|
|
880
|
+
return new TypeError('Expected "null" but received "' + typeof obj_milestoneId + '" (at "' + path_milestoneId + '")');
|
|
881
|
+
}
|
|
882
|
+
})();
|
|
883
|
+
if (obj_milestoneId_union1_error != null) {
|
|
884
|
+
obj_milestoneId_union1 = obj_milestoneId_union1_error.message;
|
|
885
|
+
}
|
|
886
|
+
if (obj_milestoneId_union0 && obj_milestoneId_union1) {
|
|
887
|
+
let message = 'Object doesn\'t match union (at "' + path_milestoneId + '")';
|
|
888
|
+
message += '\n' + obj_milestoneId_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
889
|
+
message += '\n' + obj_milestoneId_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
890
|
+
return new TypeError(message);
|
|
891
|
+
}
|
|
892
|
+
})();
|
|
893
|
+
return v_error === undefined ? null : v_error;
|
|
894
|
+
}
|
|
895
|
+
const RepresentationType = 'MilestoneCompletedRepresentation';
|
|
896
|
+
function keyBuilder(luvio, config) {
|
|
897
|
+
return keyPrefix + '::' + RepresentationType + ':' + (config.requestId === null ? '' : config.requestId);
|
|
898
|
+
}
|
|
899
|
+
function keyBuilderFromType(luvio, object) {
|
|
900
|
+
const keyParams = {
|
|
901
|
+
requestId: object.milestoneId
|
|
902
|
+
};
|
|
903
|
+
return keyBuilder(luvio, keyParams);
|
|
904
|
+
}
|
|
905
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
906
|
+
return input;
|
|
907
|
+
}
|
|
908
|
+
const select$1 = function MilestoneCompletedRepresentationSelect() {
|
|
909
|
+
return {
|
|
910
|
+
kind: 'Fragment',
|
|
911
|
+
version: VERSION,
|
|
912
|
+
private: [],
|
|
913
|
+
opaque: true
|
|
914
|
+
};
|
|
915
|
+
};
|
|
916
|
+
function equals(existing, incoming) {
|
|
917
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
918
|
+
return false;
|
|
919
|
+
}
|
|
920
|
+
return true;
|
|
921
|
+
}
|
|
922
|
+
const ingest = function MilestoneCompletedRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
923
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
924
|
+
const validateError = validate(input);
|
|
925
|
+
if (validateError !== null) {
|
|
926
|
+
throw validateError;
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
const key = keyBuilderFromType(luvio, input);
|
|
930
|
+
const ttlToUse = TTL;
|
|
931
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "Milestones", VERSION, RepresentationType, equals);
|
|
932
|
+
return createLink(key);
|
|
933
|
+
};
|
|
934
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
935
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
936
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
937
|
+
rootKeySet.set(rootKey, {
|
|
938
|
+
namespace: keyPrefix,
|
|
939
|
+
representationName: RepresentationType,
|
|
940
|
+
mergeable: false
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
function select(luvio, params) {
|
|
945
|
+
return select$1();
|
|
946
|
+
}
|
|
947
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
948
|
+
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
949
|
+
}
|
|
950
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
951
|
+
const { body } = response;
|
|
952
|
+
const key = keyBuilderFromType(luvio, body);
|
|
953
|
+
luvio.storeIngest(key, ingest, body);
|
|
954
|
+
const snapshot = luvio.storeLookup({
|
|
955
|
+
recordId: key,
|
|
956
|
+
node: select(),
|
|
957
|
+
variables: {},
|
|
958
|
+
});
|
|
959
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
960
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
961
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
deepFreeze(snapshot.data);
|
|
965
|
+
return snapshot;
|
|
966
|
+
}
|
|
967
|
+
function createResourceRequest(config) {
|
|
968
|
+
const headers = {};
|
|
969
|
+
return {
|
|
970
|
+
baseUri: '/services/data/v66.0',
|
|
971
|
+
basePath: '/connect/milestones/milestone-completed',
|
|
972
|
+
method: 'put',
|
|
973
|
+
body: null,
|
|
974
|
+
urlParams: {},
|
|
975
|
+
queryParams: config.queryParams,
|
|
976
|
+
headers,
|
|
977
|
+
priority: 'normal',
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
const adapterName = 'markMilestoneCompleted';
|
|
982
|
+
const markMilestoneCompleted_ConfigPropertyMetadata = [
|
|
983
|
+
generateParamConfigMetadata('milestoneId', false, 1 /* QueryParameter */, 4 /* Unsupported */),
|
|
984
|
+
];
|
|
985
|
+
const markMilestoneCompleted_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, markMilestoneCompleted_ConfigPropertyMetadata);
|
|
986
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$3(markMilestoneCompleted_ConfigPropertyMetadata);
|
|
987
|
+
function typeCheckConfig(untrustedConfig) {
|
|
988
|
+
const config = {};
|
|
989
|
+
const untrustedConfig_milestoneId = untrustedConfig.milestoneId;
|
|
990
|
+
if (typeof untrustedConfig_milestoneId === 'string') {
|
|
991
|
+
config.milestoneId = untrustedConfig_milestoneId;
|
|
992
|
+
}
|
|
993
|
+
if (untrustedConfig_milestoneId === null) {
|
|
994
|
+
config.milestoneId = untrustedConfig_milestoneId;
|
|
995
|
+
}
|
|
996
|
+
return config;
|
|
997
|
+
}
|
|
998
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
999
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1000
|
+
return null;
|
|
1001
|
+
}
|
|
1002
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1003
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1004
|
+
}
|
|
1005
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
1006
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1007
|
+
return null;
|
|
1008
|
+
}
|
|
1009
|
+
return config;
|
|
1010
|
+
}
|
|
1011
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
1012
|
+
const resourceParams = createResourceParams(config);
|
|
1013
|
+
const request = createResourceRequest(resourceParams);
|
|
1014
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1015
|
+
.then((response) => {
|
|
1016
|
+
return luvio.handleSuccessResponse(() => {
|
|
1017
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
1018
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1019
|
+
}, () => {
|
|
1020
|
+
const cache = new StoreKeyMap();
|
|
1021
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
1022
|
+
return cache;
|
|
1023
|
+
});
|
|
1024
|
+
}, (response) => {
|
|
1025
|
+
deepFreeze(response);
|
|
1026
|
+
throw response;
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
const markMilestoneCompletedAdapterFactory = (luvio) => {
|
|
1030
|
+
return function markMilestoneCompleted(untrustedConfig) {
|
|
1031
|
+
const config = validateAdapterConfig(untrustedConfig, markMilestoneCompleted_ConfigPropertyNames);
|
|
1032
|
+
// Invalid or incomplete config
|
|
1033
|
+
if (config === null) {
|
|
1034
|
+
throw new Error('Invalid config for "markMilestoneCompleted"');
|
|
1035
|
+
}
|
|
1036
|
+
return buildNetworkSnapshot(luvio, config);
|
|
1037
|
+
};
|
|
1038
|
+
};
|
|
1039
|
+
|
|
1040
|
+
let getBusinessHours;
|
|
1041
|
+
let getMilestonesDataManager;
|
|
1042
|
+
let markMilestoneCompleted;
|
|
1043
|
+
// Imperative GET Adapters
|
|
1044
|
+
let getBusinessHours_imperative;
|
|
1045
|
+
let getMilestonesDataManager_imperative;
|
|
1046
|
+
// Adapter Metadata
|
|
1047
|
+
const getBusinessHoursMetadata = { apiFamily: 'Milestones', name: 'getBusinessHours', ttl: 100 };
|
|
1048
|
+
const getMilestonesDataManagerMetadata = {
|
|
1049
|
+
apiFamily: 'Milestones',
|
|
1050
|
+
name: 'getMilestonesDataManager',
|
|
1051
|
+
ttl: 100,
|
|
1052
|
+
};
|
|
1053
|
+
// Notify Update Available
|
|
1054
|
+
function bindExportsTo(luvio) {
|
|
1055
|
+
// LDS Adapters
|
|
1056
|
+
const getBusinessHours_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getBusinessHours', getBusinessHoursAdapterFactory), getBusinessHoursMetadata);
|
|
1057
|
+
const getMilestonesDataManager_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getMilestonesDataManager', getMilestonesDataManagerAdapterFactory), getMilestonesDataManagerMetadata);
|
|
1058
|
+
function unwrapSnapshotData(factory) {
|
|
1059
|
+
const adapter = factory(luvio);
|
|
1060
|
+
return (config) => adapter(config).then((snapshot) => snapshot.data);
|
|
1061
|
+
}
|
|
1062
|
+
return {
|
|
1063
|
+
getBusinessHours: createWireAdapterConstructor(luvio, getBusinessHours_ldsAdapter, getBusinessHoursMetadata),
|
|
1064
|
+
getMilestonesDataManager: createWireAdapterConstructor(luvio, getMilestonesDataManager_ldsAdapter, getMilestonesDataManagerMetadata),
|
|
1065
|
+
markMilestoneCompleted: unwrapSnapshotData(markMilestoneCompletedAdapterFactory),
|
|
1066
|
+
// Imperative GET Adapters
|
|
1067
|
+
getBusinessHours_imperative: createImperativeAdapter(luvio, getBusinessHours_ldsAdapter, getBusinessHoursMetadata),
|
|
1068
|
+
getMilestonesDataManager_imperative: createImperativeAdapter(luvio, getMilestonesDataManager_ldsAdapter, getMilestonesDataManagerMetadata),
|
|
1069
|
+
// Notify Update Availables
|
|
1070
|
+
};
|
|
1071
|
+
}
|
|
1072
|
+
withDefaultLuvio((luvio) => {
|
|
1073
|
+
({
|
|
1074
|
+
getBusinessHours,
|
|
1075
|
+
getMilestonesDataManager,
|
|
1076
|
+
markMilestoneCompleted,
|
|
1077
|
+
getBusinessHours_imperative,
|
|
1078
|
+
getMilestonesDataManager_imperative,
|
|
1079
|
+
} = bindExportsTo(luvio));
|
|
1080
|
+
});
|
|
1081
|
+
|
|
1082
|
+
export { getBusinessHours, getBusinessHours_imperative, getMilestonesDataManager, getMilestonesDataManager_imperative, markMilestoneCompleted };
|
|
1083
|
+
// version: 0.1.0-dev1-c978a7b010
|