@salesforce/lds-adapters-industries-dfo 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-dfo.js +660 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/getDfoConfigInfo.d.ts +26 -0
- package/dist/es/es2018/types/src/generated/adapters/getDroDecompositionViewer.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/adapters/putDfoConfigInfo.d.ts +17 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +3 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +6 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectDroBySalesTransactionIdAndTypeOfData.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectRevenueDroConfigurations.d.ts +12 -0
- package/dist/es/es2018/types/src/generated/resources/putConnectRevenueDroConfigurations.d.ts +14 -0
- package/dist/es/es2018/types/src/generated/types/DfoConfigInfoGetOutputRepresentation.d.ts +33 -0
- package/dist/es/es2018/types/src/generated/types/DfoConfigInfoInputRepresentation.d.ts +32 -0
- package/dist/es/es2018/types/src/generated/types/DfoConfigInfoUpdateOutputRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/DroDecompositionViewerGetOutputRepresentation.d.ts +36 -0
- package/dist/es/es2018/types/src/generated/types/DroDecompositionViewerInputRepresentation.d.ts +32 -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 +713 -0
- package/src/raml/api.raml +121 -0
- package/src/raml/luvio.raml +33 -0
package/sfdc/index.js
ADDED
|
@@ -0,0 +1,713 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* ATTENTION!
|
|
9
|
+
* THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
|
|
10
|
+
* If you would like to contribute to LDS, please follow the steps outlined in the git repo.
|
|
11
|
+
* Any changes made to this file in p4 will be automatically overwritten.
|
|
12
|
+
* *******************************************************************************************
|
|
13
|
+
*/
|
|
14
|
+
/* proxy-compat-disable */
|
|
15
|
+
import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
|
|
16
|
+
import { withDefaultLuvio } from 'force/ldsEngine';
|
|
17
|
+
import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$2, StoreKeyMap, createResourceParams as createResourceParams$3, typeCheckConfig as typeCheckConfig$3 } from 'force/luvioEngine';
|
|
18
|
+
|
|
19
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
20
|
+
const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
|
|
21
|
+
const { isArray: ArrayIsArray$1 } = Array;
|
|
22
|
+
/**
|
|
23
|
+
* Validates an adapter config is well-formed.
|
|
24
|
+
* @param config The config to validate.
|
|
25
|
+
* @param adapter The adapter validation configuration.
|
|
26
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
27
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
28
|
+
*/
|
|
29
|
+
function validateConfig(config, adapter, oneOf) {
|
|
30
|
+
const { displayName } = adapter;
|
|
31
|
+
const { required, optional, unsupported } = adapter.parameters;
|
|
32
|
+
if (config === undefined ||
|
|
33
|
+
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
34
|
+
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
35
|
+
}
|
|
36
|
+
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
37
|
+
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
38
|
+
}
|
|
39
|
+
if (unsupported !== undefined &&
|
|
40
|
+
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
41
|
+
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
42
|
+
}
|
|
43
|
+
const supported = required.concat(optional);
|
|
44
|
+
if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
|
|
45
|
+
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function untrustedIsObject(untrusted) {
|
|
49
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
50
|
+
}
|
|
51
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
52
|
+
return configPropertyNames.parameters.required.every(req => req in config);
|
|
53
|
+
}
|
|
54
|
+
const snapshotRefreshOptions = {
|
|
55
|
+
overrides: {
|
|
56
|
+
headers: {
|
|
57
|
+
'Cache-Control': 'no-cache',
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
|
|
62
|
+
return {
|
|
63
|
+
name,
|
|
64
|
+
required,
|
|
65
|
+
resourceType,
|
|
66
|
+
typeCheckShape,
|
|
67
|
+
isArrayShape,
|
|
68
|
+
coerceFn,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function buildAdapterValidationConfig(displayName, paramsMeta) {
|
|
72
|
+
const required = paramsMeta.filter(p => p.required).map(p => p.name);
|
|
73
|
+
const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
|
|
74
|
+
return {
|
|
75
|
+
displayName,
|
|
76
|
+
parameters: {
|
|
77
|
+
required,
|
|
78
|
+
optional,
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const keyPrefix = 'dfo';
|
|
83
|
+
|
|
84
|
+
const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
85
|
+
const { isArray: ArrayIsArray } = Array;
|
|
86
|
+
const { stringify: JSONStringify } = JSON;
|
|
87
|
+
function createLink(ref) {
|
|
88
|
+
return {
|
|
89
|
+
__ref: serializeStructuredKey(ref),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const TTL$2 = 1000;
|
|
94
|
+
const VERSION$2 = "dd6647099b059db657ec754c75dfccc4";
|
|
95
|
+
function validate$2(obj, path = 'DfoConfigInfoGetOutputRepresentation') {
|
|
96
|
+
const v_error = (() => {
|
|
97
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
98
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
99
|
+
}
|
|
100
|
+
const obj_values = obj.values;
|
|
101
|
+
const path_values = path + '.values';
|
|
102
|
+
if (typeof obj_values !== 'object' || ArrayIsArray(obj_values) || obj_values === null) {
|
|
103
|
+
return new TypeError('Expected "object" but received "' + typeof obj_values + '" (at "' + path_values + '")');
|
|
104
|
+
}
|
|
105
|
+
const obj_values_keys = ObjectKeys(obj_values);
|
|
106
|
+
for (let i = 0; i < obj_values_keys.length; i++) {
|
|
107
|
+
const key = obj_values_keys[i];
|
|
108
|
+
const obj_values_prop = obj_values[key];
|
|
109
|
+
const path_values_prop = path_values + '["' + key + '"]';
|
|
110
|
+
if (typeof obj_values_prop !== 'string') {
|
|
111
|
+
return new TypeError('Expected "string" but received "' + typeof obj_values_prop + '" (at "' + path_values_prop + '")');
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
})();
|
|
115
|
+
return v_error === undefined ? null : v_error;
|
|
116
|
+
}
|
|
117
|
+
const RepresentationType$2 = 'DfoConfigInfoGetOutputRepresentation';
|
|
118
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
119
|
+
return input;
|
|
120
|
+
}
|
|
121
|
+
const select$5 = function DfoConfigInfoGetOutputRepresentationSelect() {
|
|
122
|
+
return {
|
|
123
|
+
kind: 'Fragment',
|
|
124
|
+
version: VERSION$2,
|
|
125
|
+
private: [],
|
|
126
|
+
opaque: true
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
function equals$2(existing, incoming) {
|
|
130
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
const ingest$2 = function DfoConfigInfoGetOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
136
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
137
|
+
const validateError = validate$2(input);
|
|
138
|
+
if (validateError !== null) {
|
|
139
|
+
throw validateError;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
const key = path.fullPath;
|
|
143
|
+
const ttlToUse = TTL$2;
|
|
144
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "dfo", VERSION$2, RepresentationType$2, equals$2);
|
|
145
|
+
return createLink(key);
|
|
146
|
+
};
|
|
147
|
+
function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
|
|
148
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
149
|
+
const rootKey = fullPathFactory();
|
|
150
|
+
rootKeySet.set(rootKey, {
|
|
151
|
+
namespace: keyPrefix,
|
|
152
|
+
representationName: RepresentationType$2,
|
|
153
|
+
mergeable: false
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function select$4(luvio, params) {
|
|
158
|
+
return select$5();
|
|
159
|
+
}
|
|
160
|
+
function keyBuilder$4(luvio, params) {
|
|
161
|
+
return keyPrefix + '::DfoConfigInfoGetOutputRepresentation:(' + ')';
|
|
162
|
+
}
|
|
163
|
+
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
164
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$4());
|
|
165
|
+
}
|
|
166
|
+
function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
|
|
167
|
+
const { body } = response;
|
|
168
|
+
const key = keyBuilder$4();
|
|
169
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
170
|
+
const snapshot = luvio.storeLookup({
|
|
171
|
+
recordId: key,
|
|
172
|
+
node: select$4(),
|
|
173
|
+
variables: {},
|
|
174
|
+
}, snapshotRefresh);
|
|
175
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
176
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
177
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
deepFreeze(snapshot.data);
|
|
181
|
+
return snapshot;
|
|
182
|
+
}
|
|
183
|
+
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
184
|
+
const key = keyBuilder$4();
|
|
185
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
186
|
+
const storeMetadataParams = {
|
|
187
|
+
ttl: TTL$2,
|
|
188
|
+
namespace: keyPrefix,
|
|
189
|
+
version: VERSION$2,
|
|
190
|
+
representationName: RepresentationType$2
|
|
191
|
+
};
|
|
192
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
193
|
+
return errorSnapshot;
|
|
194
|
+
}
|
|
195
|
+
function createResourceRequest$2(config) {
|
|
196
|
+
const headers = {};
|
|
197
|
+
return {
|
|
198
|
+
baseUri: '/services/data/v66.0',
|
|
199
|
+
basePath: '/connect/revenue/dro/configurations',
|
|
200
|
+
method: 'get',
|
|
201
|
+
body: null,
|
|
202
|
+
urlParams: {},
|
|
203
|
+
queryParams: {},
|
|
204
|
+
headers,
|
|
205
|
+
priority: 'normal',
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const adapterName$2 = 'getDfoConfigInfo';
|
|
210
|
+
const getDfoConfigInfo_ConfigPropertyMetadata = [];
|
|
211
|
+
const getDfoConfigInfo_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getDfoConfigInfo_ConfigPropertyMetadata);
|
|
212
|
+
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(getDfoConfigInfo_ConfigPropertyMetadata);
|
|
213
|
+
function keyBuilder$3(luvio, config) {
|
|
214
|
+
createResourceParams$2(config);
|
|
215
|
+
return keyBuilder$4();
|
|
216
|
+
}
|
|
217
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
218
|
+
const config = {};
|
|
219
|
+
return config;
|
|
220
|
+
}
|
|
221
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
222
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
226
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
227
|
+
}
|
|
228
|
+
const config = typeCheckConfig$2();
|
|
229
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
return config;
|
|
233
|
+
}
|
|
234
|
+
function adapterFragment$1(luvio, config) {
|
|
235
|
+
createResourceParams$2(config);
|
|
236
|
+
return select$4();
|
|
237
|
+
}
|
|
238
|
+
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
239
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
|
|
240
|
+
config,
|
|
241
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
242
|
+
});
|
|
243
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
244
|
+
}
|
|
245
|
+
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
246
|
+
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
247
|
+
config,
|
|
248
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
249
|
+
});
|
|
250
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
251
|
+
}
|
|
252
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
253
|
+
const resourceParams = createResourceParams$2(config);
|
|
254
|
+
const request = createResourceRequest$2();
|
|
255
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
256
|
+
.then((response) => {
|
|
257
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
|
|
258
|
+
const cache = new StoreKeyMap();
|
|
259
|
+
getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
|
|
260
|
+
return cache;
|
|
261
|
+
});
|
|
262
|
+
}, (response) => {
|
|
263
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
267
|
+
return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
|
|
268
|
+
}
|
|
269
|
+
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
270
|
+
const { luvio, config } = context;
|
|
271
|
+
const selector = {
|
|
272
|
+
recordId: keyBuilder$3(luvio, config),
|
|
273
|
+
node: adapterFragment$1(luvio, config),
|
|
274
|
+
variables: {},
|
|
275
|
+
};
|
|
276
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
277
|
+
config,
|
|
278
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
279
|
+
});
|
|
280
|
+
return cacheSnapshot;
|
|
281
|
+
}
|
|
282
|
+
const getDfoConfigInfoAdapterFactory = (luvio) => function dfo__getDfoConfigInfo(untrustedConfig, requestContext) {
|
|
283
|
+
const config = validateAdapterConfig$2(untrustedConfig, getDfoConfigInfo_ConfigPropertyNames);
|
|
284
|
+
// Invalid or incomplete config
|
|
285
|
+
if (config === null) {
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
289
|
+
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
const TTL$1 = 1000;
|
|
293
|
+
const VERSION$1 = "6276c05f3d390d7a92e532aadaf4abd2";
|
|
294
|
+
function validate$1(obj, path = 'DroDecompositionViewerGetOutputRepresentation') {
|
|
295
|
+
const v_error = (() => {
|
|
296
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
297
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
298
|
+
}
|
|
299
|
+
const obj_statusMessage = obj.statusMessage;
|
|
300
|
+
const path_statusMessage = path + '.statusMessage';
|
|
301
|
+
if (typeof obj_statusMessage !== 'string') {
|
|
302
|
+
return new TypeError('Expected "string" but received "' + typeof obj_statusMessage + '" (at "' + path_statusMessage + '")');
|
|
303
|
+
}
|
|
304
|
+
const obj_values = obj.values;
|
|
305
|
+
const path_values = path + '.values';
|
|
306
|
+
if (typeof obj_values !== 'object' || ArrayIsArray(obj_values) || obj_values === null) {
|
|
307
|
+
return new TypeError('Expected "object" but received "' + typeof obj_values + '" (at "' + path_values + '")');
|
|
308
|
+
}
|
|
309
|
+
const obj_values_keys = ObjectKeys(obj_values);
|
|
310
|
+
for (let i = 0; i < obj_values_keys.length; i++) {
|
|
311
|
+
const key = obj_values_keys[i];
|
|
312
|
+
const obj_values_prop = obj_values[key];
|
|
313
|
+
const path_values_prop = path_values + '["' + key + '"]';
|
|
314
|
+
if (obj_values_prop === undefined) {
|
|
315
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_values_prop + '" (at "' + path_values_prop + '")');
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
})();
|
|
319
|
+
return v_error === undefined ? null : v_error;
|
|
320
|
+
}
|
|
321
|
+
const RepresentationType$1 = 'DroDecompositionViewerGetOutputRepresentation';
|
|
322
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
323
|
+
return input;
|
|
324
|
+
}
|
|
325
|
+
const select$3 = function DroDecompositionViewerGetOutputRepresentationSelect() {
|
|
326
|
+
return {
|
|
327
|
+
kind: 'Fragment',
|
|
328
|
+
version: VERSION$1,
|
|
329
|
+
private: [],
|
|
330
|
+
opaque: true
|
|
331
|
+
};
|
|
332
|
+
};
|
|
333
|
+
function equals$1(existing, incoming) {
|
|
334
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
337
|
+
return true;
|
|
338
|
+
}
|
|
339
|
+
const ingest$1 = function DroDecompositionViewerGetOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
340
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
341
|
+
const validateError = validate$1(input);
|
|
342
|
+
if (validateError !== null) {
|
|
343
|
+
throw validateError;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
const key = path.fullPath;
|
|
347
|
+
const ttlToUse = TTL$1;
|
|
348
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "dfo", VERSION$1, RepresentationType$1, equals$1);
|
|
349
|
+
return createLink(key);
|
|
350
|
+
};
|
|
351
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
352
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
353
|
+
const rootKey = fullPathFactory();
|
|
354
|
+
rootKeySet.set(rootKey, {
|
|
355
|
+
namespace: keyPrefix,
|
|
356
|
+
representationName: RepresentationType$1,
|
|
357
|
+
mergeable: false
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
function select$2(luvio, params) {
|
|
362
|
+
return select$3();
|
|
363
|
+
}
|
|
364
|
+
function keyBuilder$2(luvio, params) {
|
|
365
|
+
return keyPrefix + '::DroDecompositionViewerGetOutputRepresentation:(' + 'salesTransactionId:' + params.urlParams.salesTransactionId + ',' + 'typeOfData:' + params.urlParams.typeOfData + ')';
|
|
366
|
+
}
|
|
367
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
368
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$2(luvio, resourceParams));
|
|
369
|
+
}
|
|
370
|
+
function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
371
|
+
const { body } = response;
|
|
372
|
+
const key = keyBuilder$2(luvio, resourceParams);
|
|
373
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
374
|
+
const snapshot = luvio.storeLookup({
|
|
375
|
+
recordId: key,
|
|
376
|
+
node: select$2(),
|
|
377
|
+
variables: {},
|
|
378
|
+
}, snapshotRefresh);
|
|
379
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
380
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
381
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
deepFreeze(snapshot.data);
|
|
385
|
+
return snapshot;
|
|
386
|
+
}
|
|
387
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
388
|
+
const key = keyBuilder$2(luvio, params);
|
|
389
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
390
|
+
const storeMetadataParams = {
|
|
391
|
+
ttl: TTL$1,
|
|
392
|
+
namespace: keyPrefix,
|
|
393
|
+
version: VERSION$1,
|
|
394
|
+
representationName: RepresentationType$1
|
|
395
|
+
};
|
|
396
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
397
|
+
return errorSnapshot;
|
|
398
|
+
}
|
|
399
|
+
function createResourceRequest$1(config) {
|
|
400
|
+
const headers = {};
|
|
401
|
+
return {
|
|
402
|
+
baseUri: '/services/data/v66.0',
|
|
403
|
+
basePath: '/connect/dro/' + config.urlParams.salesTransactionId + '/' + config.urlParams.typeOfData + '',
|
|
404
|
+
method: 'get',
|
|
405
|
+
body: null,
|
|
406
|
+
urlParams: config.urlParams,
|
|
407
|
+
queryParams: {},
|
|
408
|
+
headers,
|
|
409
|
+
priority: 'normal',
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
const adapterName$1 = 'getDroDecompositionViewer';
|
|
414
|
+
const getDroDecompositionViewer_ConfigPropertyMetadata = [
|
|
415
|
+
generateParamConfigMetadata('salesTransactionId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
416
|
+
generateParamConfigMetadata('typeOfData', true, 0 /* UrlParameter */, 0 /* String */),
|
|
417
|
+
];
|
|
418
|
+
const getDroDecompositionViewer_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getDroDecompositionViewer_ConfigPropertyMetadata);
|
|
419
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(getDroDecompositionViewer_ConfigPropertyMetadata);
|
|
420
|
+
function keyBuilder$1(luvio, config) {
|
|
421
|
+
const resourceParams = createResourceParams$1(config);
|
|
422
|
+
return keyBuilder$2(luvio, resourceParams);
|
|
423
|
+
}
|
|
424
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
425
|
+
const config = {};
|
|
426
|
+
typeCheckConfig$3(untrustedConfig, config, getDroDecompositionViewer_ConfigPropertyMetadata);
|
|
427
|
+
return config;
|
|
428
|
+
}
|
|
429
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
430
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
431
|
+
return null;
|
|
432
|
+
}
|
|
433
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
434
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
435
|
+
}
|
|
436
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
437
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
438
|
+
return null;
|
|
439
|
+
}
|
|
440
|
+
return config;
|
|
441
|
+
}
|
|
442
|
+
function adapterFragment(luvio, config) {
|
|
443
|
+
createResourceParams$1(config);
|
|
444
|
+
return select$2();
|
|
445
|
+
}
|
|
446
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
447
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
|
|
448
|
+
config,
|
|
449
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
450
|
+
});
|
|
451
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
452
|
+
}
|
|
453
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
454
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
455
|
+
config,
|
|
456
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
457
|
+
});
|
|
458
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
459
|
+
}
|
|
460
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
461
|
+
const resourceParams = createResourceParams$1(config);
|
|
462
|
+
const request = createResourceRequest$1(resourceParams);
|
|
463
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
464
|
+
.then((response) => {
|
|
465
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
466
|
+
const cache = new StoreKeyMap();
|
|
467
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
468
|
+
return cache;
|
|
469
|
+
});
|
|
470
|
+
}, (response) => {
|
|
471
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
475
|
+
return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
|
|
476
|
+
}
|
|
477
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
478
|
+
const { luvio, config } = context;
|
|
479
|
+
const selector = {
|
|
480
|
+
recordId: keyBuilder$1(luvio, config),
|
|
481
|
+
node: adapterFragment(luvio, config),
|
|
482
|
+
variables: {},
|
|
483
|
+
};
|
|
484
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
485
|
+
config,
|
|
486
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
487
|
+
});
|
|
488
|
+
return cacheSnapshot;
|
|
489
|
+
}
|
|
490
|
+
const getDroDecompositionViewerAdapterFactory = (luvio) => function dfo__getDroDecompositionViewer(untrustedConfig, requestContext) {
|
|
491
|
+
const config = validateAdapterConfig$1(untrustedConfig, getDroDecompositionViewer_ConfigPropertyNames);
|
|
492
|
+
// Invalid or incomplete config
|
|
493
|
+
if (config === null) {
|
|
494
|
+
return null;
|
|
495
|
+
}
|
|
496
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
497
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
const TTL = 1000;
|
|
501
|
+
const VERSION = "9118841e4b6126264ec72c8a2ff0f35e";
|
|
502
|
+
function validate(obj, path = 'DfoConfigInfoUpdateOutputRepresentation') {
|
|
503
|
+
const v_error = (() => {
|
|
504
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
505
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
506
|
+
}
|
|
507
|
+
const obj_status = obj.status;
|
|
508
|
+
const path_status = path + '.status';
|
|
509
|
+
if (typeof obj_status !== 'string') {
|
|
510
|
+
return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
|
|
511
|
+
}
|
|
512
|
+
})();
|
|
513
|
+
return v_error === undefined ? null : v_error;
|
|
514
|
+
}
|
|
515
|
+
const RepresentationType = 'DfoConfigInfoUpdateOutputRepresentation';
|
|
516
|
+
function keyBuilder(luvio, config) {
|
|
517
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.message;
|
|
518
|
+
}
|
|
519
|
+
function keyBuilderFromType(luvio, object) {
|
|
520
|
+
const keyParams = {
|
|
521
|
+
message: object.status
|
|
522
|
+
};
|
|
523
|
+
return keyBuilder(luvio, keyParams);
|
|
524
|
+
}
|
|
525
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
526
|
+
return input;
|
|
527
|
+
}
|
|
528
|
+
const select$1 = function DfoConfigInfoUpdateOutputRepresentationSelect() {
|
|
529
|
+
return {
|
|
530
|
+
kind: 'Fragment',
|
|
531
|
+
version: VERSION,
|
|
532
|
+
private: [],
|
|
533
|
+
opaque: true
|
|
534
|
+
};
|
|
535
|
+
};
|
|
536
|
+
function equals(existing, incoming) {
|
|
537
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
538
|
+
return false;
|
|
539
|
+
}
|
|
540
|
+
return true;
|
|
541
|
+
}
|
|
542
|
+
const ingest = function DfoConfigInfoUpdateOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
543
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
544
|
+
const validateError = validate(input);
|
|
545
|
+
if (validateError !== null) {
|
|
546
|
+
throw validateError;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
const key = keyBuilderFromType(luvio, input);
|
|
550
|
+
const ttlToUse = TTL;
|
|
551
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "dfo", VERSION, RepresentationType, equals);
|
|
552
|
+
return createLink(key);
|
|
553
|
+
};
|
|
554
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
555
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
556
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
557
|
+
rootKeySet.set(rootKey, {
|
|
558
|
+
namespace: keyPrefix,
|
|
559
|
+
representationName: RepresentationType,
|
|
560
|
+
mergeable: false
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
function select(luvio, params) {
|
|
565
|
+
return select$1();
|
|
566
|
+
}
|
|
567
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
568
|
+
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
569
|
+
}
|
|
570
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
571
|
+
const { body } = response;
|
|
572
|
+
const key = keyBuilderFromType(luvio, body);
|
|
573
|
+
luvio.storeIngest(key, ingest, body);
|
|
574
|
+
const snapshot = luvio.storeLookup({
|
|
575
|
+
recordId: key,
|
|
576
|
+
node: select(),
|
|
577
|
+
variables: {},
|
|
578
|
+
});
|
|
579
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
580
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
581
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
deepFreeze(snapshot.data);
|
|
585
|
+
return snapshot;
|
|
586
|
+
}
|
|
587
|
+
function createResourceRequest(config) {
|
|
588
|
+
const headers = {};
|
|
589
|
+
return {
|
|
590
|
+
baseUri: '/services/data/v66.0',
|
|
591
|
+
basePath: '/connect/revenue/dro/configurations',
|
|
592
|
+
method: 'put',
|
|
593
|
+
body: config.body,
|
|
594
|
+
urlParams: {},
|
|
595
|
+
queryParams: {},
|
|
596
|
+
headers,
|
|
597
|
+
priority: 'normal',
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
const adapterName = 'putDfoConfigInfo';
|
|
602
|
+
const putDfoConfigInfo_ConfigPropertyMetadata = [
|
|
603
|
+
generateParamConfigMetadata('values', true, 2 /* Body */, 4 /* Unsupported */),
|
|
604
|
+
];
|
|
605
|
+
const putDfoConfigInfo_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, putDfoConfigInfo_ConfigPropertyMetadata);
|
|
606
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$3(putDfoConfigInfo_ConfigPropertyMetadata);
|
|
607
|
+
function typeCheckConfig(untrustedConfig) {
|
|
608
|
+
const config = {};
|
|
609
|
+
const untrustedConfig_values = untrustedConfig.values;
|
|
610
|
+
if (untrustedIsObject(untrustedConfig_values)) {
|
|
611
|
+
const untrustedConfig_values_object = {};
|
|
612
|
+
const untrustedConfig_values_keys = Object.keys(untrustedConfig_values);
|
|
613
|
+
for (let i = 0, arrayLength = untrustedConfig_values_keys.length; i < arrayLength; i++) {
|
|
614
|
+
const key = untrustedConfig_values_keys[i];
|
|
615
|
+
const untrustedConfig_values_prop = untrustedConfig_values[key];
|
|
616
|
+
if (typeof untrustedConfig_values_prop === 'string') {
|
|
617
|
+
if (untrustedConfig_values_object !== undefined) {
|
|
618
|
+
untrustedConfig_values_object[key] = untrustedConfig_values_prop;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
if (untrustedConfig_values_object !== undefined && Object.keys(untrustedConfig_values_object).length >= 0) {
|
|
623
|
+
config.values = untrustedConfig_values_object;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
return config;
|
|
627
|
+
}
|
|
628
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
629
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
630
|
+
return null;
|
|
631
|
+
}
|
|
632
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
633
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
634
|
+
}
|
|
635
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
636
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
637
|
+
return null;
|
|
638
|
+
}
|
|
639
|
+
return config;
|
|
640
|
+
}
|
|
641
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
642
|
+
const resourceParams = createResourceParams(config);
|
|
643
|
+
const request = createResourceRequest(resourceParams);
|
|
644
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
645
|
+
.then((response) => {
|
|
646
|
+
return luvio.handleSuccessResponse(() => {
|
|
647
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
648
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
649
|
+
}, () => {
|
|
650
|
+
const cache = new StoreKeyMap();
|
|
651
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
652
|
+
return cache;
|
|
653
|
+
});
|
|
654
|
+
}, (response) => {
|
|
655
|
+
deepFreeze(response);
|
|
656
|
+
throw response;
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
const putDfoConfigInfoAdapterFactory = (luvio) => {
|
|
660
|
+
return function putDfoConfigInfo(untrustedConfig) {
|
|
661
|
+
const config = validateAdapterConfig(untrustedConfig, putDfoConfigInfo_ConfigPropertyNames);
|
|
662
|
+
// Invalid or incomplete config
|
|
663
|
+
if (config === null) {
|
|
664
|
+
throw new Error('Invalid config for "putDfoConfigInfo"');
|
|
665
|
+
}
|
|
666
|
+
return buildNetworkSnapshot(luvio, config);
|
|
667
|
+
};
|
|
668
|
+
};
|
|
669
|
+
|
|
670
|
+
let getDfoConfigInfo;
|
|
671
|
+
let getDroDecompositionViewer;
|
|
672
|
+
let putDfoConfigInfo;
|
|
673
|
+
// Imperative GET Adapters
|
|
674
|
+
let getDfoConfigInfo_imperative;
|
|
675
|
+
let getDroDecompositionViewer_imperative;
|
|
676
|
+
// Adapter Metadata
|
|
677
|
+
const getDfoConfigInfoMetadata = { apiFamily: 'dfo', name: 'getDfoConfigInfo', ttl: 1000 };
|
|
678
|
+
const getDroDecompositionViewerMetadata = {
|
|
679
|
+
apiFamily: 'dfo',
|
|
680
|
+
name: 'getDroDecompositionViewer',
|
|
681
|
+
ttl: 1000,
|
|
682
|
+
};
|
|
683
|
+
// Notify Update Available
|
|
684
|
+
function bindExportsTo(luvio) {
|
|
685
|
+
// LDS Adapters
|
|
686
|
+
const getDfoConfigInfo_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getDfoConfigInfo', getDfoConfigInfoAdapterFactory), getDfoConfigInfoMetadata);
|
|
687
|
+
const getDroDecompositionViewer_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getDroDecompositionViewer', getDroDecompositionViewerAdapterFactory), getDroDecompositionViewerMetadata);
|
|
688
|
+
function unwrapSnapshotData(factory) {
|
|
689
|
+
const adapter = factory(luvio);
|
|
690
|
+
return (config) => adapter(config).then((snapshot) => snapshot.data);
|
|
691
|
+
}
|
|
692
|
+
return {
|
|
693
|
+
getDfoConfigInfo: createWireAdapterConstructor(luvio, getDfoConfigInfo_ldsAdapter, getDfoConfigInfoMetadata),
|
|
694
|
+
getDroDecompositionViewer: createWireAdapterConstructor(luvio, getDroDecompositionViewer_ldsAdapter, getDroDecompositionViewerMetadata),
|
|
695
|
+
putDfoConfigInfo: unwrapSnapshotData(putDfoConfigInfoAdapterFactory),
|
|
696
|
+
// Imperative GET Adapters
|
|
697
|
+
getDfoConfigInfo_imperative: createImperativeAdapter(luvio, getDfoConfigInfo_ldsAdapter, getDfoConfigInfoMetadata),
|
|
698
|
+
getDroDecompositionViewer_imperative: createImperativeAdapter(luvio, getDroDecompositionViewer_ldsAdapter, getDroDecompositionViewerMetadata),
|
|
699
|
+
// Notify Update Availables
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
withDefaultLuvio((luvio) => {
|
|
703
|
+
({
|
|
704
|
+
getDfoConfigInfo,
|
|
705
|
+
getDroDecompositionViewer,
|
|
706
|
+
putDfoConfigInfo,
|
|
707
|
+
getDfoConfigInfo_imperative,
|
|
708
|
+
getDroDecompositionViewer_imperative,
|
|
709
|
+
} = bindExportsTo(luvio));
|
|
710
|
+
});
|
|
711
|
+
|
|
712
|
+
export { getDfoConfigInfo, getDfoConfigInfo_imperative, getDroDecompositionViewer, getDroDecompositionViewer_imperative, putDfoConfigInfo };
|
|
713
|
+
// version: 0.1.0-dev1-c978a7b010
|