@salesforce/lds-adapters-industries-field-service 0.1.0-dev1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +82 -0
- package/dist/es/es2018/industries-field-service.js +1287 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/bookAppointmentSlot.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/adapters/createProductServiceCampaign.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/adapters/createWorkOrders.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/adapters/getAppointmentSlots.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/adapters/priceItemWithCoverage.d.ts +21 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +6 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +10 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectIndustriesFieldServiceAppointmentSchedulingSlotsByServiceAppointmentIdAndSchedulingPolicyId.d.ts +17 -0
- package/dist/es/es2018/types/src/generated/resources/postConnectIndustriesFieldServiceProductServiceCampaignItemsFromList.d.ts +12 -0
- package/dist/es/es2018/types/src/generated/resources/postConnectIndustriesFieldServiceProductServiceCampaignWorkOrder.d.ts +13 -0
- package/dist/es/es2018/types/src/generated/resources/putConnectIndustriesFieldServiceAppointmentSchedulingSlotsByServiceAppointmentIdAndSchedulingPolicyId.d.ts +13 -0
- package/dist/es/es2018/types/src/generated/resources/putConnectIndustriesFieldServiceWorkOrderEstimationPriceItem.d.ts +18 -0
- package/dist/es/es2018/types/src/generated/types/AppointmentSchedulingRepresentation.d.ts +55 -0
- package/dist/es/es2018/types/src/generated/types/AppointmentSlotRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/AssetCoverageInputRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/PriceItemWithCoverageInputRepresentation.d.ts +42 -0
- package/dist/es/es2018/types/src/generated/types/PriceItemWithCoverageRepresentation.d.ts +47 -0
- package/dist/es/es2018/types/src/generated/types/ProductServiceCampaignItemsFromListInputRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/ProductServiceCampaignItemsFromListRepresentation.d.ts +44 -0
- package/dist/es/es2018/types/src/generated/types/WorkOrderForProductServiceCampaignItemInputRepresentation.d.ts +32 -0
- package/dist/es/es2018/types/src/generated/types/WorkOrderForProductServiceCampaignItemRepresentation.d.ts +44 -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 +1387 -0
- package/src/raml/api.raml +251 -0
- package/src/raml/luvio.raml +60 -0
|
@@ -0,0 +1,1287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, typeCheckConfig as typeCheckConfig$5, StoreKeyMap, createResourceParams as createResourceParams$5 } from '@luvio/engine';
|
|
8
|
+
|
|
9
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
10
|
+
const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
|
|
11
|
+
const { isArray: ArrayIsArray$1 } = Array;
|
|
12
|
+
/**
|
|
13
|
+
* Validates an adapter config is well-formed.
|
|
14
|
+
* @param config The config to validate.
|
|
15
|
+
* @param adapter The adapter validation configuration.
|
|
16
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
17
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
18
|
+
*/
|
|
19
|
+
function validateConfig(config, adapter, oneOf) {
|
|
20
|
+
const { displayName } = adapter;
|
|
21
|
+
const { required, optional, unsupported } = adapter.parameters;
|
|
22
|
+
if (config === undefined ||
|
|
23
|
+
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
24
|
+
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
25
|
+
}
|
|
26
|
+
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
27
|
+
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
28
|
+
}
|
|
29
|
+
if (unsupported !== undefined &&
|
|
30
|
+
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
31
|
+
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
32
|
+
}
|
|
33
|
+
const supported = required.concat(optional);
|
|
34
|
+
if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
|
|
35
|
+
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function untrustedIsObject(untrusted) {
|
|
39
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
40
|
+
}
|
|
41
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
42
|
+
return configPropertyNames.parameters.required.every(req => req in config);
|
|
43
|
+
}
|
|
44
|
+
const snapshotRefreshOptions = {
|
|
45
|
+
overrides: {
|
|
46
|
+
headers: {
|
|
47
|
+
'Cache-Control': 'no-cache',
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
|
|
52
|
+
return {
|
|
53
|
+
name,
|
|
54
|
+
required,
|
|
55
|
+
resourceType,
|
|
56
|
+
typeCheckShape,
|
|
57
|
+
isArrayShape,
|
|
58
|
+
coerceFn,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function buildAdapterValidationConfig(displayName, paramsMeta) {
|
|
62
|
+
const required = paramsMeta.filter(p => p.required).map(p => p.name);
|
|
63
|
+
const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
|
|
64
|
+
return {
|
|
65
|
+
displayName,
|
|
66
|
+
parameters: {
|
|
67
|
+
required,
|
|
68
|
+
optional,
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const keyPrefix = 'field-service';
|
|
73
|
+
|
|
74
|
+
const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
75
|
+
const { isArray: ArrayIsArray } = Array;
|
|
76
|
+
const { stringify: JSONStringify } = JSON;
|
|
77
|
+
function equalsArray(a, b, equalsItem) {
|
|
78
|
+
const aLength = a.length;
|
|
79
|
+
const bLength = b.length;
|
|
80
|
+
if (aLength !== bLength) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
for (let i = 0; i < aLength; i++) {
|
|
84
|
+
if (equalsItem(a[i], b[i]) === false) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
function createLink(ref) {
|
|
91
|
+
return {
|
|
92
|
+
__ref: serializeStructuredKey(ref),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const VERSION$4 = "2f0233a95128b9599e2fdc4792332572";
|
|
97
|
+
function validate$5(obj, path = 'AppointmentSlotRepresentation') {
|
|
98
|
+
const v_error = (() => {
|
|
99
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
100
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
101
|
+
}
|
|
102
|
+
const obj_finishInterval = obj.finishInterval;
|
|
103
|
+
const path_finishInterval = path + '.finishInterval';
|
|
104
|
+
if (typeof obj_finishInterval !== 'string') {
|
|
105
|
+
return new TypeError('Expected "string" but received "' + typeof obj_finishInterval + '" (at "' + path_finishInterval + '")');
|
|
106
|
+
}
|
|
107
|
+
obj.grade;
|
|
108
|
+
const obj_startInterval = obj.startInterval;
|
|
109
|
+
const path_startInterval = path + '.startInterval';
|
|
110
|
+
if (typeof obj_startInterval !== 'string') {
|
|
111
|
+
return new TypeError('Expected "string" but received "' + typeof obj_startInterval + '" (at "' + path_startInterval + '")');
|
|
112
|
+
}
|
|
113
|
+
})();
|
|
114
|
+
return v_error === undefined ? null : v_error;
|
|
115
|
+
}
|
|
116
|
+
const select$9 = function AppointmentSlotRepresentationSelect() {
|
|
117
|
+
return {
|
|
118
|
+
kind: 'Fragment',
|
|
119
|
+
version: VERSION$4,
|
|
120
|
+
private: [],
|
|
121
|
+
selections: [
|
|
122
|
+
{
|
|
123
|
+
name: 'finishInterval',
|
|
124
|
+
kind: 'Scalar'
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: 'grade',
|
|
128
|
+
kind: 'Scalar'
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: 'startInterval',
|
|
132
|
+
kind: 'Scalar'
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
function equals$4(existing, incoming) {
|
|
138
|
+
const existing_finishInterval = existing.finishInterval;
|
|
139
|
+
const incoming_finishInterval = incoming.finishInterval;
|
|
140
|
+
if (!(existing_finishInterval === incoming_finishInterval)) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
const existing_startInterval = existing.startInterval;
|
|
144
|
+
const incoming_startInterval = incoming.startInterval;
|
|
145
|
+
if (!(existing_startInterval === incoming_startInterval)) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
const existing_grade = existing.grade;
|
|
149
|
+
const incoming_grade = incoming.grade;
|
|
150
|
+
if (!(existing_grade === incoming_grade)) {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const TTL$3 = 1000;
|
|
157
|
+
const VERSION$3 = "adf3d4fd725138657e26bece6c0bc136";
|
|
158
|
+
function validate$4(obj, path = 'AppointmentSchedulingRepresentation') {
|
|
159
|
+
const v_error = (() => {
|
|
160
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
161
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
162
|
+
}
|
|
163
|
+
const obj_appointmentSlots = obj.appointmentSlots;
|
|
164
|
+
const path_appointmentSlots = path + '.appointmentSlots';
|
|
165
|
+
if (!ArrayIsArray(obj_appointmentSlots)) {
|
|
166
|
+
return new TypeError('Expected "array" but received "' + typeof obj_appointmentSlots + '" (at "' + path_appointmentSlots + '")');
|
|
167
|
+
}
|
|
168
|
+
for (let i = 0; i < obj_appointmentSlots.length; i++) {
|
|
169
|
+
const obj_appointmentSlots_item = obj_appointmentSlots[i];
|
|
170
|
+
const path_appointmentSlots_item = path_appointmentSlots + '[' + i + ']';
|
|
171
|
+
const referencepath_appointmentSlots_itemValidationError = validate$5(obj_appointmentSlots_item, path_appointmentSlots_item);
|
|
172
|
+
if (referencepath_appointmentSlots_itemValidationError !== null) {
|
|
173
|
+
let message = 'Object doesn\'t match AppointmentSlotRepresentation (at "' + path_appointmentSlots_item + '")\n';
|
|
174
|
+
message += referencepath_appointmentSlots_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
175
|
+
return new TypeError(message);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
const obj_errorCode = obj.errorCode;
|
|
179
|
+
const path_errorCode = path + '.errorCode';
|
|
180
|
+
if (typeof obj_errorCode !== 'string') {
|
|
181
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errorCode + '" (at "' + path_errorCode + '")');
|
|
182
|
+
}
|
|
183
|
+
const obj_errorMessage = obj.errorMessage;
|
|
184
|
+
const path_errorMessage = path + '.errorMessage';
|
|
185
|
+
if (typeof obj_errorMessage !== 'string') {
|
|
186
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
|
|
187
|
+
}
|
|
188
|
+
const obj_isSuccess = obj.isSuccess;
|
|
189
|
+
const path_isSuccess = path + '.isSuccess';
|
|
190
|
+
if (typeof obj_isSuccess !== 'boolean') {
|
|
191
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
|
|
192
|
+
}
|
|
193
|
+
const obj_resourceId = obj.resourceId;
|
|
194
|
+
const path_resourceId = path + '.resourceId';
|
|
195
|
+
if (typeof obj_resourceId !== 'string') {
|
|
196
|
+
return new TypeError('Expected "string" but received "' + typeof obj_resourceId + '" (at "' + path_resourceId + '")');
|
|
197
|
+
}
|
|
198
|
+
const obj_serviceAppointmentId = obj.serviceAppointmentId;
|
|
199
|
+
const path_serviceAppointmentId = path + '.serviceAppointmentId';
|
|
200
|
+
if (typeof obj_serviceAppointmentId !== 'string') {
|
|
201
|
+
return new TypeError('Expected "string" but received "' + typeof obj_serviceAppointmentId + '" (at "' + path_serviceAppointmentId + '")');
|
|
202
|
+
}
|
|
203
|
+
})();
|
|
204
|
+
return v_error === undefined ? null : v_error;
|
|
205
|
+
}
|
|
206
|
+
const RepresentationType$3 = 'AppointmentSchedulingRepresentation';
|
|
207
|
+
function keyBuilder$5(luvio, config) {
|
|
208
|
+
return keyPrefix + '::' + RepresentationType$3 + ':' + config.id;
|
|
209
|
+
}
|
|
210
|
+
function keyBuilderFromType$3(luvio, object) {
|
|
211
|
+
const keyParams = {
|
|
212
|
+
id: object.serviceAppointmentId
|
|
213
|
+
};
|
|
214
|
+
return keyBuilder$5(luvio, keyParams);
|
|
215
|
+
}
|
|
216
|
+
function normalize$3(input, existing, path, luvio, store, timestamp) {
|
|
217
|
+
return input;
|
|
218
|
+
}
|
|
219
|
+
const select$8 = function AppointmentSchedulingRepresentationSelect() {
|
|
220
|
+
const { selections: AppointmentSlotRepresentation__selections, opaque: AppointmentSlotRepresentation__opaque, } = select$9();
|
|
221
|
+
return {
|
|
222
|
+
kind: 'Fragment',
|
|
223
|
+
version: VERSION$3,
|
|
224
|
+
private: [],
|
|
225
|
+
selections: [
|
|
226
|
+
{
|
|
227
|
+
name: 'appointmentSlots',
|
|
228
|
+
kind: 'Object',
|
|
229
|
+
plural: true,
|
|
230
|
+
selections: AppointmentSlotRepresentation__selections
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
name: 'errorCode',
|
|
234
|
+
kind: 'Scalar'
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
name: 'errorMessage',
|
|
238
|
+
kind: 'Scalar'
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
name: 'isSuccess',
|
|
242
|
+
kind: 'Scalar'
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
name: 'resourceId',
|
|
246
|
+
kind: 'Scalar'
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
name: 'serviceAppointmentId',
|
|
250
|
+
kind: 'Scalar'
|
|
251
|
+
}
|
|
252
|
+
]
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
function equals$3(existing, incoming) {
|
|
256
|
+
const existing_isSuccess = existing.isSuccess;
|
|
257
|
+
const incoming_isSuccess = incoming.isSuccess;
|
|
258
|
+
if (!(existing_isSuccess === incoming_isSuccess)) {
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
const existing_errorCode = existing.errorCode;
|
|
262
|
+
const incoming_errorCode = incoming.errorCode;
|
|
263
|
+
if (!(existing_errorCode === incoming_errorCode)) {
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
const existing_errorMessage = existing.errorMessage;
|
|
267
|
+
const incoming_errorMessage = incoming.errorMessage;
|
|
268
|
+
if (!(existing_errorMessage === incoming_errorMessage)) {
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
const existing_resourceId = existing.resourceId;
|
|
272
|
+
const incoming_resourceId = incoming.resourceId;
|
|
273
|
+
if (!(existing_resourceId === incoming_resourceId)) {
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
const existing_serviceAppointmentId = existing.serviceAppointmentId;
|
|
277
|
+
const incoming_serviceAppointmentId = incoming.serviceAppointmentId;
|
|
278
|
+
if (!(existing_serviceAppointmentId === incoming_serviceAppointmentId)) {
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
const existing_appointmentSlots = existing.appointmentSlots;
|
|
282
|
+
const incoming_appointmentSlots = incoming.appointmentSlots;
|
|
283
|
+
const equals_appointmentSlots_items = equalsArray(existing_appointmentSlots, incoming_appointmentSlots, (existing_appointmentSlots_item, incoming_appointmentSlots_item) => {
|
|
284
|
+
if (!(equals$4(existing_appointmentSlots_item, incoming_appointmentSlots_item))) {
|
|
285
|
+
return false;
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
if (equals_appointmentSlots_items === false) {
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
293
|
+
const ingest$3 = function AppointmentSchedulingRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
294
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
295
|
+
const validateError = validate$4(input);
|
|
296
|
+
if (validateError !== null) {
|
|
297
|
+
throw validateError;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
const key = keyBuilderFromType$3(luvio, input);
|
|
301
|
+
const ttlToUse = TTL$3;
|
|
302
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "field-service", VERSION$3, RepresentationType$3, equals$3);
|
|
303
|
+
return createLink(key);
|
|
304
|
+
};
|
|
305
|
+
function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
|
|
306
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
307
|
+
const rootKey = keyBuilderFromType$3(luvio, input);
|
|
308
|
+
rootKeySet.set(rootKey, {
|
|
309
|
+
namespace: keyPrefix,
|
|
310
|
+
representationName: RepresentationType$3,
|
|
311
|
+
mergeable: false
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
const notifyUpdateAvailableFactory = (luvio) => {
|
|
315
|
+
return function notifyAppointmentSchedulingUpdateAvailable(configs) {
|
|
316
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
317
|
+
const requiredKeyParams = ['id'];
|
|
318
|
+
configs.forEach(config => {
|
|
319
|
+
if (false === requiredKeyParams.every(req => req in config)) {
|
|
320
|
+
throw new Error(`one of the configs did not contain all required parameters: ${JSONStringify(ObjectKeys(config))}`);
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
const keys = configs.map(c => keyBuilder$5(luvio, c));
|
|
325
|
+
return luvio.notifyStoreUpdateAvailable(keys);
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
function select$7(luvio, params) {
|
|
330
|
+
return select$8();
|
|
331
|
+
}
|
|
332
|
+
function keyBuilder$4(luvio, params) {
|
|
333
|
+
return keyBuilder$5(luvio, {
|
|
334
|
+
id: params.urlParams.serviceAppointmentId
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
function getResponseCacheKeys$4(storeKeyMap, luvio, resourceParams, response) {
|
|
338
|
+
getTypeCacheKeys$3(storeKeyMap, luvio, response);
|
|
339
|
+
}
|
|
340
|
+
function ingestSuccess$4(luvio, resourceParams, response, snapshotRefresh) {
|
|
341
|
+
const { body } = response;
|
|
342
|
+
const key = keyBuilder$4(luvio, resourceParams);
|
|
343
|
+
luvio.storeIngest(key, ingest$3, body);
|
|
344
|
+
const snapshot = luvio.storeLookup({
|
|
345
|
+
recordId: key,
|
|
346
|
+
node: select$7(),
|
|
347
|
+
variables: {},
|
|
348
|
+
}, snapshotRefresh);
|
|
349
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
350
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
351
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
deepFreeze(snapshot.data);
|
|
355
|
+
return snapshot;
|
|
356
|
+
}
|
|
357
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
358
|
+
const key = keyBuilder$4(luvio, params);
|
|
359
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
360
|
+
const storeMetadataParams = {
|
|
361
|
+
ttl: TTL$3,
|
|
362
|
+
namespace: keyPrefix,
|
|
363
|
+
version: VERSION$3,
|
|
364
|
+
representationName: RepresentationType$3
|
|
365
|
+
};
|
|
366
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
367
|
+
return errorSnapshot;
|
|
368
|
+
}
|
|
369
|
+
function createResourceRequest$4(config) {
|
|
370
|
+
const headers = {};
|
|
371
|
+
return {
|
|
372
|
+
baseUri: '/services/data/v66.0',
|
|
373
|
+
basePath: '/connect/industries-field-service/appointment-scheduling/slots/' + config.urlParams.serviceAppointmentId + '/' + config.urlParams.schedulingPolicyId + '',
|
|
374
|
+
method: 'get',
|
|
375
|
+
body: null,
|
|
376
|
+
urlParams: config.urlParams,
|
|
377
|
+
queryParams: {},
|
|
378
|
+
headers,
|
|
379
|
+
priority: 'normal',
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
const adapterName$4 = 'getAppointmentSlots';
|
|
384
|
+
const getAppointmentSlots_ConfigPropertyMetadata = [
|
|
385
|
+
generateParamConfigMetadata('serviceAppointmentId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
386
|
+
generateParamConfigMetadata('schedulingPolicyId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
387
|
+
];
|
|
388
|
+
const getAppointmentSlots_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$4, getAppointmentSlots_ConfigPropertyMetadata);
|
|
389
|
+
const createResourceParams$4 = /*#__PURE__*/ createResourceParams$5(getAppointmentSlots_ConfigPropertyMetadata);
|
|
390
|
+
function keyBuilder$3(luvio, config) {
|
|
391
|
+
const resourceParams = createResourceParams$4(config);
|
|
392
|
+
return keyBuilder$4(luvio, resourceParams);
|
|
393
|
+
}
|
|
394
|
+
function typeCheckConfig$4(untrustedConfig) {
|
|
395
|
+
const config = {};
|
|
396
|
+
typeCheckConfig$5(untrustedConfig, config, getAppointmentSlots_ConfigPropertyMetadata);
|
|
397
|
+
return config;
|
|
398
|
+
}
|
|
399
|
+
function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
|
|
400
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
401
|
+
return null;
|
|
402
|
+
}
|
|
403
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
404
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
405
|
+
}
|
|
406
|
+
const config = typeCheckConfig$4(untrustedConfig);
|
|
407
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
408
|
+
return null;
|
|
409
|
+
}
|
|
410
|
+
return config;
|
|
411
|
+
}
|
|
412
|
+
function adapterFragment(luvio, config) {
|
|
413
|
+
createResourceParams$4(config);
|
|
414
|
+
return select$7();
|
|
415
|
+
}
|
|
416
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
417
|
+
const snapshot = ingestSuccess$4(luvio, resourceParams, response, {
|
|
418
|
+
config,
|
|
419
|
+
resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
|
|
420
|
+
});
|
|
421
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
422
|
+
}
|
|
423
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
424
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
425
|
+
config,
|
|
426
|
+
resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
|
|
427
|
+
});
|
|
428
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
429
|
+
}
|
|
430
|
+
function buildNetworkSnapshot$4(luvio, config, options) {
|
|
431
|
+
const resourceParams = createResourceParams$4(config);
|
|
432
|
+
const request = createResourceRequest$4(resourceParams);
|
|
433
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
434
|
+
.then((response) => {
|
|
435
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
436
|
+
const cache = new StoreKeyMap();
|
|
437
|
+
getResponseCacheKeys$4(cache, luvio, resourceParams, response.body);
|
|
438
|
+
return cache;
|
|
439
|
+
});
|
|
440
|
+
}, (response) => {
|
|
441
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
445
|
+
return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot$4, undefined, false);
|
|
446
|
+
}
|
|
447
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
448
|
+
const { luvio, config } = context;
|
|
449
|
+
const selector = {
|
|
450
|
+
recordId: keyBuilder$3(luvio, config),
|
|
451
|
+
node: adapterFragment(luvio, config),
|
|
452
|
+
variables: {},
|
|
453
|
+
};
|
|
454
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
455
|
+
config,
|
|
456
|
+
resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
|
|
457
|
+
});
|
|
458
|
+
return cacheSnapshot;
|
|
459
|
+
}
|
|
460
|
+
const getAppointmentSlotsAdapterFactory = (luvio) => function fieldService__getAppointmentSlots(untrustedConfig, requestContext) {
|
|
461
|
+
const config = validateAdapterConfig$4(untrustedConfig, getAppointmentSlots_ConfigPropertyNames);
|
|
462
|
+
// Invalid or incomplete config
|
|
463
|
+
if (config === null) {
|
|
464
|
+
return null;
|
|
465
|
+
}
|
|
466
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
467
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
function select$6(luvio, params) {
|
|
471
|
+
return select$8();
|
|
472
|
+
}
|
|
473
|
+
function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
|
|
474
|
+
getTypeCacheKeys$3(storeKeyMap, luvio, response);
|
|
475
|
+
}
|
|
476
|
+
function ingestSuccess$3(luvio, resourceParams, response) {
|
|
477
|
+
const { body } = response;
|
|
478
|
+
const key = keyBuilderFromType$3(luvio, body);
|
|
479
|
+
luvio.storeIngest(key, ingest$3, body);
|
|
480
|
+
const snapshot = luvio.storeLookup({
|
|
481
|
+
recordId: key,
|
|
482
|
+
node: select$6(),
|
|
483
|
+
variables: {},
|
|
484
|
+
});
|
|
485
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
486
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
487
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
deepFreeze(snapshot.data);
|
|
491
|
+
return snapshot;
|
|
492
|
+
}
|
|
493
|
+
function createResourceRequest$3(config) {
|
|
494
|
+
const headers = {};
|
|
495
|
+
return {
|
|
496
|
+
baseUri: '/services/data/v66.0',
|
|
497
|
+
basePath: '/connect/industries-field-service/appointment-scheduling/slots/' + config.urlParams.serviceAppointmentId + '/' + config.urlParams.schedulingPolicyId + '',
|
|
498
|
+
method: 'put',
|
|
499
|
+
body: null,
|
|
500
|
+
urlParams: config.urlParams,
|
|
501
|
+
queryParams: {},
|
|
502
|
+
headers,
|
|
503
|
+
priority: 'normal',
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
const adapterName$3 = 'bookAppointmentSlot';
|
|
508
|
+
const bookAppointmentSlot_ConfigPropertyMetadata = [
|
|
509
|
+
generateParamConfigMetadata('serviceAppointmentId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
510
|
+
generateParamConfigMetadata('schedulingPolicyId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
511
|
+
];
|
|
512
|
+
const bookAppointmentSlot_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, bookAppointmentSlot_ConfigPropertyMetadata);
|
|
513
|
+
const createResourceParams$3 = /*#__PURE__*/ createResourceParams$5(bookAppointmentSlot_ConfigPropertyMetadata);
|
|
514
|
+
function typeCheckConfig$3(untrustedConfig) {
|
|
515
|
+
const config = {};
|
|
516
|
+
typeCheckConfig$5(untrustedConfig, config, bookAppointmentSlot_ConfigPropertyMetadata);
|
|
517
|
+
return config;
|
|
518
|
+
}
|
|
519
|
+
function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
|
|
520
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
521
|
+
return null;
|
|
522
|
+
}
|
|
523
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
524
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
525
|
+
}
|
|
526
|
+
const config = typeCheckConfig$3(untrustedConfig);
|
|
527
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
528
|
+
return null;
|
|
529
|
+
}
|
|
530
|
+
return config;
|
|
531
|
+
}
|
|
532
|
+
function buildNetworkSnapshot$3(luvio, config, options) {
|
|
533
|
+
const resourceParams = createResourceParams$3(config);
|
|
534
|
+
const request = createResourceRequest$3(resourceParams);
|
|
535
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
536
|
+
.then((response) => {
|
|
537
|
+
return luvio.handleSuccessResponse(() => {
|
|
538
|
+
const snapshot = ingestSuccess$3(luvio, resourceParams, response);
|
|
539
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
540
|
+
}, () => {
|
|
541
|
+
const cache = new StoreKeyMap();
|
|
542
|
+
getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
|
|
543
|
+
return cache;
|
|
544
|
+
});
|
|
545
|
+
}, (response) => {
|
|
546
|
+
deepFreeze(response);
|
|
547
|
+
throw response;
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
const bookAppointmentSlotAdapterFactory = (luvio) => {
|
|
551
|
+
return function bookAppointmentSlot(untrustedConfig) {
|
|
552
|
+
const config = validateAdapterConfig$3(untrustedConfig, bookAppointmentSlot_ConfigPropertyNames);
|
|
553
|
+
// Invalid or incomplete config
|
|
554
|
+
if (config === null) {
|
|
555
|
+
throw new Error('Invalid config for "bookAppointmentSlot"');
|
|
556
|
+
}
|
|
557
|
+
return buildNetworkSnapshot$3(luvio, config);
|
|
558
|
+
};
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
const TTL$2 = 300;
|
|
562
|
+
const VERSION$2 = "5c4aa8faf25b64f7b7f98f8739c11b45";
|
|
563
|
+
function validate$3(obj, path = 'ProductServiceCampaignItemsFromListRepresentation') {
|
|
564
|
+
const v_error = (() => {
|
|
565
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
566
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
567
|
+
}
|
|
568
|
+
const obj_errorCode = obj.errorCode;
|
|
569
|
+
const path_errorCode = path + '.errorCode';
|
|
570
|
+
let obj_errorCode_union0 = null;
|
|
571
|
+
const obj_errorCode_union0_error = (() => {
|
|
572
|
+
if (typeof obj_errorCode !== 'string') {
|
|
573
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errorCode + '" (at "' + path_errorCode + '")');
|
|
574
|
+
}
|
|
575
|
+
})();
|
|
576
|
+
if (obj_errorCode_union0_error != null) {
|
|
577
|
+
obj_errorCode_union0 = obj_errorCode_union0_error.message;
|
|
578
|
+
}
|
|
579
|
+
let obj_errorCode_union1 = null;
|
|
580
|
+
const obj_errorCode_union1_error = (() => {
|
|
581
|
+
if (obj_errorCode !== null) {
|
|
582
|
+
return new TypeError('Expected "null" but received "' + typeof obj_errorCode + '" (at "' + path_errorCode + '")');
|
|
583
|
+
}
|
|
584
|
+
})();
|
|
585
|
+
if (obj_errorCode_union1_error != null) {
|
|
586
|
+
obj_errorCode_union1 = obj_errorCode_union1_error.message;
|
|
587
|
+
}
|
|
588
|
+
if (obj_errorCode_union0 && obj_errorCode_union1) {
|
|
589
|
+
let message = 'Object doesn\'t match union (at "' + path_errorCode + '")';
|
|
590
|
+
message += '\n' + obj_errorCode_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
591
|
+
message += '\n' + obj_errorCode_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
592
|
+
return new TypeError(message);
|
|
593
|
+
}
|
|
594
|
+
const obj_errorMessage = obj.errorMessage;
|
|
595
|
+
const path_errorMessage = path + '.errorMessage';
|
|
596
|
+
let obj_errorMessage_union0 = null;
|
|
597
|
+
const obj_errorMessage_union0_error = (() => {
|
|
598
|
+
if (typeof obj_errorMessage !== 'string') {
|
|
599
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
|
|
600
|
+
}
|
|
601
|
+
})();
|
|
602
|
+
if (obj_errorMessage_union0_error != null) {
|
|
603
|
+
obj_errorMessage_union0 = obj_errorMessage_union0_error.message;
|
|
604
|
+
}
|
|
605
|
+
let obj_errorMessage_union1 = null;
|
|
606
|
+
const obj_errorMessage_union1_error = (() => {
|
|
607
|
+
if (obj_errorMessage !== null) {
|
|
608
|
+
return new TypeError('Expected "null" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
|
|
609
|
+
}
|
|
610
|
+
})();
|
|
611
|
+
if (obj_errorMessage_union1_error != null) {
|
|
612
|
+
obj_errorMessage_union1 = obj_errorMessage_union1_error.message;
|
|
613
|
+
}
|
|
614
|
+
if (obj_errorMessage_union0 && obj_errorMessage_union1) {
|
|
615
|
+
let message = 'Object doesn\'t match union (at "' + path_errorMessage + '")';
|
|
616
|
+
message += '\n' + obj_errorMessage_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
617
|
+
message += '\n' + obj_errorMessage_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
618
|
+
return new TypeError(message);
|
|
619
|
+
}
|
|
620
|
+
const obj_isSuccess = obj.isSuccess;
|
|
621
|
+
const path_isSuccess = path + '.isSuccess';
|
|
622
|
+
if (typeof obj_isSuccess !== 'boolean') {
|
|
623
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
|
|
624
|
+
}
|
|
625
|
+
})();
|
|
626
|
+
return v_error === undefined ? null : v_error;
|
|
627
|
+
}
|
|
628
|
+
const RepresentationType$2 = 'ProductServiceCampaignItemsFromListRepresentation';
|
|
629
|
+
function keyBuilder$2(luvio, config) {
|
|
630
|
+
return keyPrefix + '::' + RepresentationType$2 + ':' + config.isSuccess;
|
|
631
|
+
}
|
|
632
|
+
function keyBuilderFromType$2(luvio, object) {
|
|
633
|
+
const keyParams = {
|
|
634
|
+
isSuccess: object.isSuccess
|
|
635
|
+
};
|
|
636
|
+
return keyBuilder$2(luvio, keyParams);
|
|
637
|
+
}
|
|
638
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
639
|
+
return input;
|
|
640
|
+
}
|
|
641
|
+
const select$5 = function ProductServiceCampaignItemsFromListRepresentationSelect() {
|
|
642
|
+
return {
|
|
643
|
+
kind: 'Fragment',
|
|
644
|
+
version: VERSION$2,
|
|
645
|
+
private: [],
|
|
646
|
+
selections: [
|
|
647
|
+
{
|
|
648
|
+
name: 'errorCode',
|
|
649
|
+
kind: 'Scalar'
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
name: 'errorMessage',
|
|
653
|
+
kind: 'Scalar'
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
name: 'isSuccess',
|
|
657
|
+
kind: 'Scalar'
|
|
658
|
+
}
|
|
659
|
+
]
|
|
660
|
+
};
|
|
661
|
+
};
|
|
662
|
+
function equals$2(existing, incoming) {
|
|
663
|
+
const existing_isSuccess = existing.isSuccess;
|
|
664
|
+
const incoming_isSuccess = incoming.isSuccess;
|
|
665
|
+
if (!(existing_isSuccess === incoming_isSuccess)) {
|
|
666
|
+
return false;
|
|
667
|
+
}
|
|
668
|
+
const existing_errorCode = existing.errorCode;
|
|
669
|
+
const incoming_errorCode = incoming.errorCode;
|
|
670
|
+
if (!(existing_errorCode === incoming_errorCode)) {
|
|
671
|
+
return false;
|
|
672
|
+
}
|
|
673
|
+
const existing_errorMessage = existing.errorMessage;
|
|
674
|
+
const incoming_errorMessage = incoming.errorMessage;
|
|
675
|
+
if (!(existing_errorMessage === incoming_errorMessage)) {
|
|
676
|
+
return false;
|
|
677
|
+
}
|
|
678
|
+
return true;
|
|
679
|
+
}
|
|
680
|
+
const ingest$2 = function ProductServiceCampaignItemsFromListRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
681
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
682
|
+
const validateError = validate$3(input);
|
|
683
|
+
if (validateError !== null) {
|
|
684
|
+
throw validateError;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
const key = keyBuilderFromType$2(luvio, input);
|
|
688
|
+
const ttlToUse = TTL$2;
|
|
689
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "field-service", VERSION$2, RepresentationType$2, equals$2);
|
|
690
|
+
return createLink(key);
|
|
691
|
+
};
|
|
692
|
+
function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
|
|
693
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
694
|
+
const rootKey = keyBuilderFromType$2(luvio, input);
|
|
695
|
+
rootKeySet.set(rootKey, {
|
|
696
|
+
namespace: keyPrefix,
|
|
697
|
+
representationName: RepresentationType$2,
|
|
698
|
+
mergeable: false
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
function select$4(luvio, params) {
|
|
703
|
+
return select$5();
|
|
704
|
+
}
|
|
705
|
+
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
706
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response);
|
|
707
|
+
}
|
|
708
|
+
function ingestSuccess$2(luvio, resourceParams, response) {
|
|
709
|
+
const { body } = response;
|
|
710
|
+
const key = keyBuilderFromType$2(luvio, body);
|
|
711
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
712
|
+
const snapshot = luvio.storeLookup({
|
|
713
|
+
recordId: key,
|
|
714
|
+
node: select$4(),
|
|
715
|
+
variables: {},
|
|
716
|
+
});
|
|
717
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
718
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
719
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
deepFreeze(snapshot.data);
|
|
723
|
+
return snapshot;
|
|
724
|
+
}
|
|
725
|
+
function createResourceRequest$2(config) {
|
|
726
|
+
const headers = {};
|
|
727
|
+
return {
|
|
728
|
+
baseUri: '/services/data/v66.0',
|
|
729
|
+
basePath: '/connect/industries-field-service/product-service-campaign/items-from-list',
|
|
730
|
+
method: 'post',
|
|
731
|
+
body: config.body,
|
|
732
|
+
urlParams: {},
|
|
733
|
+
queryParams: {},
|
|
734
|
+
headers,
|
|
735
|
+
priority: 'normal',
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
const adapterName$2 = 'createProductServiceCampaign';
|
|
740
|
+
const createProductServiceCampaign_ConfigPropertyMetadata = [
|
|
741
|
+
generateParamConfigMetadata('actionableListId', true, 2 /* Body */, 0 /* String */),
|
|
742
|
+
];
|
|
743
|
+
const createProductServiceCampaign_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, createProductServiceCampaign_ConfigPropertyMetadata);
|
|
744
|
+
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$5(createProductServiceCampaign_ConfigPropertyMetadata);
|
|
745
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
746
|
+
const config = {};
|
|
747
|
+
typeCheckConfig$5(untrustedConfig, config, createProductServiceCampaign_ConfigPropertyMetadata);
|
|
748
|
+
return config;
|
|
749
|
+
}
|
|
750
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
751
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
752
|
+
return null;
|
|
753
|
+
}
|
|
754
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
755
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
756
|
+
}
|
|
757
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
758
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
759
|
+
return null;
|
|
760
|
+
}
|
|
761
|
+
return config;
|
|
762
|
+
}
|
|
763
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
764
|
+
const resourceParams = createResourceParams$2(config);
|
|
765
|
+
const request = createResourceRequest$2(resourceParams);
|
|
766
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
767
|
+
.then((response) => {
|
|
768
|
+
return luvio.handleSuccessResponse(() => {
|
|
769
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response);
|
|
770
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
771
|
+
}, () => {
|
|
772
|
+
const cache = new StoreKeyMap();
|
|
773
|
+
getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
|
|
774
|
+
return cache;
|
|
775
|
+
});
|
|
776
|
+
}, (response) => {
|
|
777
|
+
deepFreeze(response);
|
|
778
|
+
throw response;
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
const createProductServiceCampaignAdapterFactory = (luvio) => {
|
|
782
|
+
return function createProductServiceCampaign(untrustedConfig) {
|
|
783
|
+
const config = validateAdapterConfig$2(untrustedConfig, createProductServiceCampaign_ConfigPropertyNames);
|
|
784
|
+
// Invalid or incomplete config
|
|
785
|
+
if (config === null) {
|
|
786
|
+
throw new Error('Invalid config for "createProductServiceCampaign"');
|
|
787
|
+
}
|
|
788
|
+
return buildNetworkSnapshot$2(luvio, config);
|
|
789
|
+
};
|
|
790
|
+
};
|
|
791
|
+
|
|
792
|
+
const TTL$1 = 300;
|
|
793
|
+
const VERSION$1 = "d796fd2d8002953326366aa94516c4b3";
|
|
794
|
+
function validate$2(obj, path = 'WorkOrderForProductServiceCampaignItemRepresentation') {
|
|
795
|
+
const v_error = (() => {
|
|
796
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
797
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
798
|
+
}
|
|
799
|
+
if (obj.errorCode !== undefined) {
|
|
800
|
+
const obj_errorCode = obj.errorCode;
|
|
801
|
+
const path_errorCode = path + '.errorCode';
|
|
802
|
+
if (typeof obj_errorCode !== 'string') {
|
|
803
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errorCode + '" (at "' + path_errorCode + '")');
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
if (obj.errorMessage !== undefined) {
|
|
807
|
+
const obj_errorMessage = obj.errorMessage;
|
|
808
|
+
const path_errorMessage = path + '.errorMessage';
|
|
809
|
+
if (typeof obj_errorMessage !== 'string') {
|
|
810
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
const obj_isSuccess = obj.isSuccess;
|
|
814
|
+
const path_isSuccess = path + '.isSuccess';
|
|
815
|
+
if (typeof obj_isSuccess !== 'boolean') {
|
|
816
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
|
|
817
|
+
}
|
|
818
|
+
})();
|
|
819
|
+
return v_error === undefined ? null : v_error;
|
|
820
|
+
}
|
|
821
|
+
const RepresentationType$1 = 'WorkOrderForProductServiceCampaignItemRepresentation';
|
|
822
|
+
function keyBuilder$1(luvio, config) {
|
|
823
|
+
return keyPrefix + '::' + RepresentationType$1 + ':' + config.id;
|
|
824
|
+
}
|
|
825
|
+
function keyBuilderFromType$1(luvio, object) {
|
|
826
|
+
const keyParams = {
|
|
827
|
+
id: object.isSuccess
|
|
828
|
+
};
|
|
829
|
+
return keyBuilder$1(luvio, keyParams);
|
|
830
|
+
}
|
|
831
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
832
|
+
return input;
|
|
833
|
+
}
|
|
834
|
+
const select$3 = function WorkOrderForProductServiceCampaignItemRepresentationSelect() {
|
|
835
|
+
return {
|
|
836
|
+
kind: 'Fragment',
|
|
837
|
+
version: VERSION$1,
|
|
838
|
+
private: [],
|
|
839
|
+
selections: [
|
|
840
|
+
{
|
|
841
|
+
name: 'errorCode',
|
|
842
|
+
kind: 'Scalar',
|
|
843
|
+
required: false
|
|
844
|
+
},
|
|
845
|
+
{
|
|
846
|
+
name: 'errorMessage',
|
|
847
|
+
kind: 'Scalar',
|
|
848
|
+
required: false
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
name: 'isSuccess',
|
|
852
|
+
kind: 'Scalar'
|
|
853
|
+
}
|
|
854
|
+
]
|
|
855
|
+
};
|
|
856
|
+
};
|
|
857
|
+
function equals$1(existing, incoming) {
|
|
858
|
+
const existing_isSuccess = existing.isSuccess;
|
|
859
|
+
const incoming_isSuccess = incoming.isSuccess;
|
|
860
|
+
if (!(existing_isSuccess === incoming_isSuccess)) {
|
|
861
|
+
return false;
|
|
862
|
+
}
|
|
863
|
+
const existing_errorCode = existing.errorCode;
|
|
864
|
+
const incoming_errorCode = incoming.errorCode;
|
|
865
|
+
// if at least one of these optionals is defined
|
|
866
|
+
if (existing_errorCode !== undefined || incoming_errorCode !== undefined) {
|
|
867
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
868
|
+
// not equal
|
|
869
|
+
if (existing_errorCode === undefined || incoming_errorCode === undefined) {
|
|
870
|
+
return false;
|
|
871
|
+
}
|
|
872
|
+
if (!(existing_errorCode === incoming_errorCode)) {
|
|
873
|
+
return false;
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
const existing_errorMessage = existing.errorMessage;
|
|
877
|
+
const incoming_errorMessage = incoming.errorMessage;
|
|
878
|
+
// if at least one of these optionals is defined
|
|
879
|
+
if (existing_errorMessage !== undefined || incoming_errorMessage !== undefined) {
|
|
880
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
881
|
+
// not equal
|
|
882
|
+
if (existing_errorMessage === undefined || incoming_errorMessage === undefined) {
|
|
883
|
+
return false;
|
|
884
|
+
}
|
|
885
|
+
if (!(existing_errorMessage === incoming_errorMessage)) {
|
|
886
|
+
return false;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
return true;
|
|
890
|
+
}
|
|
891
|
+
const ingest$1 = function WorkOrderForProductServiceCampaignItemRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
892
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
893
|
+
const validateError = validate$2(input);
|
|
894
|
+
if (validateError !== null) {
|
|
895
|
+
throw validateError;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
const key = keyBuilderFromType$1(luvio, input);
|
|
899
|
+
const ttlToUse = TTL$1;
|
|
900
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "field-service", VERSION$1, RepresentationType$1, equals$1);
|
|
901
|
+
return createLink(key);
|
|
902
|
+
};
|
|
903
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
904
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
905
|
+
const rootKey = keyBuilderFromType$1(luvio, input);
|
|
906
|
+
rootKeySet.set(rootKey, {
|
|
907
|
+
namespace: keyPrefix,
|
|
908
|
+
representationName: RepresentationType$1,
|
|
909
|
+
mergeable: false
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
function select$2(luvio, params) {
|
|
914
|
+
return select$3();
|
|
915
|
+
}
|
|
916
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
917
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response);
|
|
918
|
+
}
|
|
919
|
+
function ingestSuccess$1(luvio, resourceParams, response) {
|
|
920
|
+
const { body } = response;
|
|
921
|
+
const key = keyBuilderFromType$1(luvio, body);
|
|
922
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
923
|
+
const snapshot = luvio.storeLookup({
|
|
924
|
+
recordId: key,
|
|
925
|
+
node: select$2(),
|
|
926
|
+
variables: {},
|
|
927
|
+
});
|
|
928
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
929
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
930
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
deepFreeze(snapshot.data);
|
|
934
|
+
return snapshot;
|
|
935
|
+
}
|
|
936
|
+
function createResourceRequest$1(config) {
|
|
937
|
+
const headers = {};
|
|
938
|
+
return {
|
|
939
|
+
baseUri: '/services/data/v66.0',
|
|
940
|
+
basePath: '/connect/industries-field-service/product-service-campaign/work-order',
|
|
941
|
+
method: 'post',
|
|
942
|
+
body: config.body,
|
|
943
|
+
urlParams: {},
|
|
944
|
+
queryParams: {},
|
|
945
|
+
headers,
|
|
946
|
+
priority: 'normal',
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
const adapterName$1 = 'createWorkOrders';
|
|
951
|
+
const createWorkOrders_ConfigPropertyMetadata = [
|
|
952
|
+
generateParamConfigMetadata('productServiceCampaignId', false, 2 /* Body */, 0 /* String */),
|
|
953
|
+
generateParamConfigMetadata('productServiceCampaignItemIds', false, 2 /* Body */, 4 /* Unsupported */, true),
|
|
954
|
+
];
|
|
955
|
+
const createWorkOrders_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, createWorkOrders_ConfigPropertyMetadata);
|
|
956
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$5(createWorkOrders_ConfigPropertyMetadata);
|
|
957
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
958
|
+
const config = {};
|
|
959
|
+
typeCheckConfig$5(untrustedConfig, config, createWorkOrders_ConfigPropertyMetadata);
|
|
960
|
+
const untrustedConfig_productServiceCampaignItemIds = untrustedConfig.productServiceCampaignItemIds;
|
|
961
|
+
if (ArrayIsArray$1(untrustedConfig_productServiceCampaignItemIds)) {
|
|
962
|
+
const untrustedConfig_productServiceCampaignItemIds_array = [];
|
|
963
|
+
for (let i = 0, arrayLength = untrustedConfig_productServiceCampaignItemIds.length; i < arrayLength; i++) {
|
|
964
|
+
const untrustedConfig_productServiceCampaignItemIds_item = untrustedConfig_productServiceCampaignItemIds[i];
|
|
965
|
+
if (typeof untrustedConfig_productServiceCampaignItemIds_item === 'string') {
|
|
966
|
+
untrustedConfig_productServiceCampaignItemIds_array.push(untrustedConfig_productServiceCampaignItemIds_item);
|
|
967
|
+
}
|
|
968
|
+
if (untrustedConfig_productServiceCampaignItemIds_item === null) {
|
|
969
|
+
untrustedConfig_productServiceCampaignItemIds_array.push(untrustedConfig_productServiceCampaignItemIds_item);
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
config.productServiceCampaignItemIds = untrustedConfig_productServiceCampaignItemIds_array;
|
|
973
|
+
}
|
|
974
|
+
return config;
|
|
975
|
+
}
|
|
976
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
977
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
978
|
+
return null;
|
|
979
|
+
}
|
|
980
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
981
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
982
|
+
}
|
|
983
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
984
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
985
|
+
return null;
|
|
986
|
+
}
|
|
987
|
+
return config;
|
|
988
|
+
}
|
|
989
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
990
|
+
const resourceParams = createResourceParams$1(config);
|
|
991
|
+
const request = createResourceRequest$1(resourceParams);
|
|
992
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
993
|
+
.then((response) => {
|
|
994
|
+
return luvio.handleSuccessResponse(() => {
|
|
995
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response);
|
|
996
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
997
|
+
}, () => {
|
|
998
|
+
const cache = new StoreKeyMap();
|
|
999
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
1000
|
+
return cache;
|
|
1001
|
+
});
|
|
1002
|
+
}, (response) => {
|
|
1003
|
+
deepFreeze(response);
|
|
1004
|
+
throw response;
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
const createWorkOrdersAdapterFactory = (luvio) => {
|
|
1008
|
+
return function createWorkOrders(untrustedConfig) {
|
|
1009
|
+
const config = validateAdapterConfig$1(untrustedConfig, createWorkOrders_ConfigPropertyNames);
|
|
1010
|
+
// Invalid or incomplete config
|
|
1011
|
+
if (config === null) {
|
|
1012
|
+
throw new Error('Invalid config for "createWorkOrders"');
|
|
1013
|
+
}
|
|
1014
|
+
return buildNetworkSnapshot$1(luvio, config);
|
|
1015
|
+
};
|
|
1016
|
+
};
|
|
1017
|
+
|
|
1018
|
+
function validate$1(obj, path = 'AssetCoverageInputRepresentation') {
|
|
1019
|
+
const v_error = (() => {
|
|
1020
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1021
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1022
|
+
}
|
|
1023
|
+
const obj_contractIds = obj.contractIds;
|
|
1024
|
+
const path_contractIds = path + '.contractIds';
|
|
1025
|
+
if (!ArrayIsArray(obj_contractIds)) {
|
|
1026
|
+
return new TypeError('Expected "array" but received "' + typeof obj_contractIds + '" (at "' + path_contractIds + '")');
|
|
1027
|
+
}
|
|
1028
|
+
for (let i = 0; i < obj_contractIds.length; i++) {
|
|
1029
|
+
const obj_contractIds_item = obj_contractIds[i];
|
|
1030
|
+
const path_contractIds_item = path_contractIds + '[' + i + ']';
|
|
1031
|
+
if (typeof obj_contractIds_item !== 'string') {
|
|
1032
|
+
return new TypeError('Expected "string" but received "' + typeof obj_contractIds_item + '" (at "' + path_contractIds_item + '")');
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
const obj_entitlementIds = obj.entitlementIds;
|
|
1036
|
+
const path_entitlementIds = path + '.entitlementIds';
|
|
1037
|
+
if (!ArrayIsArray(obj_entitlementIds)) {
|
|
1038
|
+
return new TypeError('Expected "array" but received "' + typeof obj_entitlementIds + '" (at "' + path_entitlementIds + '")');
|
|
1039
|
+
}
|
|
1040
|
+
for (let i = 0; i < obj_entitlementIds.length; i++) {
|
|
1041
|
+
const obj_entitlementIds_item = obj_entitlementIds[i];
|
|
1042
|
+
const path_entitlementIds_item = path_entitlementIds + '[' + i + ']';
|
|
1043
|
+
if (typeof obj_entitlementIds_item !== 'string') {
|
|
1044
|
+
return new TypeError('Expected "string" but received "' + typeof obj_entitlementIds_item + '" (at "' + path_entitlementIds_item + '")');
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
const obj_warrantyIds = obj.warrantyIds;
|
|
1048
|
+
const path_warrantyIds = path + '.warrantyIds';
|
|
1049
|
+
if (!ArrayIsArray(obj_warrantyIds)) {
|
|
1050
|
+
return new TypeError('Expected "array" but received "' + typeof obj_warrantyIds + '" (at "' + path_warrantyIds + '")');
|
|
1051
|
+
}
|
|
1052
|
+
for (let i = 0; i < obj_warrantyIds.length; i++) {
|
|
1053
|
+
const obj_warrantyIds_item = obj_warrantyIds[i];
|
|
1054
|
+
const path_warrantyIds_item = path_warrantyIds + '[' + i + ']';
|
|
1055
|
+
if (typeof obj_warrantyIds_item !== 'string') {
|
|
1056
|
+
return new TypeError('Expected "string" but received "' + typeof obj_warrantyIds_item + '" (at "' + path_warrantyIds_item + '")');
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
})();
|
|
1060
|
+
return v_error === undefined ? null : v_error;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
const TTL = 300;
|
|
1064
|
+
const VERSION = "015dacd597244984e1677034427a3f46";
|
|
1065
|
+
function validate(obj, path = 'PriceItemWithCoverageRepresentation') {
|
|
1066
|
+
const v_error = (() => {
|
|
1067
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1068
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1069
|
+
}
|
|
1070
|
+
const obj_errorCode = obj.errorCode;
|
|
1071
|
+
const path_errorCode = path + '.errorCode';
|
|
1072
|
+
if (typeof obj_errorCode !== 'string') {
|
|
1073
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errorCode + '" (at "' + path_errorCode + '")');
|
|
1074
|
+
}
|
|
1075
|
+
const obj_errorMessage = obj.errorMessage;
|
|
1076
|
+
const path_errorMessage = path + '.errorMessage';
|
|
1077
|
+
if (typeof obj_errorMessage !== 'string') {
|
|
1078
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
|
|
1079
|
+
}
|
|
1080
|
+
const obj_isSuccess = obj.isSuccess;
|
|
1081
|
+
const path_isSuccess = path + '.isSuccess';
|
|
1082
|
+
if (typeof obj_isSuccess !== 'boolean') {
|
|
1083
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
|
|
1084
|
+
}
|
|
1085
|
+
const obj_itemId = obj.itemId;
|
|
1086
|
+
const path_itemId = path + '.itemId';
|
|
1087
|
+
if (typeof obj_itemId !== 'string') {
|
|
1088
|
+
return new TypeError('Expected "string" but received "' + typeof obj_itemId + '" (at "' + path_itemId + '")');
|
|
1089
|
+
}
|
|
1090
|
+
})();
|
|
1091
|
+
return v_error === undefined ? null : v_error;
|
|
1092
|
+
}
|
|
1093
|
+
const RepresentationType = 'PriceItemWithCoverageRepresentation';
|
|
1094
|
+
function keyBuilder(luvio, config) {
|
|
1095
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.itemId;
|
|
1096
|
+
}
|
|
1097
|
+
function keyBuilderFromType(luvio, object) {
|
|
1098
|
+
const keyParams = {
|
|
1099
|
+
itemId: object.itemId
|
|
1100
|
+
};
|
|
1101
|
+
return keyBuilder(luvio, keyParams);
|
|
1102
|
+
}
|
|
1103
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
1104
|
+
return input;
|
|
1105
|
+
}
|
|
1106
|
+
const select$1 = function PriceItemWithCoverageRepresentationSelect() {
|
|
1107
|
+
return {
|
|
1108
|
+
kind: 'Fragment',
|
|
1109
|
+
version: VERSION,
|
|
1110
|
+
private: [],
|
|
1111
|
+
selections: [
|
|
1112
|
+
{
|
|
1113
|
+
name: 'errorCode',
|
|
1114
|
+
kind: 'Scalar'
|
|
1115
|
+
},
|
|
1116
|
+
{
|
|
1117
|
+
name: 'errorMessage',
|
|
1118
|
+
kind: 'Scalar'
|
|
1119
|
+
},
|
|
1120
|
+
{
|
|
1121
|
+
name: 'isSuccess',
|
|
1122
|
+
kind: 'Scalar'
|
|
1123
|
+
},
|
|
1124
|
+
{
|
|
1125
|
+
name: 'itemId',
|
|
1126
|
+
kind: 'Scalar'
|
|
1127
|
+
}
|
|
1128
|
+
]
|
|
1129
|
+
};
|
|
1130
|
+
};
|
|
1131
|
+
function equals(existing, incoming) {
|
|
1132
|
+
const existing_isSuccess = existing.isSuccess;
|
|
1133
|
+
const incoming_isSuccess = incoming.isSuccess;
|
|
1134
|
+
if (!(existing_isSuccess === incoming_isSuccess)) {
|
|
1135
|
+
return false;
|
|
1136
|
+
}
|
|
1137
|
+
const existing_errorCode = existing.errorCode;
|
|
1138
|
+
const incoming_errorCode = incoming.errorCode;
|
|
1139
|
+
if (!(existing_errorCode === incoming_errorCode)) {
|
|
1140
|
+
return false;
|
|
1141
|
+
}
|
|
1142
|
+
const existing_errorMessage = existing.errorMessage;
|
|
1143
|
+
const incoming_errorMessage = incoming.errorMessage;
|
|
1144
|
+
if (!(existing_errorMessage === incoming_errorMessage)) {
|
|
1145
|
+
return false;
|
|
1146
|
+
}
|
|
1147
|
+
const existing_itemId = existing.itemId;
|
|
1148
|
+
const incoming_itemId = incoming.itemId;
|
|
1149
|
+
if (!(existing_itemId === incoming_itemId)) {
|
|
1150
|
+
return false;
|
|
1151
|
+
}
|
|
1152
|
+
return true;
|
|
1153
|
+
}
|
|
1154
|
+
const ingest = function PriceItemWithCoverageRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1155
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1156
|
+
const validateError = validate(input);
|
|
1157
|
+
if (validateError !== null) {
|
|
1158
|
+
throw validateError;
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
const key = keyBuilderFromType(luvio, input);
|
|
1162
|
+
const ttlToUse = TTL;
|
|
1163
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "field-service", VERSION, RepresentationType, equals);
|
|
1164
|
+
return createLink(key);
|
|
1165
|
+
};
|
|
1166
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
1167
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1168
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
1169
|
+
rootKeySet.set(rootKey, {
|
|
1170
|
+
namespace: keyPrefix,
|
|
1171
|
+
representationName: RepresentationType,
|
|
1172
|
+
mergeable: false
|
|
1173
|
+
});
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
function select(luvio, params) {
|
|
1177
|
+
return select$1();
|
|
1178
|
+
}
|
|
1179
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
1180
|
+
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
1181
|
+
}
|
|
1182
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
1183
|
+
const { body } = response;
|
|
1184
|
+
const key = keyBuilderFromType(luvio, body);
|
|
1185
|
+
luvio.storeIngest(key, ingest, body);
|
|
1186
|
+
const snapshot = luvio.storeLookup({
|
|
1187
|
+
recordId: key,
|
|
1188
|
+
node: select(),
|
|
1189
|
+
variables: {},
|
|
1190
|
+
});
|
|
1191
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1192
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1193
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
deepFreeze(snapshot.data);
|
|
1197
|
+
return snapshot;
|
|
1198
|
+
}
|
|
1199
|
+
function createResourceRequest(config) {
|
|
1200
|
+
const headers = {};
|
|
1201
|
+
return {
|
|
1202
|
+
baseUri: '/services/data/v66.0',
|
|
1203
|
+
basePath: '/connect/industries-field-service/work-order-estimation/price-item',
|
|
1204
|
+
method: 'put',
|
|
1205
|
+
body: config.body,
|
|
1206
|
+
urlParams: {},
|
|
1207
|
+
queryParams: {},
|
|
1208
|
+
headers,
|
|
1209
|
+
priority: 'normal',
|
|
1210
|
+
};
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
const adapterName = 'priceItemWithCoverage';
|
|
1214
|
+
const priceItemWithCoverage_ConfigPropertyMetadata = [
|
|
1215
|
+
generateParamConfigMetadata('assetCoverageMap', true, 2 /* Body */, 4 /* Unsupported */),
|
|
1216
|
+
generateParamConfigMetadata('childItems', true, 2 /* Body */, 0 /* String */, true),
|
|
1217
|
+
generateParamConfigMetadata('itemId', true, 2 /* Body */, 0 /* String */),
|
|
1218
|
+
generateParamConfigMetadata('pricingProcedure', true, 2 /* Body */, 0 /* String */),
|
|
1219
|
+
];
|
|
1220
|
+
const priceItemWithCoverage_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, priceItemWithCoverage_ConfigPropertyMetadata);
|
|
1221
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$5(priceItemWithCoverage_ConfigPropertyMetadata);
|
|
1222
|
+
function typeCheckConfig(untrustedConfig) {
|
|
1223
|
+
const config = {};
|
|
1224
|
+
typeCheckConfig$5(untrustedConfig, config, priceItemWithCoverage_ConfigPropertyMetadata);
|
|
1225
|
+
const untrustedConfig_assetCoverageMap = untrustedConfig.assetCoverageMap;
|
|
1226
|
+
if (untrustedIsObject(untrustedConfig_assetCoverageMap)) {
|
|
1227
|
+
const untrustedConfig_assetCoverageMap_object = {};
|
|
1228
|
+
const untrustedConfig_assetCoverageMap_keys = Object.keys(untrustedConfig_assetCoverageMap);
|
|
1229
|
+
for (let i = 0, arrayLength = untrustedConfig_assetCoverageMap_keys.length; i < arrayLength; i++) {
|
|
1230
|
+
const key = untrustedConfig_assetCoverageMap_keys[i];
|
|
1231
|
+
const untrustedConfig_assetCoverageMap_prop = untrustedConfig_assetCoverageMap[key];
|
|
1232
|
+
const referenceAssetCoverageInputRepresentationValidationError = validate$1(untrustedConfig_assetCoverageMap_prop);
|
|
1233
|
+
if (referenceAssetCoverageInputRepresentationValidationError === null) {
|
|
1234
|
+
if (untrustedConfig_assetCoverageMap_object !== undefined) {
|
|
1235
|
+
untrustedConfig_assetCoverageMap_object[key] = untrustedConfig_assetCoverageMap_prop;
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
if (untrustedConfig_assetCoverageMap_object !== undefined && Object.keys(untrustedConfig_assetCoverageMap_object).length >= 0) {
|
|
1240
|
+
config.assetCoverageMap = untrustedConfig_assetCoverageMap_object;
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
return config;
|
|
1244
|
+
}
|
|
1245
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
1246
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1247
|
+
return null;
|
|
1248
|
+
}
|
|
1249
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1250
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1251
|
+
}
|
|
1252
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
1253
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1254
|
+
return null;
|
|
1255
|
+
}
|
|
1256
|
+
return config;
|
|
1257
|
+
}
|
|
1258
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
1259
|
+
const resourceParams = createResourceParams(config);
|
|
1260
|
+
const request = createResourceRequest(resourceParams);
|
|
1261
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1262
|
+
.then((response) => {
|
|
1263
|
+
return luvio.handleSuccessResponse(() => {
|
|
1264
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
1265
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1266
|
+
}, () => {
|
|
1267
|
+
const cache = new StoreKeyMap();
|
|
1268
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
1269
|
+
return cache;
|
|
1270
|
+
});
|
|
1271
|
+
}, (response) => {
|
|
1272
|
+
deepFreeze(response);
|
|
1273
|
+
throw response;
|
|
1274
|
+
});
|
|
1275
|
+
}
|
|
1276
|
+
const priceItemWithCoverageAdapterFactory = (luvio) => {
|
|
1277
|
+
return function priceItemWithCoverage(untrustedConfig) {
|
|
1278
|
+
const config = validateAdapterConfig(untrustedConfig, priceItemWithCoverage_ConfigPropertyNames);
|
|
1279
|
+
// Invalid or incomplete config
|
|
1280
|
+
if (config === null) {
|
|
1281
|
+
throw new Error('Invalid config for "priceItemWithCoverage"');
|
|
1282
|
+
}
|
|
1283
|
+
return buildNetworkSnapshot(luvio, config);
|
|
1284
|
+
};
|
|
1285
|
+
};
|
|
1286
|
+
|
|
1287
|
+
export { bookAppointmentSlotAdapterFactory, createProductServiceCampaignAdapterFactory, createWorkOrdersAdapterFactory, getAppointmentSlotsAdapterFactory, notifyUpdateAvailableFactory as notifyAppointmentSchedulingUpdateAvailableFactory, priceItemWithCoverageAdapterFactory };
|