@salesforce/lds-adapters-service-serviceplan 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-serviceplan.js +1647 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/executeServicePlan.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/adapters/generateServicePlan.d.ts +23 -0
- package/dist/es/es2018/types/src/generated/adapters/getGenerationRequest.d.ts +27 -0
- package/dist/es/es2018/types/src/generated/adapters/getServicePlan.d.ts +28 -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 +11 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectServicePlanGenerationRequestsByRequestId.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectServicePlanServicePlanDetailsByRecordId.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/resources/postConnectServicePlanGenerationRequests.d.ts +22 -0
- package/dist/es/es2018/types/src/generated/resources/putConnectServicePlanExecuteByPlanOrStepId.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/types/ServicePlanDetailsOutputRepresentation.d.ts +60 -0
- package/dist/es/es2018/types/src/generated/types/ServicePlanDetailsRepresentation.d.ts +53 -0
- package/dist/es/es2018/types/src/generated/types/ServicePlanExecutionInputRepresentation.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/types/ServicePlanExecutionOutputRepresentation.d.ts +50 -0
- package/dist/es/es2018/types/src/generated/types/ServicePlanGenerationInputMapRepresentation.d.ts +32 -0
- package/dist/es/es2018/types/src/generated/types/ServicePlanGenerationInputParamRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/ServicePlanGenerationOutputRepresentation.d.ts +57 -0
- package/dist/es/es2018/types/src/generated/types/ServicePlanReferenceDetailsRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/ServicePlanStepCitationSourceRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/ServicePlanStepDetailsRepresentation.d.ts +54 -0
- package/dist/es/es2018/types/src/generated/types/ServicePlanStepExecutionStatusRepresentation.d.ts +31 -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 +1752 -0
- package/src/raml/api.raml +351 -0
- package/src/raml/luvio.raml +57 -0
|
@@ -0,0 +1,1647 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$4, typeCheckConfig as typeCheckConfig$4, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$2 } 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 = 'ServicePlan';
|
|
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 = "de8249c0171ece44729fbb33b422a074";
|
|
97
|
+
function validate$7(obj, path = 'ServicePlanStepExecutionStatusRepresentation') {
|
|
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_executionStatus = obj.executionStatus;
|
|
103
|
+
const path_executionStatus = path + '.executionStatus';
|
|
104
|
+
if (typeof obj_executionStatus !== 'string') {
|
|
105
|
+
return new TypeError('Expected "string" but received "' + typeof obj_executionStatus + '" (at "' + path_executionStatus + '")');
|
|
106
|
+
}
|
|
107
|
+
const obj_stepId = obj.stepId;
|
|
108
|
+
const path_stepId = path + '.stepId';
|
|
109
|
+
let obj_stepId_union0 = null;
|
|
110
|
+
const obj_stepId_union0_error = (() => {
|
|
111
|
+
if (typeof obj_stepId !== 'string') {
|
|
112
|
+
return new TypeError('Expected "string" but received "' + typeof obj_stepId + '" (at "' + path_stepId + '")');
|
|
113
|
+
}
|
|
114
|
+
})();
|
|
115
|
+
if (obj_stepId_union0_error != null) {
|
|
116
|
+
obj_stepId_union0 = obj_stepId_union0_error.message;
|
|
117
|
+
}
|
|
118
|
+
let obj_stepId_union1 = null;
|
|
119
|
+
const obj_stepId_union1_error = (() => {
|
|
120
|
+
if (obj_stepId !== null) {
|
|
121
|
+
return new TypeError('Expected "null" but received "' + typeof obj_stepId + '" (at "' + path_stepId + '")');
|
|
122
|
+
}
|
|
123
|
+
})();
|
|
124
|
+
if (obj_stepId_union1_error != null) {
|
|
125
|
+
obj_stepId_union1 = obj_stepId_union1_error.message;
|
|
126
|
+
}
|
|
127
|
+
if (obj_stepId_union0 && obj_stepId_union1) {
|
|
128
|
+
let message = 'Object doesn\'t match union (at "' + path_stepId + '")';
|
|
129
|
+
message += '\n' + obj_stepId_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
130
|
+
message += '\n' + obj_stepId_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
131
|
+
return new TypeError(message);
|
|
132
|
+
}
|
|
133
|
+
})();
|
|
134
|
+
return v_error === undefined ? null : v_error;
|
|
135
|
+
}
|
|
136
|
+
const RepresentationType$4 = 'ServicePlanStepExecutionStatusRepresentation';
|
|
137
|
+
function normalize$4(input, existing, path, luvio, store, timestamp) {
|
|
138
|
+
return input;
|
|
139
|
+
}
|
|
140
|
+
const select$8 = function ServicePlanStepExecutionStatusRepresentationSelect() {
|
|
141
|
+
return {
|
|
142
|
+
kind: 'Fragment',
|
|
143
|
+
version: VERSION$4,
|
|
144
|
+
private: [],
|
|
145
|
+
opaque: true
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
function equals$4(existing, incoming) {
|
|
149
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
const ingest$4 = function ServicePlanStepExecutionStatusRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
155
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
156
|
+
const validateError = validate$7(input);
|
|
157
|
+
if (validateError !== null) {
|
|
158
|
+
throw validateError;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
const key = path.fullPath;
|
|
162
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 500;
|
|
163
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$4, "ServicePlan", VERSION$4, RepresentationType$4, equals$4);
|
|
164
|
+
return createLink(key);
|
|
165
|
+
};
|
|
166
|
+
function getTypeCacheKeys$4(rootKeySet, luvio, input, fullPathFactory) {
|
|
167
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
168
|
+
const rootKey = fullPathFactory();
|
|
169
|
+
rootKeySet.set(rootKey, {
|
|
170
|
+
namespace: keyPrefix,
|
|
171
|
+
representationName: RepresentationType$4,
|
|
172
|
+
mergeable: false
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const VERSION$3 = "f3a6de28bf56634adca757ba07accf43";
|
|
177
|
+
function validate$6(obj, path = 'ServicePlanExecutionOutputRepresentation') {
|
|
178
|
+
const v_error = (() => {
|
|
179
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
180
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
181
|
+
}
|
|
182
|
+
const obj_executionStatus = obj.executionStatus;
|
|
183
|
+
const path_executionStatus = path + '.executionStatus';
|
|
184
|
+
if (typeof obj_executionStatus !== 'string') {
|
|
185
|
+
return new TypeError('Expected "string" but received "' + typeof obj_executionStatus + '" (at "' + path_executionStatus + '")');
|
|
186
|
+
}
|
|
187
|
+
const obj_planSteps = obj.planSteps;
|
|
188
|
+
const path_planSteps = path + '.planSteps';
|
|
189
|
+
if (!ArrayIsArray(obj_planSteps)) {
|
|
190
|
+
return new TypeError('Expected "array" but received "' + typeof obj_planSteps + '" (at "' + path_planSteps + '")');
|
|
191
|
+
}
|
|
192
|
+
for (let i = 0; i < obj_planSteps.length; i++) {
|
|
193
|
+
const obj_planSteps_item = obj_planSteps[i];
|
|
194
|
+
const path_planSteps_item = path_planSteps + '[' + i + ']';
|
|
195
|
+
if (typeof obj_planSteps_item !== 'object' || Array.isArray(obj_planSteps_item)) {
|
|
196
|
+
return new TypeError('Expected "object" but received "' + typeof obj_planSteps_item + '" (at "' + path_planSteps_item + '")');
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
})();
|
|
200
|
+
return v_error === undefined ? null : v_error;
|
|
201
|
+
}
|
|
202
|
+
const RepresentationType$3 = 'ServicePlanExecutionOutputRepresentation';
|
|
203
|
+
function keyBuilder$6(luvio, config) {
|
|
204
|
+
return keyPrefix + '::' + RepresentationType$3 + ':' + config.id;
|
|
205
|
+
}
|
|
206
|
+
function keyBuilderFromType$2(luvio, object) {
|
|
207
|
+
const keyParams = {
|
|
208
|
+
id: object.executionStatus
|
|
209
|
+
};
|
|
210
|
+
return keyBuilder$6(luvio, keyParams);
|
|
211
|
+
}
|
|
212
|
+
function normalize$3(input, existing, path, luvio, store, timestamp) {
|
|
213
|
+
const input_planSteps = input.planSteps;
|
|
214
|
+
const input_planSteps_id = path.fullPath + '__planSteps';
|
|
215
|
+
for (let i = 0; i < input_planSteps.length; i++) {
|
|
216
|
+
const input_planSteps_item = input_planSteps[i];
|
|
217
|
+
let input_planSteps_item_id = input_planSteps_id + '__' + i;
|
|
218
|
+
input_planSteps[i] = ingest$4(input_planSteps_item, {
|
|
219
|
+
fullPath: input_planSteps_item_id,
|
|
220
|
+
propertyName: i,
|
|
221
|
+
parent: {
|
|
222
|
+
data: input,
|
|
223
|
+
key: path.fullPath,
|
|
224
|
+
existing: existing,
|
|
225
|
+
},
|
|
226
|
+
ttl: path.ttl
|
|
227
|
+
}, luvio, store, timestamp);
|
|
228
|
+
}
|
|
229
|
+
return input;
|
|
230
|
+
}
|
|
231
|
+
const select$7 = function ServicePlanExecutionOutputRepresentationSelect() {
|
|
232
|
+
return {
|
|
233
|
+
kind: 'Fragment',
|
|
234
|
+
version: VERSION$3,
|
|
235
|
+
private: [],
|
|
236
|
+
selections: [
|
|
237
|
+
{
|
|
238
|
+
name: 'executionStatus',
|
|
239
|
+
kind: 'Scalar'
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
name: 'planSteps',
|
|
243
|
+
kind: 'Link',
|
|
244
|
+
plural: true,
|
|
245
|
+
fragment: select$8()
|
|
246
|
+
}
|
|
247
|
+
]
|
|
248
|
+
};
|
|
249
|
+
};
|
|
250
|
+
function equals$3(existing, incoming) {
|
|
251
|
+
const existing_executionStatus = existing.executionStatus;
|
|
252
|
+
const incoming_executionStatus = incoming.executionStatus;
|
|
253
|
+
if (!(existing_executionStatus === incoming_executionStatus)) {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
const existing_planSteps = existing.planSteps;
|
|
257
|
+
const incoming_planSteps = incoming.planSteps;
|
|
258
|
+
const equals_planSteps_items = equalsArray(existing_planSteps, incoming_planSteps, (existing_planSteps_item, incoming_planSteps_item) => {
|
|
259
|
+
if (!(existing_planSteps_item.__ref === incoming_planSteps_item.__ref)) {
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
if (equals_planSteps_items === false) {
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
return true;
|
|
267
|
+
}
|
|
268
|
+
const ingest$3 = function ServicePlanExecutionOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
269
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
270
|
+
const validateError = validate$6(input);
|
|
271
|
+
if (validateError !== null) {
|
|
272
|
+
throw validateError;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
const key = keyBuilderFromType$2(luvio, input);
|
|
276
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 500;
|
|
277
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "ServicePlan", VERSION$3, RepresentationType$3, equals$3);
|
|
278
|
+
return createLink(key);
|
|
279
|
+
};
|
|
280
|
+
function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
|
|
281
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
282
|
+
const rootKey = keyBuilderFromType$2(luvio, input);
|
|
283
|
+
rootKeySet.set(rootKey, {
|
|
284
|
+
namespace: keyPrefix,
|
|
285
|
+
representationName: RepresentationType$3,
|
|
286
|
+
mergeable: false
|
|
287
|
+
});
|
|
288
|
+
const input_planSteps_length = input.planSteps.length;
|
|
289
|
+
for (let i = 0; i < input_planSteps_length; i++) {
|
|
290
|
+
getTypeCacheKeys$4(rootKeySet, luvio, input.planSteps[i], () => '');
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
function select$6(luvio, params) {
|
|
295
|
+
return select$7();
|
|
296
|
+
}
|
|
297
|
+
function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
|
|
298
|
+
getTypeCacheKeys$3(storeKeyMap, luvio, response);
|
|
299
|
+
}
|
|
300
|
+
function ingestSuccess$3(luvio, resourceParams, response) {
|
|
301
|
+
const { body } = response;
|
|
302
|
+
const key = keyBuilderFromType$2(luvio, body);
|
|
303
|
+
luvio.storeIngest(key, ingest$3, body);
|
|
304
|
+
const snapshot = luvio.storeLookup({
|
|
305
|
+
recordId: key,
|
|
306
|
+
node: select$6(),
|
|
307
|
+
variables: {},
|
|
308
|
+
});
|
|
309
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
310
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
311
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
deepFreeze(snapshot.data);
|
|
315
|
+
return snapshot;
|
|
316
|
+
}
|
|
317
|
+
function createResourceRequest$3(config) {
|
|
318
|
+
const headers = {};
|
|
319
|
+
return {
|
|
320
|
+
baseUri: '/services/data/v66.0',
|
|
321
|
+
basePath: '/connect/service-plan/execute/' + config.urlParams.planOrStepId + '',
|
|
322
|
+
method: 'put',
|
|
323
|
+
body: config.body,
|
|
324
|
+
urlParams: config.urlParams,
|
|
325
|
+
queryParams: {},
|
|
326
|
+
headers,
|
|
327
|
+
priority: 'normal',
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
const adapterName$3 = 'executeServicePlan';
|
|
332
|
+
const executeServicePlan_ConfigPropertyMetadata = [
|
|
333
|
+
generateParamConfigMetadata('planOrStepId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
334
|
+
generateParamConfigMetadata('action', true, 2 /* Body */, 0 /* String */),
|
|
335
|
+
];
|
|
336
|
+
const executeServicePlan_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, executeServicePlan_ConfigPropertyMetadata);
|
|
337
|
+
const createResourceParams$3 = /*#__PURE__*/ createResourceParams$4(executeServicePlan_ConfigPropertyMetadata);
|
|
338
|
+
function typeCheckConfig$3(untrustedConfig) {
|
|
339
|
+
const config = {};
|
|
340
|
+
typeCheckConfig$4(untrustedConfig, config, executeServicePlan_ConfigPropertyMetadata);
|
|
341
|
+
return config;
|
|
342
|
+
}
|
|
343
|
+
function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
|
|
344
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
345
|
+
return null;
|
|
346
|
+
}
|
|
347
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
348
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
349
|
+
}
|
|
350
|
+
const config = typeCheckConfig$3(untrustedConfig);
|
|
351
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
352
|
+
return null;
|
|
353
|
+
}
|
|
354
|
+
return config;
|
|
355
|
+
}
|
|
356
|
+
function buildNetworkSnapshot$3(luvio, config, options) {
|
|
357
|
+
const resourceParams = createResourceParams$3(config);
|
|
358
|
+
const request = createResourceRequest$3(resourceParams);
|
|
359
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
360
|
+
.then((response) => {
|
|
361
|
+
return luvio.handleSuccessResponse(() => {
|
|
362
|
+
const snapshot = ingestSuccess$3(luvio, resourceParams, response);
|
|
363
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
364
|
+
}, () => {
|
|
365
|
+
const cache = new StoreKeyMap();
|
|
366
|
+
getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
|
|
367
|
+
return cache;
|
|
368
|
+
});
|
|
369
|
+
}, (response) => {
|
|
370
|
+
deepFreeze(response);
|
|
371
|
+
throw response;
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
const executeServicePlanAdapterFactory = (luvio) => {
|
|
375
|
+
return function executeServicePlan(untrustedConfig) {
|
|
376
|
+
const config = validateAdapterConfig$3(untrustedConfig, executeServicePlan_ConfigPropertyNames);
|
|
377
|
+
// Invalid or incomplete config
|
|
378
|
+
if (config === null) {
|
|
379
|
+
throw new Error('Invalid config for "executeServicePlan"');
|
|
380
|
+
}
|
|
381
|
+
return buildNetworkSnapshot$3(luvio, config);
|
|
382
|
+
};
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
const TTL$1 = 1000;
|
|
386
|
+
const VERSION$2 = "e7b90a0cede064026bfdd02757e2d945";
|
|
387
|
+
function validate$5(obj, path = 'ServicePlanGenerationOutputRepresentation') {
|
|
388
|
+
const v_error = (() => {
|
|
389
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
390
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
391
|
+
}
|
|
392
|
+
const obj_errorCode = obj.errorCode;
|
|
393
|
+
const path_errorCode = path + '.errorCode';
|
|
394
|
+
let obj_errorCode_union0 = null;
|
|
395
|
+
const obj_errorCode_union0_error = (() => {
|
|
396
|
+
if (typeof obj_errorCode !== 'string') {
|
|
397
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errorCode + '" (at "' + path_errorCode + '")');
|
|
398
|
+
}
|
|
399
|
+
})();
|
|
400
|
+
if (obj_errorCode_union0_error != null) {
|
|
401
|
+
obj_errorCode_union0 = obj_errorCode_union0_error.message;
|
|
402
|
+
}
|
|
403
|
+
let obj_errorCode_union1 = null;
|
|
404
|
+
const obj_errorCode_union1_error = (() => {
|
|
405
|
+
if (obj_errorCode !== null) {
|
|
406
|
+
return new TypeError('Expected "null" but received "' + typeof obj_errorCode + '" (at "' + path_errorCode + '")');
|
|
407
|
+
}
|
|
408
|
+
})();
|
|
409
|
+
if (obj_errorCode_union1_error != null) {
|
|
410
|
+
obj_errorCode_union1 = obj_errorCode_union1_error.message;
|
|
411
|
+
}
|
|
412
|
+
if (obj_errorCode_union0 && obj_errorCode_union1) {
|
|
413
|
+
let message = 'Object doesn\'t match union (at "' + path_errorCode + '")';
|
|
414
|
+
message += '\n' + obj_errorCode_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
415
|
+
message += '\n' + obj_errorCode_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
416
|
+
return new TypeError(message);
|
|
417
|
+
}
|
|
418
|
+
const obj_errorMessage = obj.errorMessage;
|
|
419
|
+
const path_errorMessage = path + '.errorMessage';
|
|
420
|
+
let obj_errorMessage_union0 = null;
|
|
421
|
+
const obj_errorMessage_union0_error = (() => {
|
|
422
|
+
if (typeof obj_errorMessage !== 'string') {
|
|
423
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
|
|
424
|
+
}
|
|
425
|
+
})();
|
|
426
|
+
if (obj_errorMessage_union0_error != null) {
|
|
427
|
+
obj_errorMessage_union0 = obj_errorMessage_union0_error.message;
|
|
428
|
+
}
|
|
429
|
+
let obj_errorMessage_union1 = null;
|
|
430
|
+
const obj_errorMessage_union1_error = (() => {
|
|
431
|
+
if (obj_errorMessage !== null) {
|
|
432
|
+
return new TypeError('Expected "null" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
|
|
433
|
+
}
|
|
434
|
+
})();
|
|
435
|
+
if (obj_errorMessage_union1_error != null) {
|
|
436
|
+
obj_errorMessage_union1 = obj_errorMessage_union1_error.message;
|
|
437
|
+
}
|
|
438
|
+
if (obj_errorMessage_union0 && obj_errorMessage_union1) {
|
|
439
|
+
let message = 'Object doesn\'t match union (at "' + path_errorMessage + '")';
|
|
440
|
+
message += '\n' + obj_errorMessage_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
441
|
+
message += '\n' + obj_errorMessage_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
442
|
+
return new TypeError(message);
|
|
443
|
+
}
|
|
444
|
+
const obj_id = obj.id;
|
|
445
|
+
const path_id = path + '.id';
|
|
446
|
+
let obj_id_union0 = null;
|
|
447
|
+
const obj_id_union0_error = (() => {
|
|
448
|
+
if (typeof obj_id !== 'string') {
|
|
449
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
450
|
+
}
|
|
451
|
+
})();
|
|
452
|
+
if (obj_id_union0_error != null) {
|
|
453
|
+
obj_id_union0 = obj_id_union0_error.message;
|
|
454
|
+
}
|
|
455
|
+
let obj_id_union1 = null;
|
|
456
|
+
const obj_id_union1_error = (() => {
|
|
457
|
+
if (obj_id !== null) {
|
|
458
|
+
return new TypeError('Expected "null" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
459
|
+
}
|
|
460
|
+
})();
|
|
461
|
+
if (obj_id_union1_error != null) {
|
|
462
|
+
obj_id_union1 = obj_id_union1_error.message;
|
|
463
|
+
}
|
|
464
|
+
if (obj_id_union0 && obj_id_union1) {
|
|
465
|
+
let message = 'Object doesn\'t match union (at "' + path_id + '")';
|
|
466
|
+
message += '\n' + obj_id_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
467
|
+
message += '\n' + obj_id_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
468
|
+
return new TypeError(message);
|
|
469
|
+
}
|
|
470
|
+
const obj_reason = obj.reason;
|
|
471
|
+
const path_reason = path + '.reason';
|
|
472
|
+
if (typeof obj_reason !== 'string') {
|
|
473
|
+
return new TypeError('Expected "string" but received "' + typeof obj_reason + '" (at "' + path_reason + '")');
|
|
474
|
+
}
|
|
475
|
+
const obj_recordId = obj.recordId;
|
|
476
|
+
const path_recordId = path + '.recordId';
|
|
477
|
+
if (typeof obj_recordId !== 'string') {
|
|
478
|
+
return new TypeError('Expected "string" but received "' + typeof obj_recordId + '" (at "' + path_recordId + '")');
|
|
479
|
+
}
|
|
480
|
+
const obj_status = obj.status;
|
|
481
|
+
const path_status = path + '.status';
|
|
482
|
+
if (typeof obj_status !== 'string') {
|
|
483
|
+
return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
|
|
484
|
+
}
|
|
485
|
+
const obj_type = obj.type;
|
|
486
|
+
const path_type = path + '.type';
|
|
487
|
+
if (typeof obj_type !== 'string') {
|
|
488
|
+
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
489
|
+
}
|
|
490
|
+
})();
|
|
491
|
+
return v_error === undefined ? null : v_error;
|
|
492
|
+
}
|
|
493
|
+
const RepresentationType$2 = 'ServicePlanGenerationOutputRepresentation';
|
|
494
|
+
function keyBuilder$5(luvio, config) {
|
|
495
|
+
return keyPrefix + '::' + RepresentationType$2 + ':' + (config.id === null ? '' : config.id);
|
|
496
|
+
}
|
|
497
|
+
function keyBuilderFromType$1(luvio, object) {
|
|
498
|
+
const keyParams = {
|
|
499
|
+
id: object.id
|
|
500
|
+
};
|
|
501
|
+
return keyBuilder$5(luvio, keyParams);
|
|
502
|
+
}
|
|
503
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
504
|
+
return input;
|
|
505
|
+
}
|
|
506
|
+
const select$5 = function ServicePlanGenerationOutputRepresentationSelect() {
|
|
507
|
+
return {
|
|
508
|
+
kind: 'Fragment',
|
|
509
|
+
version: VERSION$2,
|
|
510
|
+
private: [],
|
|
511
|
+
selections: [
|
|
512
|
+
{
|
|
513
|
+
name: 'errorCode',
|
|
514
|
+
kind: 'Scalar'
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
name: 'errorMessage',
|
|
518
|
+
kind: 'Scalar'
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
name: 'id',
|
|
522
|
+
kind: 'Scalar'
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
name: 'reason',
|
|
526
|
+
kind: 'Scalar'
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
name: 'recordId',
|
|
530
|
+
kind: 'Scalar'
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
name: 'status',
|
|
534
|
+
kind: 'Scalar'
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
name: 'type',
|
|
538
|
+
kind: 'Scalar'
|
|
539
|
+
}
|
|
540
|
+
]
|
|
541
|
+
};
|
|
542
|
+
};
|
|
543
|
+
function equals$2(existing, incoming) {
|
|
544
|
+
const existing_reason = existing.reason;
|
|
545
|
+
const incoming_reason = incoming.reason;
|
|
546
|
+
if (!(existing_reason === incoming_reason)) {
|
|
547
|
+
return false;
|
|
548
|
+
}
|
|
549
|
+
const existing_recordId = existing.recordId;
|
|
550
|
+
const incoming_recordId = incoming.recordId;
|
|
551
|
+
if (!(existing_recordId === incoming_recordId)) {
|
|
552
|
+
return false;
|
|
553
|
+
}
|
|
554
|
+
const existing_status = existing.status;
|
|
555
|
+
const incoming_status = incoming.status;
|
|
556
|
+
if (!(existing_status === incoming_status)) {
|
|
557
|
+
return false;
|
|
558
|
+
}
|
|
559
|
+
const existing_type = existing.type;
|
|
560
|
+
const incoming_type = incoming.type;
|
|
561
|
+
if (!(existing_type === incoming_type)) {
|
|
562
|
+
return false;
|
|
563
|
+
}
|
|
564
|
+
const existing_errorCode = existing.errorCode;
|
|
565
|
+
const incoming_errorCode = incoming.errorCode;
|
|
566
|
+
if (!(existing_errorCode === incoming_errorCode)) {
|
|
567
|
+
return false;
|
|
568
|
+
}
|
|
569
|
+
const existing_errorMessage = existing.errorMessage;
|
|
570
|
+
const incoming_errorMessage = incoming.errorMessage;
|
|
571
|
+
if (!(existing_errorMessage === incoming_errorMessage)) {
|
|
572
|
+
return false;
|
|
573
|
+
}
|
|
574
|
+
const existing_id = existing.id;
|
|
575
|
+
const incoming_id = incoming.id;
|
|
576
|
+
if (!(existing_id === incoming_id)) {
|
|
577
|
+
return false;
|
|
578
|
+
}
|
|
579
|
+
return true;
|
|
580
|
+
}
|
|
581
|
+
const ingest$2 = function ServicePlanGenerationOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
582
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
583
|
+
const validateError = validate$5(input);
|
|
584
|
+
if (validateError !== null) {
|
|
585
|
+
throw validateError;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
const key = keyBuilderFromType$1(luvio, input);
|
|
589
|
+
const ttlToUse = TTL$1;
|
|
590
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "ServicePlan", VERSION$2, RepresentationType$2, equals$2);
|
|
591
|
+
return createLink(key);
|
|
592
|
+
};
|
|
593
|
+
function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
|
|
594
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
595
|
+
const rootKey = keyBuilderFromType$1(luvio, input);
|
|
596
|
+
rootKeySet.set(rootKey, {
|
|
597
|
+
namespace: keyPrefix,
|
|
598
|
+
representationName: RepresentationType$2,
|
|
599
|
+
mergeable: false
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
const notifyUpdateAvailableFactory$1 = (luvio) => {
|
|
603
|
+
return function notifyServicePlanGenerationUpdateAvailable(configs) {
|
|
604
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
605
|
+
const requiredKeyParams = ['id'];
|
|
606
|
+
configs.forEach(config => {
|
|
607
|
+
if (false === requiredKeyParams.every(req => req in config)) {
|
|
608
|
+
throw new Error(`one of the configs did not contain all required parameters: ${JSONStringify(ObjectKeys(config))}`);
|
|
609
|
+
}
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
const keys = configs.map(c => keyBuilder$5(luvio, c));
|
|
613
|
+
return luvio.notifyStoreUpdateAvailable(keys);
|
|
614
|
+
};
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
function select$4(luvio, params) {
|
|
618
|
+
return select$5();
|
|
619
|
+
}
|
|
620
|
+
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
621
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response);
|
|
622
|
+
}
|
|
623
|
+
function ingestSuccess$2(luvio, resourceParams, response) {
|
|
624
|
+
const { body } = response;
|
|
625
|
+
const key = keyBuilderFromType$1(luvio, body);
|
|
626
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
627
|
+
const snapshot = luvio.storeLookup({
|
|
628
|
+
recordId: key,
|
|
629
|
+
node: select$4(),
|
|
630
|
+
variables: {},
|
|
631
|
+
});
|
|
632
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
633
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
634
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
deepFreeze(snapshot.data);
|
|
638
|
+
return snapshot;
|
|
639
|
+
}
|
|
640
|
+
function createResourceRequest$2(config) {
|
|
641
|
+
const headers = {};
|
|
642
|
+
return {
|
|
643
|
+
baseUri: '/services/data/v66.0',
|
|
644
|
+
basePath: '/connect/service-plan/generationRequests',
|
|
645
|
+
method: 'post',
|
|
646
|
+
body: config.body,
|
|
647
|
+
urlParams: {},
|
|
648
|
+
queryParams: config.queryParams,
|
|
649
|
+
headers,
|
|
650
|
+
priority: 'normal',
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
const adapterName$2 = 'generateServicePlan';
|
|
655
|
+
const generateServicePlan_ConfigPropertyMetadata = [
|
|
656
|
+
generateParamConfigMetadata('processingMode', false, 1 /* QueryParameter */, 0 /* String */),
|
|
657
|
+
generateParamConfigMetadata('recordId', false, 1 /* QueryParameter */, 0 /* String */),
|
|
658
|
+
generateParamConfigMetadata('regenerate', false, 1 /* QueryParameter */, 1 /* Boolean */),
|
|
659
|
+
generateParamConfigMetadata('useCase', false, 1 /* QueryParameter */, 0 /* String */),
|
|
660
|
+
generateParamConfigMetadata('additionalContext', true, 2 /* Body */, 4 /* Unsupported */),
|
|
661
|
+
generateParamConfigMetadata('generationMode', true, 2 /* Body */, 0 /* String */),
|
|
662
|
+
generateParamConfigMetadata('source', true, 2 /* Body */, 0 /* String */),
|
|
663
|
+
];
|
|
664
|
+
const generateServicePlan_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, generateServicePlan_ConfigPropertyMetadata);
|
|
665
|
+
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$4(generateServicePlan_ConfigPropertyMetadata);
|
|
666
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
667
|
+
const config = {};
|
|
668
|
+
typeCheckConfig$4(untrustedConfig, config, generateServicePlan_ConfigPropertyMetadata);
|
|
669
|
+
const untrustedConfig_additionalContext = untrustedConfig.additionalContext;
|
|
670
|
+
if (untrustedIsObject(untrustedConfig_additionalContext)) {
|
|
671
|
+
const untrustedConfig_additionalContext_object = {};
|
|
672
|
+
const untrustedConfig_additionalContext_keys = Object.keys(untrustedConfig_additionalContext);
|
|
673
|
+
for (let i = 0, arrayLength = untrustedConfig_additionalContext_keys.length; i < arrayLength; i++) {
|
|
674
|
+
const key = untrustedConfig_additionalContext_keys[i];
|
|
675
|
+
const untrustedConfig_additionalContext_prop = untrustedConfig_additionalContext[key];
|
|
676
|
+
if (typeof untrustedConfig_additionalContext_prop === 'string') {
|
|
677
|
+
if (untrustedConfig_additionalContext_object !== undefined) {
|
|
678
|
+
untrustedConfig_additionalContext_object[key] = untrustedConfig_additionalContext_prop;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
if (untrustedConfig_additionalContext_object !== undefined && Object.keys(untrustedConfig_additionalContext_object).length >= 0) {
|
|
683
|
+
config.additionalContext = untrustedConfig_additionalContext_object;
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
return config;
|
|
687
|
+
}
|
|
688
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
689
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
690
|
+
return null;
|
|
691
|
+
}
|
|
692
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
693
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
694
|
+
}
|
|
695
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
696
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
697
|
+
return null;
|
|
698
|
+
}
|
|
699
|
+
return config;
|
|
700
|
+
}
|
|
701
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
702
|
+
const resourceParams = createResourceParams$2(config);
|
|
703
|
+
const request = createResourceRequest$2(resourceParams);
|
|
704
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
705
|
+
.then((response) => {
|
|
706
|
+
return luvio.handleSuccessResponse(() => {
|
|
707
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response);
|
|
708
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
709
|
+
}, () => {
|
|
710
|
+
const cache = new StoreKeyMap();
|
|
711
|
+
getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
|
|
712
|
+
return cache;
|
|
713
|
+
});
|
|
714
|
+
}, (response) => {
|
|
715
|
+
deepFreeze(response);
|
|
716
|
+
throw response;
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
const generateServicePlanAdapterFactory = (luvio) => {
|
|
720
|
+
return function generateServicePlan(untrustedConfig) {
|
|
721
|
+
const config = validateAdapterConfig$2(untrustedConfig, generateServicePlan_ConfigPropertyNames);
|
|
722
|
+
// Invalid or incomplete config
|
|
723
|
+
if (config === null) {
|
|
724
|
+
throw new Error('Invalid config for "generateServicePlan"');
|
|
725
|
+
}
|
|
726
|
+
return buildNetworkSnapshot$2(luvio, config);
|
|
727
|
+
};
|
|
728
|
+
};
|
|
729
|
+
|
|
730
|
+
function select$3(luvio, params) {
|
|
731
|
+
return select$5();
|
|
732
|
+
}
|
|
733
|
+
function keyBuilder$4(luvio, params) {
|
|
734
|
+
return keyBuilder$5(luvio, {
|
|
735
|
+
id: params.urlParams.requestId
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
739
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response);
|
|
740
|
+
}
|
|
741
|
+
function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
742
|
+
const { body } = response;
|
|
743
|
+
const key = keyBuilder$4(luvio, resourceParams);
|
|
744
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
745
|
+
const snapshot = luvio.storeLookup({
|
|
746
|
+
recordId: key,
|
|
747
|
+
node: select$3(),
|
|
748
|
+
variables: {},
|
|
749
|
+
}, snapshotRefresh);
|
|
750
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
751
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
752
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
deepFreeze(snapshot.data);
|
|
756
|
+
return snapshot;
|
|
757
|
+
}
|
|
758
|
+
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
759
|
+
const key = keyBuilder$4(luvio, params);
|
|
760
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
761
|
+
const storeMetadataParams = {
|
|
762
|
+
ttl: TTL$1,
|
|
763
|
+
namespace: keyPrefix,
|
|
764
|
+
version: VERSION$2,
|
|
765
|
+
representationName: RepresentationType$2
|
|
766
|
+
};
|
|
767
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
768
|
+
return errorSnapshot;
|
|
769
|
+
}
|
|
770
|
+
function createResourceRequest$1(config) {
|
|
771
|
+
const headers = {};
|
|
772
|
+
return {
|
|
773
|
+
baseUri: '/services/data/v66.0',
|
|
774
|
+
basePath: '/connect/service-plan/generationRequests/' + config.urlParams.requestId + '',
|
|
775
|
+
method: 'get',
|
|
776
|
+
body: null,
|
|
777
|
+
urlParams: config.urlParams,
|
|
778
|
+
queryParams: {},
|
|
779
|
+
headers,
|
|
780
|
+
priority: 'normal',
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
const adapterName$1 = 'getGenerationRequest';
|
|
785
|
+
const getGenerationRequest_ConfigPropertyMetadata = [
|
|
786
|
+
generateParamConfigMetadata('requestId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
787
|
+
];
|
|
788
|
+
const getGenerationRequest_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getGenerationRequest_ConfigPropertyMetadata);
|
|
789
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$4(getGenerationRequest_ConfigPropertyMetadata);
|
|
790
|
+
function keyBuilder$3(luvio, config) {
|
|
791
|
+
const resourceParams = createResourceParams$1(config);
|
|
792
|
+
return keyBuilder$4(luvio, resourceParams);
|
|
793
|
+
}
|
|
794
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
795
|
+
const config = {};
|
|
796
|
+
typeCheckConfig$4(untrustedConfig, config, getGenerationRequest_ConfigPropertyMetadata);
|
|
797
|
+
return config;
|
|
798
|
+
}
|
|
799
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
800
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
801
|
+
return null;
|
|
802
|
+
}
|
|
803
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
804
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
805
|
+
}
|
|
806
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
807
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
808
|
+
return null;
|
|
809
|
+
}
|
|
810
|
+
return config;
|
|
811
|
+
}
|
|
812
|
+
function adapterFragment$1(luvio, config) {
|
|
813
|
+
createResourceParams$1(config);
|
|
814
|
+
return select$3();
|
|
815
|
+
}
|
|
816
|
+
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
817
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
|
|
818
|
+
config,
|
|
819
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
820
|
+
});
|
|
821
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
822
|
+
}
|
|
823
|
+
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
824
|
+
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
825
|
+
config,
|
|
826
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
827
|
+
});
|
|
828
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
829
|
+
}
|
|
830
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
831
|
+
const resourceParams = createResourceParams$1(config);
|
|
832
|
+
const request = createResourceRequest$1(resourceParams);
|
|
833
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
834
|
+
.then((response) => {
|
|
835
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
|
|
836
|
+
const cache = new StoreKeyMap();
|
|
837
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
838
|
+
return cache;
|
|
839
|
+
});
|
|
840
|
+
}, (response) => {
|
|
841
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
842
|
+
});
|
|
843
|
+
}
|
|
844
|
+
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
845
|
+
return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
|
|
846
|
+
}
|
|
847
|
+
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
848
|
+
const { luvio, config } = context;
|
|
849
|
+
const selector = {
|
|
850
|
+
recordId: keyBuilder$3(luvio, config),
|
|
851
|
+
node: adapterFragment$1(luvio, config),
|
|
852
|
+
variables: {},
|
|
853
|
+
};
|
|
854
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
855
|
+
config,
|
|
856
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
857
|
+
});
|
|
858
|
+
return cacheSnapshot;
|
|
859
|
+
}
|
|
860
|
+
const getGenerationRequestAdapterFactory = (luvio) => function ServicePlan__getGenerationRequest(untrustedConfig, requestContext) {
|
|
861
|
+
const config = validateAdapterConfig$1(untrustedConfig, getGenerationRequest_ConfigPropertyNames);
|
|
862
|
+
// Invalid or incomplete config
|
|
863
|
+
if (config === null) {
|
|
864
|
+
return null;
|
|
865
|
+
}
|
|
866
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
867
|
+
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
868
|
+
};
|
|
869
|
+
|
|
870
|
+
function validate$4(obj, path = 'ServicePlanStepCitationSourceRepresentation') {
|
|
871
|
+
const v_error = (() => {
|
|
872
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
873
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
874
|
+
}
|
|
875
|
+
const obj_recordId = obj.recordId;
|
|
876
|
+
const path_recordId = path + '.recordId';
|
|
877
|
+
let obj_recordId_union0 = null;
|
|
878
|
+
const obj_recordId_union0_error = (() => {
|
|
879
|
+
if (typeof obj_recordId !== 'string') {
|
|
880
|
+
return new TypeError('Expected "string" but received "' + typeof obj_recordId + '" (at "' + path_recordId + '")');
|
|
881
|
+
}
|
|
882
|
+
})();
|
|
883
|
+
if (obj_recordId_union0_error != null) {
|
|
884
|
+
obj_recordId_union0 = obj_recordId_union0_error.message;
|
|
885
|
+
}
|
|
886
|
+
let obj_recordId_union1 = null;
|
|
887
|
+
const obj_recordId_union1_error = (() => {
|
|
888
|
+
if (obj_recordId !== null) {
|
|
889
|
+
return new TypeError('Expected "null" but received "' + typeof obj_recordId + '" (at "' + path_recordId + '")');
|
|
890
|
+
}
|
|
891
|
+
})();
|
|
892
|
+
if (obj_recordId_union1_error != null) {
|
|
893
|
+
obj_recordId_union1 = obj_recordId_union1_error.message;
|
|
894
|
+
}
|
|
895
|
+
if (obj_recordId_union0 && obj_recordId_union1) {
|
|
896
|
+
let message = 'Object doesn\'t match union (at "' + path_recordId + '")';
|
|
897
|
+
message += '\n' + obj_recordId_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
898
|
+
message += '\n' + obj_recordId_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
899
|
+
return new TypeError(message);
|
|
900
|
+
}
|
|
901
|
+
const obj_sourceObjectName = obj.sourceObjectName;
|
|
902
|
+
const path_sourceObjectName = path + '.sourceObjectName';
|
|
903
|
+
let obj_sourceObjectName_union0 = null;
|
|
904
|
+
const obj_sourceObjectName_union0_error = (() => {
|
|
905
|
+
if (typeof obj_sourceObjectName !== 'string') {
|
|
906
|
+
return new TypeError('Expected "string" but received "' + typeof obj_sourceObjectName + '" (at "' + path_sourceObjectName + '")');
|
|
907
|
+
}
|
|
908
|
+
})();
|
|
909
|
+
if (obj_sourceObjectName_union0_error != null) {
|
|
910
|
+
obj_sourceObjectName_union0 = obj_sourceObjectName_union0_error.message;
|
|
911
|
+
}
|
|
912
|
+
let obj_sourceObjectName_union1 = null;
|
|
913
|
+
const obj_sourceObjectName_union1_error = (() => {
|
|
914
|
+
if (obj_sourceObjectName !== null) {
|
|
915
|
+
return new TypeError('Expected "null" but received "' + typeof obj_sourceObjectName + '" (at "' + path_sourceObjectName + '")');
|
|
916
|
+
}
|
|
917
|
+
})();
|
|
918
|
+
if (obj_sourceObjectName_union1_error != null) {
|
|
919
|
+
obj_sourceObjectName_union1 = obj_sourceObjectName_union1_error.message;
|
|
920
|
+
}
|
|
921
|
+
if (obj_sourceObjectName_union0 && obj_sourceObjectName_union1) {
|
|
922
|
+
let message = 'Object doesn\'t match union (at "' + path_sourceObjectName + '")';
|
|
923
|
+
message += '\n' + obj_sourceObjectName_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
924
|
+
message += '\n' + obj_sourceObjectName_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
925
|
+
return new TypeError(message);
|
|
926
|
+
}
|
|
927
|
+
const obj_url = obj.url;
|
|
928
|
+
const path_url = path + '.url';
|
|
929
|
+
let obj_url_union0 = null;
|
|
930
|
+
const obj_url_union0_error = (() => {
|
|
931
|
+
if (typeof obj_url !== 'string') {
|
|
932
|
+
return new TypeError('Expected "string" but received "' + typeof obj_url + '" (at "' + path_url + '")');
|
|
933
|
+
}
|
|
934
|
+
})();
|
|
935
|
+
if (obj_url_union0_error != null) {
|
|
936
|
+
obj_url_union0 = obj_url_union0_error.message;
|
|
937
|
+
}
|
|
938
|
+
let obj_url_union1 = null;
|
|
939
|
+
const obj_url_union1_error = (() => {
|
|
940
|
+
if (obj_url !== null) {
|
|
941
|
+
return new TypeError('Expected "null" but received "' + typeof obj_url + '" (at "' + path_url + '")');
|
|
942
|
+
}
|
|
943
|
+
})();
|
|
944
|
+
if (obj_url_union1_error != null) {
|
|
945
|
+
obj_url_union1 = obj_url_union1_error.message;
|
|
946
|
+
}
|
|
947
|
+
if (obj_url_union0 && obj_url_union1) {
|
|
948
|
+
let message = 'Object doesn\'t match union (at "' + path_url + '")';
|
|
949
|
+
message += '\n' + obj_url_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
950
|
+
message += '\n' + obj_url_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
951
|
+
return new TypeError(message);
|
|
952
|
+
}
|
|
953
|
+
})();
|
|
954
|
+
return v_error === undefined ? null : v_error;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
function validate$3(obj, path = 'ServicePlanReferenceDetailsRepresentation') {
|
|
958
|
+
const v_error = (() => {
|
|
959
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
960
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
961
|
+
}
|
|
962
|
+
const obj_id = obj.id;
|
|
963
|
+
const path_id = path + '.id';
|
|
964
|
+
if (typeof obj_id !== 'string') {
|
|
965
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
966
|
+
}
|
|
967
|
+
const obj_label = obj.label;
|
|
968
|
+
const path_label = path + '.label';
|
|
969
|
+
if (typeof obj_label !== 'string') {
|
|
970
|
+
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
971
|
+
}
|
|
972
|
+
const obj_type = obj.type;
|
|
973
|
+
const path_type = path + '.type';
|
|
974
|
+
if (typeof obj_type !== 'string') {
|
|
975
|
+
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
976
|
+
}
|
|
977
|
+
})();
|
|
978
|
+
return v_error === undefined ? null : v_error;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
function validate$2(obj, path = 'ServicePlanStepDetailsRepresentation') {
|
|
982
|
+
const v_error = (() => {
|
|
983
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
984
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
985
|
+
}
|
|
986
|
+
if (obj.citations !== undefined) {
|
|
987
|
+
const obj_citations = obj.citations;
|
|
988
|
+
const path_citations = path + '.citations';
|
|
989
|
+
if (!ArrayIsArray(obj_citations)) {
|
|
990
|
+
return new TypeError('Expected "array" but received "' + typeof obj_citations + '" (at "' + path_citations + '")');
|
|
991
|
+
}
|
|
992
|
+
for (let i = 0; i < obj_citations.length; i++) {
|
|
993
|
+
const obj_citations_item = obj_citations[i];
|
|
994
|
+
const path_citations_item = path_citations + '[' + i + ']';
|
|
995
|
+
const referencepath_citations_itemValidationError = validate$4(obj_citations_item, path_citations_item);
|
|
996
|
+
if (referencepath_citations_itemValidationError !== null) {
|
|
997
|
+
let message = 'Object doesn\'t match ServicePlanStepCitationSourceRepresentation (at "' + path_citations_item + '")\n';
|
|
998
|
+
message += referencepath_citations_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
999
|
+
return new TypeError(message);
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
const obj_executionStatus = obj.executionStatus;
|
|
1004
|
+
const path_executionStatus = path + '.executionStatus';
|
|
1005
|
+
if (typeof obj_executionStatus !== 'string') {
|
|
1006
|
+
return new TypeError('Expected "string" but received "' + typeof obj_executionStatus + '" (at "' + path_executionStatus + '")');
|
|
1007
|
+
}
|
|
1008
|
+
const obj_groupName = obj.groupName;
|
|
1009
|
+
const path_groupName = path + '.groupName';
|
|
1010
|
+
let obj_groupName_union0 = null;
|
|
1011
|
+
const obj_groupName_union0_error = (() => {
|
|
1012
|
+
if (typeof obj_groupName !== 'string') {
|
|
1013
|
+
return new TypeError('Expected "string" but received "' + typeof obj_groupName + '" (at "' + path_groupName + '")');
|
|
1014
|
+
}
|
|
1015
|
+
})();
|
|
1016
|
+
if (obj_groupName_union0_error != null) {
|
|
1017
|
+
obj_groupName_union0 = obj_groupName_union0_error.message;
|
|
1018
|
+
}
|
|
1019
|
+
let obj_groupName_union1 = null;
|
|
1020
|
+
const obj_groupName_union1_error = (() => {
|
|
1021
|
+
if (obj_groupName !== null) {
|
|
1022
|
+
return new TypeError('Expected "null" but received "' + typeof obj_groupName + '" (at "' + path_groupName + '")');
|
|
1023
|
+
}
|
|
1024
|
+
})();
|
|
1025
|
+
if (obj_groupName_union1_error != null) {
|
|
1026
|
+
obj_groupName_union1 = obj_groupName_union1_error.message;
|
|
1027
|
+
}
|
|
1028
|
+
if (obj_groupName_union0 && obj_groupName_union1) {
|
|
1029
|
+
let message = 'Object doesn\'t match union (at "' + path_groupName + '")';
|
|
1030
|
+
message += '\n' + obj_groupName_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
1031
|
+
message += '\n' + obj_groupName_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
1032
|
+
return new TypeError(message);
|
|
1033
|
+
}
|
|
1034
|
+
const obj_isSuggested = obj.isSuggested;
|
|
1035
|
+
const path_isSuggested = path + '.isSuggested';
|
|
1036
|
+
if (typeof obj_isSuggested !== 'boolean') {
|
|
1037
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isSuggested + '" (at "' + path_isSuggested + '")');
|
|
1038
|
+
}
|
|
1039
|
+
const obj_order = obj.order;
|
|
1040
|
+
const path_order = path + '.order';
|
|
1041
|
+
if (typeof obj_order !== 'number' || (typeof obj_order === 'number' && Math.floor(obj_order) !== obj_order)) {
|
|
1042
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_order + '" (at "' + path_order + '")');
|
|
1043
|
+
}
|
|
1044
|
+
if (obj.references !== undefined) {
|
|
1045
|
+
const obj_references = obj.references;
|
|
1046
|
+
const path_references = path + '.references';
|
|
1047
|
+
if (!ArrayIsArray(obj_references)) {
|
|
1048
|
+
return new TypeError('Expected "array" but received "' + typeof obj_references + '" (at "' + path_references + '")');
|
|
1049
|
+
}
|
|
1050
|
+
for (let i = 0; i < obj_references.length; i++) {
|
|
1051
|
+
const obj_references_item = obj_references[i];
|
|
1052
|
+
const path_references_item = path_references + '[' + i + ']';
|
|
1053
|
+
const referencepath_references_itemValidationError = validate$3(obj_references_item, path_references_item);
|
|
1054
|
+
if (referencepath_references_itemValidationError !== null) {
|
|
1055
|
+
let message = 'Object doesn\'t match ServicePlanReferenceDetailsRepresentation (at "' + path_references_item + '")\n';
|
|
1056
|
+
message += referencepath_references_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1057
|
+
return new TypeError(message);
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
const obj_stepId = obj.stepId;
|
|
1062
|
+
const path_stepId = path + '.stepId';
|
|
1063
|
+
if (typeof obj_stepId !== 'string') {
|
|
1064
|
+
return new TypeError('Expected "string" but received "' + typeof obj_stepId + '" (at "' + path_stepId + '")');
|
|
1065
|
+
}
|
|
1066
|
+
const obj_stepName = obj.stepName;
|
|
1067
|
+
const path_stepName = path + '.stepName';
|
|
1068
|
+
if (typeof obj_stepName !== 'string') {
|
|
1069
|
+
return new TypeError('Expected "string" but received "' + typeof obj_stepName + '" (at "' + path_stepName + '")');
|
|
1070
|
+
}
|
|
1071
|
+
const obj_stepSummary = obj.stepSummary;
|
|
1072
|
+
const path_stepSummary = path + '.stepSummary';
|
|
1073
|
+
if (typeof obj_stepSummary !== 'string') {
|
|
1074
|
+
return new TypeError('Expected "string" but received "' + typeof obj_stepSummary + '" (at "' + path_stepSummary + '")');
|
|
1075
|
+
}
|
|
1076
|
+
})();
|
|
1077
|
+
return v_error === undefined ? null : v_error;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
const VERSION$1 = "caa4875ebe47f9738944b0542d09f7ef";
|
|
1081
|
+
function validate$1(obj, path = 'ServicePlanDetailsRepresentation') {
|
|
1082
|
+
const v_error = (() => {
|
|
1083
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1084
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1085
|
+
}
|
|
1086
|
+
const obj_clientFeatureId = obj.clientFeatureId;
|
|
1087
|
+
const path_clientFeatureId = path + '.clientFeatureId';
|
|
1088
|
+
let obj_clientFeatureId_union0 = null;
|
|
1089
|
+
const obj_clientFeatureId_union0_error = (() => {
|
|
1090
|
+
if (typeof obj_clientFeatureId !== 'string') {
|
|
1091
|
+
return new TypeError('Expected "string" but received "' + typeof obj_clientFeatureId + '" (at "' + path_clientFeatureId + '")');
|
|
1092
|
+
}
|
|
1093
|
+
})();
|
|
1094
|
+
if (obj_clientFeatureId_union0_error != null) {
|
|
1095
|
+
obj_clientFeatureId_union0 = obj_clientFeatureId_union0_error.message;
|
|
1096
|
+
}
|
|
1097
|
+
let obj_clientFeatureId_union1 = null;
|
|
1098
|
+
const obj_clientFeatureId_union1_error = (() => {
|
|
1099
|
+
if (obj_clientFeatureId !== null) {
|
|
1100
|
+
return new TypeError('Expected "null" but received "' + typeof obj_clientFeatureId + '" (at "' + path_clientFeatureId + '")');
|
|
1101
|
+
}
|
|
1102
|
+
})();
|
|
1103
|
+
if (obj_clientFeatureId_union1_error != null) {
|
|
1104
|
+
obj_clientFeatureId_union1 = obj_clientFeatureId_union1_error.message;
|
|
1105
|
+
}
|
|
1106
|
+
if (obj_clientFeatureId_union0 && obj_clientFeatureId_union1) {
|
|
1107
|
+
let message = 'Object doesn\'t match union (at "' + path_clientFeatureId + '")';
|
|
1108
|
+
message += '\n' + obj_clientFeatureId_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
1109
|
+
message += '\n' + obj_clientFeatureId_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
1110
|
+
return new TypeError(message);
|
|
1111
|
+
}
|
|
1112
|
+
const obj_createdDate = obj.createdDate;
|
|
1113
|
+
const path_createdDate = path + '.createdDate';
|
|
1114
|
+
let obj_createdDate_union0 = null;
|
|
1115
|
+
const obj_createdDate_union0_error = (() => {
|
|
1116
|
+
if (typeof obj_createdDate !== 'string') {
|
|
1117
|
+
return new TypeError('Expected "string" but received "' + typeof obj_createdDate + '" (at "' + path_createdDate + '")');
|
|
1118
|
+
}
|
|
1119
|
+
})();
|
|
1120
|
+
if (obj_createdDate_union0_error != null) {
|
|
1121
|
+
obj_createdDate_union0 = obj_createdDate_union0_error.message;
|
|
1122
|
+
}
|
|
1123
|
+
let obj_createdDate_union1 = null;
|
|
1124
|
+
const obj_createdDate_union1_error = (() => {
|
|
1125
|
+
if (obj_createdDate !== null) {
|
|
1126
|
+
return new TypeError('Expected "null" but received "' + typeof obj_createdDate + '" (at "' + path_createdDate + '")');
|
|
1127
|
+
}
|
|
1128
|
+
})();
|
|
1129
|
+
if (obj_createdDate_union1_error != null) {
|
|
1130
|
+
obj_createdDate_union1 = obj_createdDate_union1_error.message;
|
|
1131
|
+
}
|
|
1132
|
+
if (obj_createdDate_union0 && obj_createdDate_union1) {
|
|
1133
|
+
let message = 'Object doesn\'t match union (at "' + path_createdDate + '")';
|
|
1134
|
+
message += '\n' + obj_createdDate_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
1135
|
+
message += '\n' + obj_createdDate_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
1136
|
+
return new TypeError(message);
|
|
1137
|
+
}
|
|
1138
|
+
const obj_executionStatus = obj.executionStatus;
|
|
1139
|
+
const path_executionStatus = path + '.executionStatus';
|
|
1140
|
+
let obj_executionStatus_union0 = null;
|
|
1141
|
+
const obj_executionStatus_union0_error = (() => {
|
|
1142
|
+
if (typeof obj_executionStatus !== 'string') {
|
|
1143
|
+
return new TypeError('Expected "string" but received "' + typeof obj_executionStatus + '" (at "' + path_executionStatus + '")');
|
|
1144
|
+
}
|
|
1145
|
+
})();
|
|
1146
|
+
if (obj_executionStatus_union0_error != null) {
|
|
1147
|
+
obj_executionStatus_union0 = obj_executionStatus_union0_error.message;
|
|
1148
|
+
}
|
|
1149
|
+
let obj_executionStatus_union1 = null;
|
|
1150
|
+
const obj_executionStatus_union1_error = (() => {
|
|
1151
|
+
if (obj_executionStatus !== null) {
|
|
1152
|
+
return new TypeError('Expected "null" but received "' + typeof obj_executionStatus + '" (at "' + path_executionStatus + '")');
|
|
1153
|
+
}
|
|
1154
|
+
})();
|
|
1155
|
+
if (obj_executionStatus_union1_error != null) {
|
|
1156
|
+
obj_executionStatus_union1 = obj_executionStatus_union1_error.message;
|
|
1157
|
+
}
|
|
1158
|
+
if (obj_executionStatus_union0 && obj_executionStatus_union1) {
|
|
1159
|
+
let message = 'Object doesn\'t match union (at "' + path_executionStatus + '")';
|
|
1160
|
+
message += '\n' + obj_executionStatus_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
1161
|
+
message += '\n' + obj_executionStatus_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
1162
|
+
return new TypeError(message);
|
|
1163
|
+
}
|
|
1164
|
+
const obj_feedbackId = obj.feedbackId;
|
|
1165
|
+
const path_feedbackId = path + '.feedbackId';
|
|
1166
|
+
let obj_feedbackId_union0 = null;
|
|
1167
|
+
const obj_feedbackId_union0_error = (() => {
|
|
1168
|
+
if (typeof obj_feedbackId !== 'string') {
|
|
1169
|
+
return new TypeError('Expected "string" but received "' + typeof obj_feedbackId + '" (at "' + path_feedbackId + '")');
|
|
1170
|
+
}
|
|
1171
|
+
})();
|
|
1172
|
+
if (obj_feedbackId_union0_error != null) {
|
|
1173
|
+
obj_feedbackId_union0 = obj_feedbackId_union0_error.message;
|
|
1174
|
+
}
|
|
1175
|
+
let obj_feedbackId_union1 = null;
|
|
1176
|
+
const obj_feedbackId_union1_error = (() => {
|
|
1177
|
+
if (obj_feedbackId !== null) {
|
|
1178
|
+
return new TypeError('Expected "null" but received "' + typeof obj_feedbackId + '" (at "' + path_feedbackId + '")');
|
|
1179
|
+
}
|
|
1180
|
+
})();
|
|
1181
|
+
if (obj_feedbackId_union1_error != null) {
|
|
1182
|
+
obj_feedbackId_union1 = obj_feedbackId_union1_error.message;
|
|
1183
|
+
}
|
|
1184
|
+
if (obj_feedbackId_union0 && obj_feedbackId_union1) {
|
|
1185
|
+
let message = 'Object doesn\'t match union (at "' + path_feedbackId + '")';
|
|
1186
|
+
message += '\n' + obj_feedbackId_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
1187
|
+
message += '\n' + obj_feedbackId_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
1188
|
+
return new TypeError(message);
|
|
1189
|
+
}
|
|
1190
|
+
const obj_hasContextChanged = obj.hasContextChanged;
|
|
1191
|
+
const path_hasContextChanged = path + '.hasContextChanged';
|
|
1192
|
+
if (typeof obj_hasContextChanged !== 'boolean') {
|
|
1193
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_hasContextChanged + '" (at "' + path_hasContextChanged + '")');
|
|
1194
|
+
}
|
|
1195
|
+
const obj_planHeader = obj.planHeader;
|
|
1196
|
+
const path_planHeader = path + '.planHeader';
|
|
1197
|
+
let obj_planHeader_union0 = null;
|
|
1198
|
+
const obj_planHeader_union0_error = (() => {
|
|
1199
|
+
if (typeof obj_planHeader !== 'string') {
|
|
1200
|
+
return new TypeError('Expected "string" but received "' + typeof obj_planHeader + '" (at "' + path_planHeader + '")');
|
|
1201
|
+
}
|
|
1202
|
+
})();
|
|
1203
|
+
if (obj_planHeader_union0_error != null) {
|
|
1204
|
+
obj_planHeader_union0 = obj_planHeader_union0_error.message;
|
|
1205
|
+
}
|
|
1206
|
+
let obj_planHeader_union1 = null;
|
|
1207
|
+
const obj_planHeader_union1_error = (() => {
|
|
1208
|
+
if (obj_planHeader !== null) {
|
|
1209
|
+
return new TypeError('Expected "null" but received "' + typeof obj_planHeader + '" (at "' + path_planHeader + '")');
|
|
1210
|
+
}
|
|
1211
|
+
})();
|
|
1212
|
+
if (obj_planHeader_union1_error != null) {
|
|
1213
|
+
obj_planHeader_union1 = obj_planHeader_union1_error.message;
|
|
1214
|
+
}
|
|
1215
|
+
if (obj_planHeader_union0 && obj_planHeader_union1) {
|
|
1216
|
+
let message = 'Object doesn\'t match union (at "' + path_planHeader + '")';
|
|
1217
|
+
message += '\n' + obj_planHeader_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
1218
|
+
message += '\n' + obj_planHeader_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
1219
|
+
return new TypeError(message);
|
|
1220
|
+
}
|
|
1221
|
+
const obj_planId = obj.planId;
|
|
1222
|
+
const path_planId = path + '.planId';
|
|
1223
|
+
let obj_planId_union0 = null;
|
|
1224
|
+
const obj_planId_union0_error = (() => {
|
|
1225
|
+
if (typeof obj_planId !== 'string') {
|
|
1226
|
+
return new TypeError('Expected "string" but received "' + typeof obj_planId + '" (at "' + path_planId + '")');
|
|
1227
|
+
}
|
|
1228
|
+
})();
|
|
1229
|
+
if (obj_planId_union0_error != null) {
|
|
1230
|
+
obj_planId_union0 = obj_planId_union0_error.message;
|
|
1231
|
+
}
|
|
1232
|
+
let obj_planId_union1 = null;
|
|
1233
|
+
const obj_planId_union1_error = (() => {
|
|
1234
|
+
if (obj_planId !== null) {
|
|
1235
|
+
return new TypeError('Expected "null" but received "' + typeof obj_planId + '" (at "' + path_planId + '")');
|
|
1236
|
+
}
|
|
1237
|
+
})();
|
|
1238
|
+
if (obj_planId_union1_error != null) {
|
|
1239
|
+
obj_planId_union1 = obj_planId_union1_error.message;
|
|
1240
|
+
}
|
|
1241
|
+
if (obj_planId_union0 && obj_planId_union1) {
|
|
1242
|
+
let message = 'Object doesn\'t match union (at "' + path_planId + '")';
|
|
1243
|
+
message += '\n' + obj_planId_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
1244
|
+
message += '\n' + obj_planId_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
1245
|
+
return new TypeError(message);
|
|
1246
|
+
}
|
|
1247
|
+
const obj_servicePlanSteps = obj.servicePlanSteps;
|
|
1248
|
+
const path_servicePlanSteps = path + '.servicePlanSteps';
|
|
1249
|
+
if (!ArrayIsArray(obj_servicePlanSteps)) {
|
|
1250
|
+
return new TypeError('Expected "array" but received "' + typeof obj_servicePlanSteps + '" (at "' + path_servicePlanSteps + '")');
|
|
1251
|
+
}
|
|
1252
|
+
for (let i = 0; i < obj_servicePlanSteps.length; i++) {
|
|
1253
|
+
const obj_servicePlanSteps_item = obj_servicePlanSteps[i];
|
|
1254
|
+
const path_servicePlanSteps_item = path_servicePlanSteps + '[' + i + ']';
|
|
1255
|
+
const referencepath_servicePlanSteps_itemValidationError = validate$2(obj_servicePlanSteps_item, path_servicePlanSteps_item);
|
|
1256
|
+
if (referencepath_servicePlanSteps_itemValidationError !== null) {
|
|
1257
|
+
let message = 'Object doesn\'t match ServicePlanStepDetailsRepresentation (at "' + path_servicePlanSteps_item + '")\n';
|
|
1258
|
+
message += referencepath_servicePlanSteps_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1259
|
+
return new TypeError(message);
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
const obj_topic = obj.topic;
|
|
1263
|
+
const path_topic = path + '.topic';
|
|
1264
|
+
let obj_topic_union0 = null;
|
|
1265
|
+
const obj_topic_union0_error = (() => {
|
|
1266
|
+
if (typeof obj_topic !== 'string') {
|
|
1267
|
+
return new TypeError('Expected "string" but received "' + typeof obj_topic + '" (at "' + path_topic + '")');
|
|
1268
|
+
}
|
|
1269
|
+
})();
|
|
1270
|
+
if (obj_topic_union0_error != null) {
|
|
1271
|
+
obj_topic_union0 = obj_topic_union0_error.message;
|
|
1272
|
+
}
|
|
1273
|
+
let obj_topic_union1 = null;
|
|
1274
|
+
const obj_topic_union1_error = (() => {
|
|
1275
|
+
if (obj_topic !== null) {
|
|
1276
|
+
return new TypeError('Expected "null" but received "' + typeof obj_topic + '" (at "' + path_topic + '")');
|
|
1277
|
+
}
|
|
1278
|
+
})();
|
|
1279
|
+
if (obj_topic_union1_error != null) {
|
|
1280
|
+
obj_topic_union1 = obj_topic_union1_error.message;
|
|
1281
|
+
}
|
|
1282
|
+
if (obj_topic_union0 && obj_topic_union1) {
|
|
1283
|
+
let message = 'Object doesn\'t match union (at "' + path_topic + '")';
|
|
1284
|
+
message += '\n' + obj_topic_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
1285
|
+
message += '\n' + obj_topic_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
1286
|
+
return new TypeError(message);
|
|
1287
|
+
}
|
|
1288
|
+
})();
|
|
1289
|
+
return v_error === undefined ? null : v_error;
|
|
1290
|
+
}
|
|
1291
|
+
const RepresentationType$1 = 'ServicePlanDetailsRepresentation';
|
|
1292
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
1293
|
+
return input;
|
|
1294
|
+
}
|
|
1295
|
+
const select$2 = function ServicePlanDetailsRepresentationSelect() {
|
|
1296
|
+
return {
|
|
1297
|
+
kind: 'Fragment',
|
|
1298
|
+
version: VERSION$1,
|
|
1299
|
+
private: [],
|
|
1300
|
+
opaque: true
|
|
1301
|
+
};
|
|
1302
|
+
};
|
|
1303
|
+
function equals$1(existing, incoming) {
|
|
1304
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
1305
|
+
return false;
|
|
1306
|
+
}
|
|
1307
|
+
return true;
|
|
1308
|
+
}
|
|
1309
|
+
const ingest$1 = function ServicePlanDetailsRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1310
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1311
|
+
const validateError = validate$1(input);
|
|
1312
|
+
if (validateError !== null) {
|
|
1313
|
+
throw validateError;
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
const key = path.fullPath;
|
|
1317
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 500;
|
|
1318
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "ServicePlan", VERSION$1, RepresentationType$1, equals$1);
|
|
1319
|
+
return createLink(key);
|
|
1320
|
+
};
|
|
1321
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
1322
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1323
|
+
const rootKey = fullPathFactory();
|
|
1324
|
+
rootKeySet.set(rootKey, {
|
|
1325
|
+
namespace: keyPrefix,
|
|
1326
|
+
representationName: RepresentationType$1,
|
|
1327
|
+
mergeable: false
|
|
1328
|
+
});
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
const TTL = 1000;
|
|
1332
|
+
const VERSION = "2dd60cd6c267351cb563fcc04cb5cb56";
|
|
1333
|
+
function validate(obj, path = 'ServicePlanDetailsOutputRepresentation') {
|
|
1334
|
+
const v_error = (() => {
|
|
1335
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1336
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1337
|
+
}
|
|
1338
|
+
const obj_plan = obj.plan;
|
|
1339
|
+
const path_plan = path + '.plan';
|
|
1340
|
+
if (typeof obj_plan !== 'object' || Array.isArray(obj_plan)) {
|
|
1341
|
+
return new TypeError('Expected "object" but received "' + typeof obj_plan + '" (at "' + path_plan + '")');
|
|
1342
|
+
}
|
|
1343
|
+
const obj_planRequestId = obj.planRequestId;
|
|
1344
|
+
const path_planRequestId = path + '.planRequestId';
|
|
1345
|
+
if (typeof obj_planRequestId !== 'string') {
|
|
1346
|
+
return new TypeError('Expected "string" but received "' + typeof obj_planRequestId + '" (at "' + path_planRequestId + '")');
|
|
1347
|
+
}
|
|
1348
|
+
const obj_reason = obj.reason;
|
|
1349
|
+
const path_reason = path + '.reason';
|
|
1350
|
+
if (typeof obj_reason !== 'string') {
|
|
1351
|
+
return new TypeError('Expected "string" but received "' + typeof obj_reason + '" (at "' + path_reason + '")');
|
|
1352
|
+
}
|
|
1353
|
+
const obj_reasonDetails = obj.reasonDetails;
|
|
1354
|
+
const path_reasonDetails = path + '.reasonDetails';
|
|
1355
|
+
let obj_reasonDetails_union0 = null;
|
|
1356
|
+
const obj_reasonDetails_union0_error = (() => {
|
|
1357
|
+
if (typeof obj_reasonDetails !== 'string') {
|
|
1358
|
+
return new TypeError('Expected "string" but received "' + typeof obj_reasonDetails + '" (at "' + path_reasonDetails + '")');
|
|
1359
|
+
}
|
|
1360
|
+
})();
|
|
1361
|
+
if (obj_reasonDetails_union0_error != null) {
|
|
1362
|
+
obj_reasonDetails_union0 = obj_reasonDetails_union0_error.message;
|
|
1363
|
+
}
|
|
1364
|
+
let obj_reasonDetails_union1 = null;
|
|
1365
|
+
const obj_reasonDetails_union1_error = (() => {
|
|
1366
|
+
if (obj_reasonDetails !== null) {
|
|
1367
|
+
return new TypeError('Expected "null" but received "' + typeof obj_reasonDetails + '" (at "' + path_reasonDetails + '")');
|
|
1368
|
+
}
|
|
1369
|
+
})();
|
|
1370
|
+
if (obj_reasonDetails_union1_error != null) {
|
|
1371
|
+
obj_reasonDetails_union1 = obj_reasonDetails_union1_error.message;
|
|
1372
|
+
}
|
|
1373
|
+
if (obj_reasonDetails_union0 && obj_reasonDetails_union1) {
|
|
1374
|
+
let message = 'Object doesn\'t match union (at "' + path_reasonDetails + '")';
|
|
1375
|
+
message += '\n' + obj_reasonDetails_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
1376
|
+
message += '\n' + obj_reasonDetails_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
1377
|
+
return new TypeError(message);
|
|
1378
|
+
}
|
|
1379
|
+
const obj_status = obj.status;
|
|
1380
|
+
const path_status = path + '.status';
|
|
1381
|
+
if (typeof obj_status !== 'string') {
|
|
1382
|
+
return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
|
|
1383
|
+
}
|
|
1384
|
+
})();
|
|
1385
|
+
return v_error === undefined ? null : v_error;
|
|
1386
|
+
}
|
|
1387
|
+
const RepresentationType = 'ServicePlanDetailsOutputRepresentation';
|
|
1388
|
+
function keyBuilder$2(luvio, config) {
|
|
1389
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.id;
|
|
1390
|
+
}
|
|
1391
|
+
function keyBuilderFromType(luvio, object) {
|
|
1392
|
+
const keyParams = {
|
|
1393
|
+
id: object.planRequestId
|
|
1394
|
+
};
|
|
1395
|
+
return keyBuilder$2(luvio, keyParams);
|
|
1396
|
+
}
|
|
1397
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
1398
|
+
const input_plan = input.plan;
|
|
1399
|
+
const input_plan_id = path.fullPath + '__plan';
|
|
1400
|
+
input.plan = ingest$1(input_plan, {
|
|
1401
|
+
fullPath: input_plan_id,
|
|
1402
|
+
propertyName: 'plan',
|
|
1403
|
+
parent: {
|
|
1404
|
+
data: input,
|
|
1405
|
+
key: path.fullPath,
|
|
1406
|
+
existing: existing,
|
|
1407
|
+
},
|
|
1408
|
+
ttl: path.ttl
|
|
1409
|
+
}, luvio, store, timestamp);
|
|
1410
|
+
return input;
|
|
1411
|
+
}
|
|
1412
|
+
const select$1 = function ServicePlanDetailsOutputRepresentationSelect() {
|
|
1413
|
+
return {
|
|
1414
|
+
kind: 'Fragment',
|
|
1415
|
+
version: VERSION,
|
|
1416
|
+
private: [],
|
|
1417
|
+
selections: [
|
|
1418
|
+
{
|
|
1419
|
+
name: 'plan',
|
|
1420
|
+
kind: 'Link',
|
|
1421
|
+
fragment: select$2()
|
|
1422
|
+
},
|
|
1423
|
+
{
|
|
1424
|
+
name: 'planRequestId',
|
|
1425
|
+
kind: 'Scalar'
|
|
1426
|
+
},
|
|
1427
|
+
{
|
|
1428
|
+
name: 'reason',
|
|
1429
|
+
kind: 'Scalar'
|
|
1430
|
+
},
|
|
1431
|
+
{
|
|
1432
|
+
name: 'reasonDetails',
|
|
1433
|
+
kind: 'Scalar'
|
|
1434
|
+
},
|
|
1435
|
+
{
|
|
1436
|
+
name: 'status',
|
|
1437
|
+
kind: 'Scalar'
|
|
1438
|
+
}
|
|
1439
|
+
]
|
|
1440
|
+
};
|
|
1441
|
+
};
|
|
1442
|
+
function equals(existing, incoming) {
|
|
1443
|
+
const existing_planRequestId = existing.planRequestId;
|
|
1444
|
+
const incoming_planRequestId = incoming.planRequestId;
|
|
1445
|
+
if (!(existing_planRequestId === incoming_planRequestId)) {
|
|
1446
|
+
return false;
|
|
1447
|
+
}
|
|
1448
|
+
const existing_reason = existing.reason;
|
|
1449
|
+
const incoming_reason = incoming.reason;
|
|
1450
|
+
if (!(existing_reason === incoming_reason)) {
|
|
1451
|
+
return false;
|
|
1452
|
+
}
|
|
1453
|
+
const existing_status = existing.status;
|
|
1454
|
+
const incoming_status = incoming.status;
|
|
1455
|
+
if (!(existing_status === incoming_status)) {
|
|
1456
|
+
return false;
|
|
1457
|
+
}
|
|
1458
|
+
const existing_plan = existing.plan;
|
|
1459
|
+
const incoming_plan = incoming.plan;
|
|
1460
|
+
if (!(existing_plan.__ref === incoming_plan.__ref)) {
|
|
1461
|
+
return false;
|
|
1462
|
+
}
|
|
1463
|
+
const existing_reasonDetails = existing.reasonDetails;
|
|
1464
|
+
const incoming_reasonDetails = incoming.reasonDetails;
|
|
1465
|
+
if (!(existing_reasonDetails === incoming_reasonDetails)) {
|
|
1466
|
+
return false;
|
|
1467
|
+
}
|
|
1468
|
+
return true;
|
|
1469
|
+
}
|
|
1470
|
+
const ingest = function ServicePlanDetailsOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1471
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1472
|
+
const validateError = validate(input);
|
|
1473
|
+
if (validateError !== null) {
|
|
1474
|
+
throw validateError;
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
const key = keyBuilderFromType(luvio, input);
|
|
1478
|
+
const ttlToUse = TTL;
|
|
1479
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "ServicePlan", VERSION, RepresentationType, equals);
|
|
1480
|
+
return createLink(key);
|
|
1481
|
+
};
|
|
1482
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
1483
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1484
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
1485
|
+
rootKeySet.set(rootKey, {
|
|
1486
|
+
namespace: keyPrefix,
|
|
1487
|
+
representationName: RepresentationType,
|
|
1488
|
+
mergeable: false
|
|
1489
|
+
});
|
|
1490
|
+
getTypeCacheKeys$1(rootKeySet, luvio, input.plan, () => rootKey + "__" + "plan");
|
|
1491
|
+
}
|
|
1492
|
+
const notifyUpdateAvailableFactory = (luvio) => {
|
|
1493
|
+
return function notifyServicePlanDetailsUpdateAvailable(configs) {
|
|
1494
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1495
|
+
const requiredKeyParams = ['id'];
|
|
1496
|
+
configs.forEach(config => {
|
|
1497
|
+
if (false === requiredKeyParams.every(req => req in config)) {
|
|
1498
|
+
throw new Error(`one of the configs did not contain all required parameters: ${JSONStringify(ObjectKeys(config))}`);
|
|
1499
|
+
}
|
|
1500
|
+
});
|
|
1501
|
+
}
|
|
1502
|
+
const keys = configs.map(c => keyBuilder$2(luvio, c));
|
|
1503
|
+
return luvio.notifyStoreUpdateAvailable(keys);
|
|
1504
|
+
};
|
|
1505
|
+
};
|
|
1506
|
+
|
|
1507
|
+
function select(luvio, params) {
|
|
1508
|
+
return select$1();
|
|
1509
|
+
}
|
|
1510
|
+
function keyBuilder$1(luvio, params) {
|
|
1511
|
+
return keyBuilder$2(luvio, {
|
|
1512
|
+
id: params.urlParams.recordId
|
|
1513
|
+
});
|
|
1514
|
+
}
|
|
1515
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
1516
|
+
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
1517
|
+
}
|
|
1518
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
1519
|
+
const { body } = response;
|
|
1520
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
1521
|
+
luvio.storeIngest(key, ingest, body);
|
|
1522
|
+
const snapshot = luvio.storeLookup({
|
|
1523
|
+
recordId: key,
|
|
1524
|
+
node: select(),
|
|
1525
|
+
variables: {},
|
|
1526
|
+
}, snapshotRefresh);
|
|
1527
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1528
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1529
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
deepFreeze(snapshot.data);
|
|
1533
|
+
return snapshot;
|
|
1534
|
+
}
|
|
1535
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
1536
|
+
const key = keyBuilder$1(luvio, params);
|
|
1537
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1538
|
+
const storeMetadataParams = {
|
|
1539
|
+
ttl: TTL,
|
|
1540
|
+
namespace: keyPrefix,
|
|
1541
|
+
version: VERSION,
|
|
1542
|
+
representationName: RepresentationType
|
|
1543
|
+
};
|
|
1544
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
1545
|
+
return errorSnapshot;
|
|
1546
|
+
}
|
|
1547
|
+
function createResourceRequest(config) {
|
|
1548
|
+
const headers = {};
|
|
1549
|
+
return {
|
|
1550
|
+
baseUri: '/services/data/v66.0',
|
|
1551
|
+
basePath: '/connect/service-plan/servicePlanDetails/' + config.urlParams.recordId + '',
|
|
1552
|
+
method: 'get',
|
|
1553
|
+
body: null,
|
|
1554
|
+
urlParams: config.urlParams,
|
|
1555
|
+
queryParams: {},
|
|
1556
|
+
headers,
|
|
1557
|
+
priority: 'normal',
|
|
1558
|
+
};
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
const adapterName = 'getServicePlan';
|
|
1562
|
+
const getServicePlan_ConfigPropertyMetadata = [
|
|
1563
|
+
generateParamConfigMetadata('recordId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1564
|
+
];
|
|
1565
|
+
const getServicePlan_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getServicePlan_ConfigPropertyMetadata);
|
|
1566
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$4(getServicePlan_ConfigPropertyMetadata);
|
|
1567
|
+
function keyBuilder(luvio, config) {
|
|
1568
|
+
const resourceParams = createResourceParams(config);
|
|
1569
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
1570
|
+
}
|
|
1571
|
+
function typeCheckConfig(untrustedConfig) {
|
|
1572
|
+
const config = {};
|
|
1573
|
+
typeCheckConfig$4(untrustedConfig, config, getServicePlan_ConfigPropertyMetadata);
|
|
1574
|
+
return config;
|
|
1575
|
+
}
|
|
1576
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
1577
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1578
|
+
return null;
|
|
1579
|
+
}
|
|
1580
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1581
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1582
|
+
}
|
|
1583
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
1584
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1585
|
+
return null;
|
|
1586
|
+
}
|
|
1587
|
+
return config;
|
|
1588
|
+
}
|
|
1589
|
+
function adapterFragment(luvio, config) {
|
|
1590
|
+
createResourceParams(config);
|
|
1591
|
+
return select();
|
|
1592
|
+
}
|
|
1593
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
1594
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
1595
|
+
config,
|
|
1596
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1597
|
+
});
|
|
1598
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1599
|
+
}
|
|
1600
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
1601
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
1602
|
+
config,
|
|
1603
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1604
|
+
});
|
|
1605
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1606
|
+
}
|
|
1607
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
1608
|
+
const resourceParams = createResourceParams(config);
|
|
1609
|
+
const request = createResourceRequest(resourceParams);
|
|
1610
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1611
|
+
.then((response) => {
|
|
1612
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
1613
|
+
const cache = new StoreKeyMap();
|
|
1614
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
1615
|
+
return cache;
|
|
1616
|
+
});
|
|
1617
|
+
}, (response) => {
|
|
1618
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
1619
|
+
});
|
|
1620
|
+
}
|
|
1621
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
1622
|
+
return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
|
|
1623
|
+
}
|
|
1624
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
1625
|
+
const { luvio, config } = context;
|
|
1626
|
+
const selector = {
|
|
1627
|
+
recordId: keyBuilder(luvio, config),
|
|
1628
|
+
node: adapterFragment(luvio, config),
|
|
1629
|
+
variables: {},
|
|
1630
|
+
};
|
|
1631
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1632
|
+
config,
|
|
1633
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1634
|
+
});
|
|
1635
|
+
return cacheSnapshot;
|
|
1636
|
+
}
|
|
1637
|
+
const getServicePlanAdapterFactory = (luvio) => function ServicePlan__getServicePlan(untrustedConfig, requestContext) {
|
|
1638
|
+
const config = validateAdapterConfig(untrustedConfig, getServicePlan_ConfigPropertyNames);
|
|
1639
|
+
// Invalid or incomplete config
|
|
1640
|
+
if (config === null) {
|
|
1641
|
+
return null;
|
|
1642
|
+
}
|
|
1643
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1644
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
1645
|
+
};
|
|
1646
|
+
|
|
1647
|
+
export { executeServicePlanAdapterFactory, generateServicePlanAdapterFactory, getGenerationRequestAdapterFactory, getServicePlanAdapterFactory, notifyUpdateAvailableFactory as notifyServicePlanDetailsUpdateAvailableFactory, notifyUpdateAvailableFactory$1 as notifyServicePlanGenerationUpdateAvailableFactory };
|