@salesforce/lds-adapters-cdp-calculated-insights 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/cdp-calculated-insights.js +1455 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/getCalculatedInsightMetadata.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/adapters/getCalculatedInsightsMetadata.d.ts +32 -0
- package/dist/es/es2018/types/src/generated/adapters/queryCalculatedInsight.d.ts +35 -0
- package/dist/es/es2018/types/src/generated/adapters/queryProfileCalculatedInsight.d.ts +39 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +4 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +10 -0
- package/dist/es/es2018/types/src/generated/resources/getSsotCalculatedInsights.d.ts +20 -0
- package/dist/es/es2018/types/src/generated/resources/getSsotCalculatedInsightsByApiName.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/resources/getSsotInsightCalculatedInsightsByCiName.d.ts +25 -0
- package/dist/es/es2018/types/src/generated/resources/getSsotProfileCalculatedInsightsByCiNameAndDataModelNameAndId.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/CdpCalculatedInsightCollectionDataRepresentation.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/types/CdpCalculatedInsightCollectionRepresentation.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/CdpCalculatedInsightDataSourceRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/CdpCalculatedInsightDimensionRepresentation.d.ts +50 -0
- package/dist/es/es2018/types/src/generated/types/CdpCalculatedInsightErrorResponseRepresentation.d.ts +40 -0
- package/dist/es/es2018/types/src/generated/types/CdpCalculatedInsightMeasureRepresentation.d.ts +50 -0
- package/dist/es/es2018/types/src/generated/types/CdpCalculatedInsightRepresentation.d.ts +99 -0
- package/dist/es/es2018/types/src/generated/types/CdpQueryMetadataItemRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/CdpQueryMetadataOutputRepresentation.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/types/CdpQueryOutputRepresentation.d.ts +54 -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 +1564 -0
- package/src/raml/api.raml +412 -0
- package/src/raml/luvio.raml +56 -0
|
@@ -0,0 +1,1455 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$4, typeCheckConfig as typeCheckConfig$4, StoreKeyMap, createResourceParams as createResourceParams$4 } 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 = 'calculated-insights';
|
|
73
|
+
|
|
74
|
+
const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
75
|
+
const { isArray: ArrayIsArray } = Array;
|
|
76
|
+
const { stringify: JSONStringify } = JSON;
|
|
77
|
+
function createLink(ref) {
|
|
78
|
+
return {
|
|
79
|
+
__ref: serializeStructuredKey(ref),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function validate$6(obj, path = 'CdpCalculatedInsightDataSourceRepresentation') {
|
|
84
|
+
const v_error = (() => {
|
|
85
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
86
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
87
|
+
}
|
|
88
|
+
const obj_sourceApiName = obj.sourceApiName;
|
|
89
|
+
const path_sourceApiName = path + '.sourceApiName';
|
|
90
|
+
if (typeof obj_sourceApiName !== 'string') {
|
|
91
|
+
return new TypeError('Expected "string" but received "' + typeof obj_sourceApiName + '" (at "' + path_sourceApiName + '")');
|
|
92
|
+
}
|
|
93
|
+
const obj_type = obj.type;
|
|
94
|
+
const path_type = path + '.type';
|
|
95
|
+
if (typeof obj_type !== 'string') {
|
|
96
|
+
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
97
|
+
}
|
|
98
|
+
})();
|
|
99
|
+
return v_error === undefined ? null : v_error;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function validate$5(obj, path = 'CdpCalculatedInsightDimensionRepresentation') {
|
|
103
|
+
const v_error = (() => {
|
|
104
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
105
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
106
|
+
}
|
|
107
|
+
const obj_apiName = obj.apiName;
|
|
108
|
+
const path_apiName = path + '.apiName';
|
|
109
|
+
if (typeof obj_apiName !== 'string') {
|
|
110
|
+
return new TypeError('Expected "string" but received "' + typeof obj_apiName + '" (at "' + path_apiName + '")');
|
|
111
|
+
}
|
|
112
|
+
const obj_creationType = obj.creationType;
|
|
113
|
+
const path_creationType = path + '.creationType';
|
|
114
|
+
if (typeof obj_creationType !== 'string') {
|
|
115
|
+
return new TypeError('Expected "string" but received "' + typeof obj_creationType + '" (at "' + path_creationType + '")');
|
|
116
|
+
}
|
|
117
|
+
const obj_dataSource = obj.dataSource;
|
|
118
|
+
const path_dataSource = path + '.dataSource';
|
|
119
|
+
const referencepath_dataSourceValidationError = validate$6(obj_dataSource, path_dataSource);
|
|
120
|
+
if (referencepath_dataSourceValidationError !== null) {
|
|
121
|
+
let message = 'Object doesn\'t match CdpCalculatedInsightDataSourceRepresentation (at "' + path_dataSource + '")\n';
|
|
122
|
+
message += referencepath_dataSourceValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
123
|
+
return new TypeError(message);
|
|
124
|
+
}
|
|
125
|
+
const obj_dataType = obj.dataType;
|
|
126
|
+
const path_dataType = path + '.dataType';
|
|
127
|
+
if (typeof obj_dataType !== 'string') {
|
|
128
|
+
return new TypeError('Expected "string" but received "' + typeof obj_dataType + '" (at "' + path_dataType + '")');
|
|
129
|
+
}
|
|
130
|
+
const obj_dateGranularity = obj.dateGranularity;
|
|
131
|
+
const path_dateGranularity = path + '.dateGranularity';
|
|
132
|
+
let obj_dateGranularity_union0 = null;
|
|
133
|
+
const obj_dateGranularity_union0_error = (() => {
|
|
134
|
+
if (typeof obj_dateGranularity !== 'string') {
|
|
135
|
+
return new TypeError('Expected "string" but received "' + typeof obj_dateGranularity + '" (at "' + path_dateGranularity + '")');
|
|
136
|
+
}
|
|
137
|
+
})();
|
|
138
|
+
if (obj_dateGranularity_union0_error != null) {
|
|
139
|
+
obj_dateGranularity_union0 = obj_dateGranularity_union0_error.message;
|
|
140
|
+
}
|
|
141
|
+
let obj_dateGranularity_union1 = null;
|
|
142
|
+
const obj_dateGranularity_union1_error = (() => {
|
|
143
|
+
if (obj_dateGranularity !== null) {
|
|
144
|
+
return new TypeError('Expected "null" but received "' + typeof obj_dateGranularity + '" (at "' + path_dateGranularity + '")');
|
|
145
|
+
}
|
|
146
|
+
})();
|
|
147
|
+
if (obj_dateGranularity_union1_error != null) {
|
|
148
|
+
obj_dateGranularity_union1 = obj_dateGranularity_union1_error.message;
|
|
149
|
+
}
|
|
150
|
+
if (obj_dateGranularity_union0 && obj_dateGranularity_union1) {
|
|
151
|
+
let message = 'Object doesn\'t match union (at "' + path_dateGranularity + '")';
|
|
152
|
+
message += '\n' + obj_dateGranularity_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
153
|
+
message += '\n' + obj_dateGranularity_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
154
|
+
return new TypeError(message);
|
|
155
|
+
}
|
|
156
|
+
const obj_displayName = obj.displayName;
|
|
157
|
+
const path_displayName = path + '.displayName';
|
|
158
|
+
if (typeof obj_displayName !== 'string') {
|
|
159
|
+
return new TypeError('Expected "string" but received "' + typeof obj_displayName + '" (at "' + path_displayName + '")');
|
|
160
|
+
}
|
|
161
|
+
const obj_fieldRole = obj.fieldRole;
|
|
162
|
+
const path_fieldRole = path + '.fieldRole';
|
|
163
|
+
if (typeof obj_fieldRole !== 'string') {
|
|
164
|
+
return new TypeError('Expected "string" but received "' + typeof obj_fieldRole + '" (at "' + path_fieldRole + '")');
|
|
165
|
+
}
|
|
166
|
+
const obj_formula = obj.formula;
|
|
167
|
+
const path_formula = path + '.formula';
|
|
168
|
+
if (typeof obj_formula !== 'string') {
|
|
169
|
+
return new TypeError('Expected "string" but received "' + typeof obj_formula + '" (at "' + path_formula + '")');
|
|
170
|
+
}
|
|
171
|
+
})();
|
|
172
|
+
return v_error === undefined ? null : v_error;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function validate$4(obj, path = 'CdpCalculatedInsightMeasureRepresentation') {
|
|
176
|
+
const v_error = (() => {
|
|
177
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
178
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
179
|
+
}
|
|
180
|
+
const obj_apiName = obj.apiName;
|
|
181
|
+
const path_apiName = path + '.apiName';
|
|
182
|
+
if (typeof obj_apiName !== 'string') {
|
|
183
|
+
return new TypeError('Expected "string" but received "' + typeof obj_apiName + '" (at "' + path_apiName + '")');
|
|
184
|
+
}
|
|
185
|
+
const obj_creationType = obj.creationType;
|
|
186
|
+
const path_creationType = path + '.creationType';
|
|
187
|
+
if (typeof obj_creationType !== 'string') {
|
|
188
|
+
return new TypeError('Expected "string" but received "' + typeof obj_creationType + '" (at "' + path_creationType + '")');
|
|
189
|
+
}
|
|
190
|
+
const obj_dataSource = obj.dataSource;
|
|
191
|
+
const path_dataSource = path + '.dataSource';
|
|
192
|
+
const referencepath_dataSourceValidationError = validate$6(obj_dataSource, path_dataSource);
|
|
193
|
+
if (referencepath_dataSourceValidationError !== null) {
|
|
194
|
+
let message = 'Object doesn\'t match CdpCalculatedInsightDataSourceRepresentation (at "' + path_dataSource + '")\n';
|
|
195
|
+
message += referencepath_dataSourceValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
196
|
+
return new TypeError(message);
|
|
197
|
+
}
|
|
198
|
+
const obj_dataType = obj.dataType;
|
|
199
|
+
const path_dataType = path + '.dataType';
|
|
200
|
+
if (typeof obj_dataType !== 'string') {
|
|
201
|
+
return new TypeError('Expected "string" but received "' + typeof obj_dataType + '" (at "' + path_dataType + '")');
|
|
202
|
+
}
|
|
203
|
+
const obj_displayName = obj.displayName;
|
|
204
|
+
const path_displayName = path + '.displayName';
|
|
205
|
+
if (typeof obj_displayName !== 'string') {
|
|
206
|
+
return new TypeError('Expected "string" but received "' + typeof obj_displayName + '" (at "' + path_displayName + '")');
|
|
207
|
+
}
|
|
208
|
+
const obj_fieldAggregationType = obj.fieldAggregationType;
|
|
209
|
+
const path_fieldAggregationType = path + '.fieldAggregationType';
|
|
210
|
+
if (typeof obj_fieldAggregationType !== 'string') {
|
|
211
|
+
return new TypeError('Expected "string" but received "' + typeof obj_fieldAggregationType + '" (at "' + path_fieldAggregationType + '")');
|
|
212
|
+
}
|
|
213
|
+
const obj_fieldRole = obj.fieldRole;
|
|
214
|
+
const path_fieldRole = path + '.fieldRole';
|
|
215
|
+
if (typeof obj_fieldRole !== 'string') {
|
|
216
|
+
return new TypeError('Expected "string" but received "' + typeof obj_fieldRole + '" (at "' + path_fieldRole + '")');
|
|
217
|
+
}
|
|
218
|
+
const obj_formula = obj.formula;
|
|
219
|
+
const path_formula = path + '.formula';
|
|
220
|
+
if (typeof obj_formula !== 'string') {
|
|
221
|
+
return new TypeError('Expected "string" but received "' + typeof obj_formula + '" (at "' + path_formula + '")');
|
|
222
|
+
}
|
|
223
|
+
})();
|
|
224
|
+
return v_error === undefined ? null : v_error;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const VERSION$2 = "f316567639b3e0e679952c9d3a21ba22";
|
|
228
|
+
function validate$3(obj, path = 'CdpCalculatedInsightRepresentation') {
|
|
229
|
+
const v_error = (() => {
|
|
230
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
231
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
232
|
+
}
|
|
233
|
+
const obj_apiName = obj.apiName;
|
|
234
|
+
const path_apiName = path + '.apiName';
|
|
235
|
+
if (typeof obj_apiName !== 'string') {
|
|
236
|
+
return new TypeError('Expected "string" but received "' + typeof obj_apiName + '" (at "' + path_apiName + '")');
|
|
237
|
+
}
|
|
238
|
+
const obj_calculatedInsightStatus = obj.calculatedInsightStatus;
|
|
239
|
+
const path_calculatedInsightStatus = path + '.calculatedInsightStatus';
|
|
240
|
+
if (typeof obj_calculatedInsightStatus !== 'string') {
|
|
241
|
+
return new TypeError('Expected "string" but received "' + typeof obj_calculatedInsightStatus + '" (at "' + path_calculatedInsightStatus + '")');
|
|
242
|
+
}
|
|
243
|
+
const obj_creationType = obj.creationType;
|
|
244
|
+
const path_creationType = path + '.creationType';
|
|
245
|
+
if (typeof obj_creationType !== 'string') {
|
|
246
|
+
return new TypeError('Expected "string" but received "' + typeof obj_creationType + '" (at "' + path_creationType + '")');
|
|
247
|
+
}
|
|
248
|
+
const obj_dataSpace = obj.dataSpace;
|
|
249
|
+
const path_dataSpace = path + '.dataSpace';
|
|
250
|
+
if (typeof obj_dataSpace !== 'string') {
|
|
251
|
+
return new TypeError('Expected "string" but received "' + typeof obj_dataSpace + '" (at "' + path_dataSpace + '")');
|
|
252
|
+
}
|
|
253
|
+
const obj_definitionStatus = obj.definitionStatus;
|
|
254
|
+
const path_definitionStatus = path + '.definitionStatus';
|
|
255
|
+
if (typeof obj_definitionStatus !== 'string') {
|
|
256
|
+
return new TypeError('Expected "string" but received "' + typeof obj_definitionStatus + '" (at "' + path_definitionStatus + '")');
|
|
257
|
+
}
|
|
258
|
+
const obj_definitionType = obj.definitionType;
|
|
259
|
+
const path_definitionType = path + '.definitionType';
|
|
260
|
+
if (typeof obj_definitionType !== 'string') {
|
|
261
|
+
return new TypeError('Expected "string" but received "' + typeof obj_definitionType + '" (at "' + path_definitionType + '")');
|
|
262
|
+
}
|
|
263
|
+
const obj_description = obj.description;
|
|
264
|
+
const path_description = path + '.description';
|
|
265
|
+
let obj_description_union0 = null;
|
|
266
|
+
const obj_description_union0_error = (() => {
|
|
267
|
+
if (typeof obj_description !== 'string') {
|
|
268
|
+
return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
|
|
269
|
+
}
|
|
270
|
+
})();
|
|
271
|
+
if (obj_description_union0_error != null) {
|
|
272
|
+
obj_description_union0 = obj_description_union0_error.message;
|
|
273
|
+
}
|
|
274
|
+
let obj_description_union1 = null;
|
|
275
|
+
const obj_description_union1_error = (() => {
|
|
276
|
+
if (obj_description !== null) {
|
|
277
|
+
return new TypeError('Expected "null" but received "' + typeof obj_description + '" (at "' + path_description + '")');
|
|
278
|
+
}
|
|
279
|
+
})();
|
|
280
|
+
if (obj_description_union1_error != null) {
|
|
281
|
+
obj_description_union1 = obj_description_union1_error.message;
|
|
282
|
+
}
|
|
283
|
+
if (obj_description_union0 && obj_description_union1) {
|
|
284
|
+
let message = 'Object doesn\'t match union (at "' + path_description + '")';
|
|
285
|
+
message += '\n' + obj_description_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
286
|
+
message += '\n' + obj_description_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
287
|
+
return new TypeError(message);
|
|
288
|
+
}
|
|
289
|
+
const obj_dimensions = obj.dimensions;
|
|
290
|
+
const path_dimensions = path + '.dimensions';
|
|
291
|
+
if (!ArrayIsArray(obj_dimensions)) {
|
|
292
|
+
return new TypeError('Expected "array" but received "' + typeof obj_dimensions + '" (at "' + path_dimensions + '")');
|
|
293
|
+
}
|
|
294
|
+
for (let i = 0; i < obj_dimensions.length; i++) {
|
|
295
|
+
const obj_dimensions_item = obj_dimensions[i];
|
|
296
|
+
const path_dimensions_item = path_dimensions + '[' + i + ']';
|
|
297
|
+
const referencepath_dimensions_itemValidationError = validate$5(obj_dimensions_item, path_dimensions_item);
|
|
298
|
+
if (referencepath_dimensions_itemValidationError !== null) {
|
|
299
|
+
let message = 'Object doesn\'t match CdpCalculatedInsightDimensionRepresentation (at "' + path_dimensions_item + '")\n';
|
|
300
|
+
message += referencepath_dimensions_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
301
|
+
return new TypeError(message);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
const obj_displayName = obj.displayName;
|
|
305
|
+
const path_displayName = path + '.displayName';
|
|
306
|
+
if (typeof obj_displayName !== 'string') {
|
|
307
|
+
return new TypeError('Expected "string" but received "' + typeof obj_displayName + '" (at "' + path_displayName + '")');
|
|
308
|
+
}
|
|
309
|
+
const obj_expression = obj.expression;
|
|
310
|
+
const path_expression = path + '.expression';
|
|
311
|
+
if (typeof obj_expression !== 'string') {
|
|
312
|
+
return new TypeError('Expected "string" but received "' + typeof obj_expression + '" (at "' + path_expression + '")');
|
|
313
|
+
}
|
|
314
|
+
const obj_isEnabled = obj.isEnabled;
|
|
315
|
+
const path_isEnabled = path + '.isEnabled';
|
|
316
|
+
if (typeof obj_isEnabled !== 'boolean') {
|
|
317
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isEnabled + '" (at "' + path_isEnabled + '")');
|
|
318
|
+
}
|
|
319
|
+
const obj_lastCalcInsightStatusDateTime = obj.lastCalcInsightStatusDateTime;
|
|
320
|
+
const path_lastCalcInsightStatusDateTime = path + '.lastCalcInsightStatusDateTime';
|
|
321
|
+
if (typeof obj_lastCalcInsightStatusDateTime !== 'string') {
|
|
322
|
+
return new TypeError('Expected "string" but received "' + typeof obj_lastCalcInsightStatusDateTime + '" (at "' + path_lastCalcInsightStatusDateTime + '")');
|
|
323
|
+
}
|
|
324
|
+
const obj_lastCalcInsightStatusErrorCode = obj.lastCalcInsightStatusErrorCode;
|
|
325
|
+
const path_lastCalcInsightStatusErrorCode = path + '.lastCalcInsightStatusErrorCode';
|
|
326
|
+
let obj_lastCalcInsightStatusErrorCode_union0 = null;
|
|
327
|
+
const obj_lastCalcInsightStatusErrorCode_union0_error = (() => {
|
|
328
|
+
if (typeof obj_lastCalcInsightStatusErrorCode !== 'string') {
|
|
329
|
+
return new TypeError('Expected "string" but received "' + typeof obj_lastCalcInsightStatusErrorCode + '" (at "' + path_lastCalcInsightStatusErrorCode + '")');
|
|
330
|
+
}
|
|
331
|
+
})();
|
|
332
|
+
if (obj_lastCalcInsightStatusErrorCode_union0_error != null) {
|
|
333
|
+
obj_lastCalcInsightStatusErrorCode_union0 = obj_lastCalcInsightStatusErrorCode_union0_error.message;
|
|
334
|
+
}
|
|
335
|
+
let obj_lastCalcInsightStatusErrorCode_union1 = null;
|
|
336
|
+
const obj_lastCalcInsightStatusErrorCode_union1_error = (() => {
|
|
337
|
+
if (obj_lastCalcInsightStatusErrorCode !== null) {
|
|
338
|
+
return new TypeError('Expected "null" but received "' + typeof obj_lastCalcInsightStatusErrorCode + '" (at "' + path_lastCalcInsightStatusErrorCode + '")');
|
|
339
|
+
}
|
|
340
|
+
})();
|
|
341
|
+
if (obj_lastCalcInsightStatusErrorCode_union1_error != null) {
|
|
342
|
+
obj_lastCalcInsightStatusErrorCode_union1 = obj_lastCalcInsightStatusErrorCode_union1_error.message;
|
|
343
|
+
}
|
|
344
|
+
if (obj_lastCalcInsightStatusErrorCode_union0 && obj_lastCalcInsightStatusErrorCode_union1) {
|
|
345
|
+
let message = 'Object doesn\'t match union (at "' + path_lastCalcInsightStatusErrorCode + '")';
|
|
346
|
+
message += '\n' + obj_lastCalcInsightStatusErrorCode_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
347
|
+
message += '\n' + obj_lastCalcInsightStatusErrorCode_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
348
|
+
return new TypeError(message);
|
|
349
|
+
}
|
|
350
|
+
const obj_lastRunDateTime = obj.lastRunDateTime;
|
|
351
|
+
const path_lastRunDateTime = path + '.lastRunDateTime';
|
|
352
|
+
let obj_lastRunDateTime_union0 = null;
|
|
353
|
+
const obj_lastRunDateTime_union0_error = (() => {
|
|
354
|
+
if (typeof obj_lastRunDateTime !== 'string') {
|
|
355
|
+
return new TypeError('Expected "string" but received "' + typeof obj_lastRunDateTime + '" (at "' + path_lastRunDateTime + '")');
|
|
356
|
+
}
|
|
357
|
+
})();
|
|
358
|
+
if (obj_lastRunDateTime_union0_error != null) {
|
|
359
|
+
obj_lastRunDateTime_union0 = obj_lastRunDateTime_union0_error.message;
|
|
360
|
+
}
|
|
361
|
+
let obj_lastRunDateTime_union1 = null;
|
|
362
|
+
const obj_lastRunDateTime_union1_error = (() => {
|
|
363
|
+
if (obj_lastRunDateTime !== null) {
|
|
364
|
+
return new TypeError('Expected "null" but received "' + typeof obj_lastRunDateTime + '" (at "' + path_lastRunDateTime + '")');
|
|
365
|
+
}
|
|
366
|
+
})();
|
|
367
|
+
if (obj_lastRunDateTime_union1_error != null) {
|
|
368
|
+
obj_lastRunDateTime_union1 = obj_lastRunDateTime_union1_error.message;
|
|
369
|
+
}
|
|
370
|
+
if (obj_lastRunDateTime_union0 && obj_lastRunDateTime_union1) {
|
|
371
|
+
let message = 'Object doesn\'t match union (at "' + path_lastRunDateTime + '")';
|
|
372
|
+
message += '\n' + obj_lastRunDateTime_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
373
|
+
message += '\n' + obj_lastRunDateTime_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
374
|
+
return new TypeError(message);
|
|
375
|
+
}
|
|
376
|
+
const obj_lastRunStatus = obj.lastRunStatus;
|
|
377
|
+
const path_lastRunStatus = path + '.lastRunStatus';
|
|
378
|
+
let obj_lastRunStatus_union0 = null;
|
|
379
|
+
const obj_lastRunStatus_union0_error = (() => {
|
|
380
|
+
if (typeof obj_lastRunStatus !== 'string') {
|
|
381
|
+
return new TypeError('Expected "string" but received "' + typeof obj_lastRunStatus + '" (at "' + path_lastRunStatus + '")');
|
|
382
|
+
}
|
|
383
|
+
})();
|
|
384
|
+
if (obj_lastRunStatus_union0_error != null) {
|
|
385
|
+
obj_lastRunStatus_union0 = obj_lastRunStatus_union0_error.message;
|
|
386
|
+
}
|
|
387
|
+
let obj_lastRunStatus_union1 = null;
|
|
388
|
+
const obj_lastRunStatus_union1_error = (() => {
|
|
389
|
+
if (obj_lastRunStatus !== null) {
|
|
390
|
+
return new TypeError('Expected "null" but received "' + typeof obj_lastRunStatus + '" (at "' + path_lastRunStatus + '")');
|
|
391
|
+
}
|
|
392
|
+
})();
|
|
393
|
+
if (obj_lastRunStatus_union1_error != null) {
|
|
394
|
+
obj_lastRunStatus_union1 = obj_lastRunStatus_union1_error.message;
|
|
395
|
+
}
|
|
396
|
+
if (obj_lastRunStatus_union0 && obj_lastRunStatus_union1) {
|
|
397
|
+
let message = 'Object doesn\'t match union (at "' + path_lastRunStatus + '")';
|
|
398
|
+
message += '\n' + obj_lastRunStatus_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
399
|
+
message += '\n' + obj_lastRunStatus_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
400
|
+
return new TypeError(message);
|
|
401
|
+
}
|
|
402
|
+
const obj_lastRunStatusDateTime = obj.lastRunStatusDateTime;
|
|
403
|
+
const path_lastRunStatusDateTime = path + '.lastRunStatusDateTime';
|
|
404
|
+
let obj_lastRunStatusDateTime_union0 = null;
|
|
405
|
+
const obj_lastRunStatusDateTime_union0_error = (() => {
|
|
406
|
+
if (typeof obj_lastRunStatusDateTime !== 'string') {
|
|
407
|
+
return new TypeError('Expected "string" but received "' + typeof obj_lastRunStatusDateTime + '" (at "' + path_lastRunStatusDateTime + '")');
|
|
408
|
+
}
|
|
409
|
+
})();
|
|
410
|
+
if (obj_lastRunStatusDateTime_union0_error != null) {
|
|
411
|
+
obj_lastRunStatusDateTime_union0 = obj_lastRunStatusDateTime_union0_error.message;
|
|
412
|
+
}
|
|
413
|
+
let obj_lastRunStatusDateTime_union1 = null;
|
|
414
|
+
const obj_lastRunStatusDateTime_union1_error = (() => {
|
|
415
|
+
if (obj_lastRunStatusDateTime !== null) {
|
|
416
|
+
return new TypeError('Expected "null" but received "' + typeof obj_lastRunStatusDateTime + '" (at "' + path_lastRunStatusDateTime + '")');
|
|
417
|
+
}
|
|
418
|
+
})();
|
|
419
|
+
if (obj_lastRunStatusDateTime_union1_error != null) {
|
|
420
|
+
obj_lastRunStatusDateTime_union1 = obj_lastRunStatusDateTime_union1_error.message;
|
|
421
|
+
}
|
|
422
|
+
if (obj_lastRunStatusDateTime_union0 && obj_lastRunStatusDateTime_union1) {
|
|
423
|
+
let message = 'Object doesn\'t match union (at "' + path_lastRunStatusDateTime + '")';
|
|
424
|
+
message += '\n' + obj_lastRunStatusDateTime_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
425
|
+
message += '\n' + obj_lastRunStatusDateTime_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
426
|
+
return new TypeError(message);
|
|
427
|
+
}
|
|
428
|
+
const obj_lastRunStatusErrorCode = obj.lastRunStatusErrorCode;
|
|
429
|
+
const path_lastRunStatusErrorCode = path + '.lastRunStatusErrorCode';
|
|
430
|
+
let obj_lastRunStatusErrorCode_union0 = null;
|
|
431
|
+
const obj_lastRunStatusErrorCode_union0_error = (() => {
|
|
432
|
+
if (typeof obj_lastRunStatusErrorCode !== 'string') {
|
|
433
|
+
return new TypeError('Expected "string" but received "' + typeof obj_lastRunStatusErrorCode + '" (at "' + path_lastRunStatusErrorCode + '")');
|
|
434
|
+
}
|
|
435
|
+
})();
|
|
436
|
+
if (obj_lastRunStatusErrorCode_union0_error != null) {
|
|
437
|
+
obj_lastRunStatusErrorCode_union0 = obj_lastRunStatusErrorCode_union0_error.message;
|
|
438
|
+
}
|
|
439
|
+
let obj_lastRunStatusErrorCode_union1 = null;
|
|
440
|
+
const obj_lastRunStatusErrorCode_union1_error = (() => {
|
|
441
|
+
if (obj_lastRunStatusErrorCode !== null) {
|
|
442
|
+
return new TypeError('Expected "null" but received "' + typeof obj_lastRunStatusErrorCode + '" (at "' + path_lastRunStatusErrorCode + '")');
|
|
443
|
+
}
|
|
444
|
+
})();
|
|
445
|
+
if (obj_lastRunStatusErrorCode_union1_error != null) {
|
|
446
|
+
obj_lastRunStatusErrorCode_union1 = obj_lastRunStatusErrorCode_union1_error.message;
|
|
447
|
+
}
|
|
448
|
+
if (obj_lastRunStatusErrorCode_union0 && obj_lastRunStatusErrorCode_union1) {
|
|
449
|
+
let message = 'Object doesn\'t match union (at "' + path_lastRunStatusErrorCode + '")';
|
|
450
|
+
message += '\n' + obj_lastRunStatusErrorCode_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
451
|
+
message += '\n' + obj_lastRunStatusErrorCode_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
452
|
+
return new TypeError(message);
|
|
453
|
+
}
|
|
454
|
+
const obj_measures = obj.measures;
|
|
455
|
+
const path_measures = path + '.measures';
|
|
456
|
+
if (!ArrayIsArray(obj_measures)) {
|
|
457
|
+
return new TypeError('Expected "array" but received "' + typeof obj_measures + '" (at "' + path_measures + '")');
|
|
458
|
+
}
|
|
459
|
+
for (let i = 0; i < obj_measures.length; i++) {
|
|
460
|
+
const obj_measures_item = obj_measures[i];
|
|
461
|
+
const path_measures_item = path_measures + '[' + i + ']';
|
|
462
|
+
const referencepath_measures_itemValidationError = validate$4(obj_measures_item, path_measures_item);
|
|
463
|
+
if (referencepath_measures_itemValidationError !== null) {
|
|
464
|
+
let message = 'Object doesn\'t match CdpCalculatedInsightMeasureRepresentation (at "' + path_measures_item + '")\n';
|
|
465
|
+
message += referencepath_measures_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
466
|
+
return new TypeError(message);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
const obj_publishScheduleEndDate = obj.publishScheduleEndDate;
|
|
470
|
+
const path_publishScheduleEndDate = path + '.publishScheduleEndDate';
|
|
471
|
+
let obj_publishScheduleEndDate_union0 = null;
|
|
472
|
+
const obj_publishScheduleEndDate_union0_error = (() => {
|
|
473
|
+
if (typeof obj_publishScheduleEndDate !== 'string') {
|
|
474
|
+
return new TypeError('Expected "string" but received "' + typeof obj_publishScheduleEndDate + '" (at "' + path_publishScheduleEndDate + '")');
|
|
475
|
+
}
|
|
476
|
+
})();
|
|
477
|
+
if (obj_publishScheduleEndDate_union0_error != null) {
|
|
478
|
+
obj_publishScheduleEndDate_union0 = obj_publishScheduleEndDate_union0_error.message;
|
|
479
|
+
}
|
|
480
|
+
let obj_publishScheduleEndDate_union1 = null;
|
|
481
|
+
const obj_publishScheduleEndDate_union1_error = (() => {
|
|
482
|
+
if (obj_publishScheduleEndDate !== null) {
|
|
483
|
+
return new TypeError('Expected "null" but received "' + typeof obj_publishScheduleEndDate + '" (at "' + path_publishScheduleEndDate + '")');
|
|
484
|
+
}
|
|
485
|
+
})();
|
|
486
|
+
if (obj_publishScheduleEndDate_union1_error != null) {
|
|
487
|
+
obj_publishScheduleEndDate_union1 = obj_publishScheduleEndDate_union1_error.message;
|
|
488
|
+
}
|
|
489
|
+
if (obj_publishScheduleEndDate_union0 && obj_publishScheduleEndDate_union1) {
|
|
490
|
+
let message = 'Object doesn\'t match union (at "' + path_publishScheduleEndDate + '")';
|
|
491
|
+
message += '\n' + obj_publishScheduleEndDate_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
492
|
+
message += '\n' + obj_publishScheduleEndDate_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
493
|
+
return new TypeError(message);
|
|
494
|
+
}
|
|
495
|
+
const obj_publishScheduleInterval = obj.publishScheduleInterval;
|
|
496
|
+
const path_publishScheduleInterval = path + '.publishScheduleInterval';
|
|
497
|
+
if (typeof obj_publishScheduleInterval !== 'string') {
|
|
498
|
+
return new TypeError('Expected "string" but received "' + typeof obj_publishScheduleInterval + '" (at "' + path_publishScheduleInterval + '")');
|
|
499
|
+
}
|
|
500
|
+
const obj_publishScheduleStartDateTime = obj.publishScheduleStartDateTime;
|
|
501
|
+
const path_publishScheduleStartDateTime = path + '.publishScheduleStartDateTime';
|
|
502
|
+
let obj_publishScheduleStartDateTime_union0 = null;
|
|
503
|
+
const obj_publishScheduleStartDateTime_union0_error = (() => {
|
|
504
|
+
if (typeof obj_publishScheduleStartDateTime !== 'string') {
|
|
505
|
+
return new TypeError('Expected "string" but received "' + typeof obj_publishScheduleStartDateTime + '" (at "' + path_publishScheduleStartDateTime + '")');
|
|
506
|
+
}
|
|
507
|
+
})();
|
|
508
|
+
if (obj_publishScheduleStartDateTime_union0_error != null) {
|
|
509
|
+
obj_publishScheduleStartDateTime_union0 = obj_publishScheduleStartDateTime_union0_error.message;
|
|
510
|
+
}
|
|
511
|
+
let obj_publishScheduleStartDateTime_union1 = null;
|
|
512
|
+
const obj_publishScheduleStartDateTime_union1_error = (() => {
|
|
513
|
+
if (obj_publishScheduleStartDateTime !== null) {
|
|
514
|
+
return new TypeError('Expected "null" but received "' + typeof obj_publishScheduleStartDateTime + '" (at "' + path_publishScheduleStartDateTime + '")');
|
|
515
|
+
}
|
|
516
|
+
})();
|
|
517
|
+
if (obj_publishScheduleStartDateTime_union1_error != null) {
|
|
518
|
+
obj_publishScheduleStartDateTime_union1 = obj_publishScheduleStartDateTime_union1_error.message;
|
|
519
|
+
}
|
|
520
|
+
if (obj_publishScheduleStartDateTime_union0 && obj_publishScheduleStartDateTime_union1) {
|
|
521
|
+
let message = 'Object doesn\'t match union (at "' + path_publishScheduleStartDateTime + '")';
|
|
522
|
+
message += '\n' + obj_publishScheduleStartDateTime_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
523
|
+
message += '\n' + obj_publishScheduleStartDateTime_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
524
|
+
return new TypeError(message);
|
|
525
|
+
}
|
|
526
|
+
})();
|
|
527
|
+
return v_error === undefined ? null : v_error;
|
|
528
|
+
}
|
|
529
|
+
const RepresentationType$2 = 'CdpCalculatedInsightRepresentation';
|
|
530
|
+
function keyBuilder$8(luvio, config) {
|
|
531
|
+
return keyPrefix + '::' + RepresentationType$2 + ':' + config.apiName;
|
|
532
|
+
}
|
|
533
|
+
function keyBuilderFromType(luvio, object) {
|
|
534
|
+
const keyParams = {
|
|
535
|
+
apiName: object.apiName
|
|
536
|
+
};
|
|
537
|
+
return keyBuilder$8(luvio, keyParams);
|
|
538
|
+
}
|
|
539
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
540
|
+
return input;
|
|
541
|
+
}
|
|
542
|
+
const select$6 = function CdpCalculatedInsightRepresentationSelect() {
|
|
543
|
+
return {
|
|
544
|
+
kind: 'Fragment',
|
|
545
|
+
version: VERSION$2,
|
|
546
|
+
private: [],
|
|
547
|
+
opaque: true
|
|
548
|
+
};
|
|
549
|
+
};
|
|
550
|
+
function equals$2(existing, incoming) {
|
|
551
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
552
|
+
return false;
|
|
553
|
+
}
|
|
554
|
+
return true;
|
|
555
|
+
}
|
|
556
|
+
const ingest$2 = function CdpCalculatedInsightRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
557
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
558
|
+
const validateError = validate$3(input);
|
|
559
|
+
if (validateError !== null) {
|
|
560
|
+
throw validateError;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
const key = keyBuilderFromType(luvio, input);
|
|
564
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 3000000;
|
|
565
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "calculated-insights", VERSION$2, RepresentationType$2, equals$2);
|
|
566
|
+
return createLink(key);
|
|
567
|
+
};
|
|
568
|
+
function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
|
|
569
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
570
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
571
|
+
rootKeySet.set(rootKey, {
|
|
572
|
+
namespace: keyPrefix,
|
|
573
|
+
representationName: RepresentationType$2,
|
|
574
|
+
mergeable: false
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
function validate$2(obj, path = 'CdpCalculatedInsightCollectionDataRepresentation') {
|
|
579
|
+
const v_error = (() => {
|
|
580
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
581
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
582
|
+
}
|
|
583
|
+
const obj_count = obj.count;
|
|
584
|
+
const path_count = path + '.count';
|
|
585
|
+
if (typeof obj_count !== 'number' || (typeof obj_count === 'number' && Math.floor(obj_count) !== obj_count)) {
|
|
586
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_count + '" (at "' + path_count + '")');
|
|
587
|
+
}
|
|
588
|
+
const obj_currentPageToken = obj.currentPageToken;
|
|
589
|
+
const path_currentPageToken = path + '.currentPageToken';
|
|
590
|
+
if (typeof obj_currentPageToken !== 'string') {
|
|
591
|
+
return new TypeError('Expected "string" but received "' + typeof obj_currentPageToken + '" (at "' + path_currentPageToken + '")');
|
|
592
|
+
}
|
|
593
|
+
const obj_currentPageUrl = obj.currentPageUrl;
|
|
594
|
+
const path_currentPageUrl = path + '.currentPageUrl';
|
|
595
|
+
if (typeof obj_currentPageUrl !== 'string') {
|
|
596
|
+
return new TypeError('Expected "string" but received "' + typeof obj_currentPageUrl + '" (at "' + path_currentPageUrl + '")');
|
|
597
|
+
}
|
|
598
|
+
const obj_items = obj.items;
|
|
599
|
+
const path_items = path + '.items';
|
|
600
|
+
if (!ArrayIsArray(obj_items)) {
|
|
601
|
+
return new TypeError('Expected "array" but received "' + typeof obj_items + '" (at "' + path_items + '")');
|
|
602
|
+
}
|
|
603
|
+
for (let i = 0; i < obj_items.length; i++) {
|
|
604
|
+
const obj_items_item = obj_items[i];
|
|
605
|
+
const path_items_item = path_items + '[' + i + ']';
|
|
606
|
+
const referencepath_items_itemValidationError = validate$3(obj_items_item, path_items_item);
|
|
607
|
+
if (referencepath_items_itemValidationError !== null) {
|
|
608
|
+
let message = 'Object doesn\'t match CdpCalculatedInsightRepresentation (at "' + path_items_item + '")\n';
|
|
609
|
+
message += referencepath_items_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
610
|
+
return new TypeError(message);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
const obj_nextPageToken = obj.nextPageToken;
|
|
614
|
+
const path_nextPageToken = path + '.nextPageToken';
|
|
615
|
+
let obj_nextPageToken_union0 = null;
|
|
616
|
+
const obj_nextPageToken_union0_error = (() => {
|
|
617
|
+
if (typeof obj_nextPageToken !== 'string') {
|
|
618
|
+
return new TypeError('Expected "string" but received "' + typeof obj_nextPageToken + '" (at "' + path_nextPageToken + '")');
|
|
619
|
+
}
|
|
620
|
+
})();
|
|
621
|
+
if (obj_nextPageToken_union0_error != null) {
|
|
622
|
+
obj_nextPageToken_union0 = obj_nextPageToken_union0_error.message;
|
|
623
|
+
}
|
|
624
|
+
let obj_nextPageToken_union1 = null;
|
|
625
|
+
const obj_nextPageToken_union1_error = (() => {
|
|
626
|
+
if (obj_nextPageToken !== null) {
|
|
627
|
+
return new TypeError('Expected "null" but received "' + typeof obj_nextPageToken + '" (at "' + path_nextPageToken + '")');
|
|
628
|
+
}
|
|
629
|
+
})();
|
|
630
|
+
if (obj_nextPageToken_union1_error != null) {
|
|
631
|
+
obj_nextPageToken_union1 = obj_nextPageToken_union1_error.message;
|
|
632
|
+
}
|
|
633
|
+
if (obj_nextPageToken_union0 && obj_nextPageToken_union1) {
|
|
634
|
+
let message = 'Object doesn\'t match union (at "' + path_nextPageToken + '")';
|
|
635
|
+
message += '\n' + obj_nextPageToken_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
636
|
+
message += '\n' + obj_nextPageToken_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
637
|
+
return new TypeError(message);
|
|
638
|
+
}
|
|
639
|
+
const obj_nextPageUrl = obj.nextPageUrl;
|
|
640
|
+
const path_nextPageUrl = path + '.nextPageUrl';
|
|
641
|
+
let obj_nextPageUrl_union0 = null;
|
|
642
|
+
const obj_nextPageUrl_union0_error = (() => {
|
|
643
|
+
if (typeof obj_nextPageUrl !== 'string') {
|
|
644
|
+
return new TypeError('Expected "string" but received "' + typeof obj_nextPageUrl + '" (at "' + path_nextPageUrl + '")');
|
|
645
|
+
}
|
|
646
|
+
})();
|
|
647
|
+
if (obj_nextPageUrl_union0_error != null) {
|
|
648
|
+
obj_nextPageUrl_union0 = obj_nextPageUrl_union0_error.message;
|
|
649
|
+
}
|
|
650
|
+
let obj_nextPageUrl_union1 = null;
|
|
651
|
+
const obj_nextPageUrl_union1_error = (() => {
|
|
652
|
+
if (obj_nextPageUrl !== null) {
|
|
653
|
+
return new TypeError('Expected "null" but received "' + typeof obj_nextPageUrl + '" (at "' + path_nextPageUrl + '")');
|
|
654
|
+
}
|
|
655
|
+
})();
|
|
656
|
+
if (obj_nextPageUrl_union1_error != null) {
|
|
657
|
+
obj_nextPageUrl_union1 = obj_nextPageUrl_union1_error.message;
|
|
658
|
+
}
|
|
659
|
+
if (obj_nextPageUrl_union0 && obj_nextPageUrl_union1) {
|
|
660
|
+
let message = 'Object doesn\'t match union (at "' + path_nextPageUrl + '")';
|
|
661
|
+
message += '\n' + obj_nextPageUrl_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
662
|
+
message += '\n' + obj_nextPageUrl_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
663
|
+
return new TypeError(message);
|
|
664
|
+
}
|
|
665
|
+
const obj_previousPageToken = obj.previousPageToken;
|
|
666
|
+
const path_previousPageToken = path + '.previousPageToken';
|
|
667
|
+
let obj_previousPageToken_union0 = null;
|
|
668
|
+
const obj_previousPageToken_union0_error = (() => {
|
|
669
|
+
if (typeof obj_previousPageToken !== 'string') {
|
|
670
|
+
return new TypeError('Expected "string" but received "' + typeof obj_previousPageToken + '" (at "' + path_previousPageToken + '")');
|
|
671
|
+
}
|
|
672
|
+
})();
|
|
673
|
+
if (obj_previousPageToken_union0_error != null) {
|
|
674
|
+
obj_previousPageToken_union0 = obj_previousPageToken_union0_error.message;
|
|
675
|
+
}
|
|
676
|
+
let obj_previousPageToken_union1 = null;
|
|
677
|
+
const obj_previousPageToken_union1_error = (() => {
|
|
678
|
+
if (obj_previousPageToken !== null) {
|
|
679
|
+
return new TypeError('Expected "null" but received "' + typeof obj_previousPageToken + '" (at "' + path_previousPageToken + '")');
|
|
680
|
+
}
|
|
681
|
+
})();
|
|
682
|
+
if (obj_previousPageToken_union1_error != null) {
|
|
683
|
+
obj_previousPageToken_union1 = obj_previousPageToken_union1_error.message;
|
|
684
|
+
}
|
|
685
|
+
if (obj_previousPageToken_union0 && obj_previousPageToken_union1) {
|
|
686
|
+
let message = 'Object doesn\'t match union (at "' + path_previousPageToken + '")';
|
|
687
|
+
message += '\n' + obj_previousPageToken_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
688
|
+
message += '\n' + obj_previousPageToken_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
689
|
+
return new TypeError(message);
|
|
690
|
+
}
|
|
691
|
+
const obj_previousPageUrl = obj.previousPageUrl;
|
|
692
|
+
const path_previousPageUrl = path + '.previousPageUrl';
|
|
693
|
+
let obj_previousPageUrl_union0 = null;
|
|
694
|
+
const obj_previousPageUrl_union0_error = (() => {
|
|
695
|
+
if (typeof obj_previousPageUrl !== 'string') {
|
|
696
|
+
return new TypeError('Expected "string" but received "' + typeof obj_previousPageUrl + '" (at "' + path_previousPageUrl + '")');
|
|
697
|
+
}
|
|
698
|
+
})();
|
|
699
|
+
if (obj_previousPageUrl_union0_error != null) {
|
|
700
|
+
obj_previousPageUrl_union0 = obj_previousPageUrl_union0_error.message;
|
|
701
|
+
}
|
|
702
|
+
let obj_previousPageUrl_union1 = null;
|
|
703
|
+
const obj_previousPageUrl_union1_error = (() => {
|
|
704
|
+
if (obj_previousPageUrl !== null) {
|
|
705
|
+
return new TypeError('Expected "null" but received "' + typeof obj_previousPageUrl + '" (at "' + path_previousPageUrl + '")');
|
|
706
|
+
}
|
|
707
|
+
})();
|
|
708
|
+
if (obj_previousPageUrl_union1_error != null) {
|
|
709
|
+
obj_previousPageUrl_union1 = obj_previousPageUrl_union1_error.message;
|
|
710
|
+
}
|
|
711
|
+
if (obj_previousPageUrl_union0 && obj_previousPageUrl_union1) {
|
|
712
|
+
let message = 'Object doesn\'t match union (at "' + path_previousPageUrl + '")';
|
|
713
|
+
message += '\n' + obj_previousPageUrl_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
714
|
+
message += '\n' + obj_previousPageUrl_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
715
|
+
return new TypeError(message);
|
|
716
|
+
}
|
|
717
|
+
const obj_total = obj.total;
|
|
718
|
+
const path_total = path + '.total';
|
|
719
|
+
if (typeof obj_total !== 'number' || (typeof obj_total === 'number' && Math.floor(obj_total) !== obj_total)) {
|
|
720
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_total + '" (at "' + path_total + '")');
|
|
721
|
+
}
|
|
722
|
+
})();
|
|
723
|
+
return v_error === undefined ? null : v_error;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
const VERSION$1 = "7df690c1f12184b48859d00c5e68f477";
|
|
727
|
+
function validate$1(obj, path = 'CdpCalculatedInsightCollectionRepresentation') {
|
|
728
|
+
const v_error = (() => {
|
|
729
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
730
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
731
|
+
}
|
|
732
|
+
const obj_collection = obj.collection;
|
|
733
|
+
const path_collection = path + '.collection';
|
|
734
|
+
const referencepath_collectionValidationError = validate$2(obj_collection, path_collection);
|
|
735
|
+
if (referencepath_collectionValidationError !== null) {
|
|
736
|
+
let message = 'Object doesn\'t match CdpCalculatedInsightCollectionDataRepresentation (at "' + path_collection + '")\n';
|
|
737
|
+
message += referencepath_collectionValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
738
|
+
return new TypeError(message);
|
|
739
|
+
}
|
|
740
|
+
})();
|
|
741
|
+
return v_error === undefined ? null : v_error;
|
|
742
|
+
}
|
|
743
|
+
const RepresentationType$1 = 'CdpCalculatedInsightCollectionRepresentation';
|
|
744
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
745
|
+
return input;
|
|
746
|
+
}
|
|
747
|
+
const select$5 = function CdpCalculatedInsightCollectionRepresentationSelect() {
|
|
748
|
+
return {
|
|
749
|
+
kind: 'Fragment',
|
|
750
|
+
version: VERSION$1,
|
|
751
|
+
private: [],
|
|
752
|
+
opaque: true
|
|
753
|
+
};
|
|
754
|
+
};
|
|
755
|
+
function equals$1(existing, incoming) {
|
|
756
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
757
|
+
return false;
|
|
758
|
+
}
|
|
759
|
+
return true;
|
|
760
|
+
}
|
|
761
|
+
const ingest$1 = function CdpCalculatedInsightCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
762
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
763
|
+
const validateError = validate$1(input);
|
|
764
|
+
if (validateError !== null) {
|
|
765
|
+
throw validateError;
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
const key = path.fullPath;
|
|
769
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 3000000;
|
|
770
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "calculated-insights", VERSION$1, RepresentationType$1, equals$1);
|
|
771
|
+
return createLink(key);
|
|
772
|
+
};
|
|
773
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
774
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
775
|
+
const rootKey = fullPathFactory();
|
|
776
|
+
rootKeySet.set(rootKey, {
|
|
777
|
+
namespace: keyPrefix,
|
|
778
|
+
representationName: RepresentationType$1,
|
|
779
|
+
mergeable: false
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
function select$4(luvio, params) {
|
|
784
|
+
return select$5();
|
|
785
|
+
}
|
|
786
|
+
function keyBuilder$7(luvio, params) {
|
|
787
|
+
return keyPrefix + '::CdpCalculatedInsightCollectionRepresentation:(' + 'batchSize:' + params.queryParams.batchSize + ',' + 'dataspace:' + params.queryParams.dataspace + ',' + 'definitionType:' + params.queryParams.definitionType + ',' + 'offset:' + params.queryParams.offset + ',' + 'orderby:' + params.queryParams.orderby + ',' + 'pageToken:' + params.queryParams.pageToken + ')';
|
|
788
|
+
}
|
|
789
|
+
function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
|
|
790
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$7(luvio, resourceParams));
|
|
791
|
+
}
|
|
792
|
+
function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
|
|
793
|
+
const { body } = response;
|
|
794
|
+
const key = keyBuilder$7(luvio, resourceParams);
|
|
795
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
796
|
+
const snapshot = luvio.storeLookup({
|
|
797
|
+
recordId: key,
|
|
798
|
+
node: select$4(),
|
|
799
|
+
variables: {},
|
|
800
|
+
}, snapshotRefresh);
|
|
801
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
802
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
803
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
deepFreeze(snapshot.data);
|
|
807
|
+
return snapshot;
|
|
808
|
+
}
|
|
809
|
+
function ingestError$3(luvio, params, error, snapshotRefresh) {
|
|
810
|
+
const key = keyBuilder$7(luvio, params);
|
|
811
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
812
|
+
luvio.storeIngestError(key, errorSnapshot);
|
|
813
|
+
return errorSnapshot;
|
|
814
|
+
}
|
|
815
|
+
function createResourceRequest$3(config) {
|
|
816
|
+
const headers = {};
|
|
817
|
+
return {
|
|
818
|
+
baseUri: '/services/data/v66.0',
|
|
819
|
+
basePath: '/ssot/calculated-insights',
|
|
820
|
+
method: 'get',
|
|
821
|
+
body: null,
|
|
822
|
+
urlParams: {},
|
|
823
|
+
queryParams: config.queryParams,
|
|
824
|
+
headers,
|
|
825
|
+
priority: 'normal',
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
const adapterName$3 = 'getCalculatedInsightsMetadata';
|
|
830
|
+
const getCalculatedInsightsMetadata_ConfigPropertyMetadata = [
|
|
831
|
+
generateParamConfigMetadata('batchSize', false, 1 /* QueryParameter */, 3 /* Integer */),
|
|
832
|
+
generateParamConfigMetadata('dataspace', false, 1 /* QueryParameter */, 0 /* String */),
|
|
833
|
+
generateParamConfigMetadata('definitionType', false, 1 /* QueryParameter */, 0 /* String */),
|
|
834
|
+
generateParamConfigMetadata('offset', false, 1 /* QueryParameter */, 3 /* Integer */),
|
|
835
|
+
generateParamConfigMetadata('orderby', false, 1 /* QueryParameter */, 0 /* String */),
|
|
836
|
+
generateParamConfigMetadata('pageToken', false, 1 /* QueryParameter */, 0 /* String */),
|
|
837
|
+
];
|
|
838
|
+
const getCalculatedInsightsMetadata_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, getCalculatedInsightsMetadata_ConfigPropertyMetadata);
|
|
839
|
+
const createResourceParams$3 = /*#__PURE__*/ createResourceParams$4(getCalculatedInsightsMetadata_ConfigPropertyMetadata);
|
|
840
|
+
function keyBuilder$6(luvio, config) {
|
|
841
|
+
const resourceParams = createResourceParams$3(config);
|
|
842
|
+
return keyBuilder$7(luvio, resourceParams);
|
|
843
|
+
}
|
|
844
|
+
function typeCheckConfig$3(untrustedConfig) {
|
|
845
|
+
const config = {};
|
|
846
|
+
typeCheckConfig$4(untrustedConfig, config, getCalculatedInsightsMetadata_ConfigPropertyMetadata);
|
|
847
|
+
return config;
|
|
848
|
+
}
|
|
849
|
+
function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
|
|
850
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
851
|
+
return null;
|
|
852
|
+
}
|
|
853
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
854
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
855
|
+
}
|
|
856
|
+
const config = typeCheckConfig$3(untrustedConfig);
|
|
857
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
858
|
+
return null;
|
|
859
|
+
}
|
|
860
|
+
return config;
|
|
861
|
+
}
|
|
862
|
+
function adapterFragment$3(luvio, config) {
|
|
863
|
+
createResourceParams$3(config);
|
|
864
|
+
return select$4();
|
|
865
|
+
}
|
|
866
|
+
function onFetchResponseSuccess$3(luvio, config, resourceParams, response) {
|
|
867
|
+
const snapshot = ingestSuccess$3(luvio, resourceParams, response, {
|
|
868
|
+
config,
|
|
869
|
+
resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
|
|
870
|
+
});
|
|
871
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
872
|
+
}
|
|
873
|
+
function onFetchResponseError$3(luvio, config, resourceParams, response) {
|
|
874
|
+
const snapshot = ingestError$3(luvio, resourceParams, response, {
|
|
875
|
+
config,
|
|
876
|
+
resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
|
|
877
|
+
});
|
|
878
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
879
|
+
}
|
|
880
|
+
function buildNetworkSnapshot$3(luvio, config, options) {
|
|
881
|
+
const resourceParams = createResourceParams$3(config);
|
|
882
|
+
const request = createResourceRequest$3(resourceParams);
|
|
883
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
884
|
+
.then((response) => {
|
|
885
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$3(luvio, config, resourceParams, response), () => {
|
|
886
|
+
const cache = new StoreKeyMap();
|
|
887
|
+
getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
|
|
888
|
+
return cache;
|
|
889
|
+
});
|
|
890
|
+
}, (response) => {
|
|
891
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$3(luvio, config, resourceParams, response));
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
function buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext) {
|
|
895
|
+
return buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext, buildNetworkSnapshot$3, undefined, false);
|
|
896
|
+
}
|
|
897
|
+
function buildCachedSnapshotCachePolicy$3(context, storeLookup) {
|
|
898
|
+
const { luvio, config } = context;
|
|
899
|
+
const selector = {
|
|
900
|
+
recordId: keyBuilder$6(luvio, config),
|
|
901
|
+
node: adapterFragment$3(luvio, config),
|
|
902
|
+
variables: {},
|
|
903
|
+
};
|
|
904
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
905
|
+
config,
|
|
906
|
+
resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
|
|
907
|
+
});
|
|
908
|
+
return cacheSnapshot;
|
|
909
|
+
}
|
|
910
|
+
const getCalculatedInsightsMetadataAdapterFactory = (luvio) => function calculatedInsights__getCalculatedInsightsMetadata(untrustedConfig, requestContext) {
|
|
911
|
+
const config = validateAdapterConfig$3(untrustedConfig, getCalculatedInsightsMetadata_ConfigPropertyNames);
|
|
912
|
+
// Invalid or incomplete config
|
|
913
|
+
if (config === null) {
|
|
914
|
+
return null;
|
|
915
|
+
}
|
|
916
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
917
|
+
buildCachedSnapshotCachePolicy$3, buildNetworkSnapshotCachePolicy$3);
|
|
918
|
+
};
|
|
919
|
+
|
|
920
|
+
function select$3(luvio, params) {
|
|
921
|
+
return select$6();
|
|
922
|
+
}
|
|
923
|
+
function keyBuilder$5(luvio, params) {
|
|
924
|
+
return keyBuilder$8(luvio, {
|
|
925
|
+
apiName: params.urlParams.apiName
|
|
926
|
+
});
|
|
927
|
+
}
|
|
928
|
+
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
929
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response);
|
|
930
|
+
}
|
|
931
|
+
function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
|
|
932
|
+
const { body } = response;
|
|
933
|
+
const key = keyBuilder$5(luvio, resourceParams);
|
|
934
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
935
|
+
const snapshot = luvio.storeLookup({
|
|
936
|
+
recordId: key,
|
|
937
|
+
node: select$3(),
|
|
938
|
+
variables: {},
|
|
939
|
+
}, snapshotRefresh);
|
|
940
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
941
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
942
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
deepFreeze(snapshot.data);
|
|
946
|
+
return snapshot;
|
|
947
|
+
}
|
|
948
|
+
function ingestError$2(luvio, params, error, snapshotRefresh) {
|
|
949
|
+
const key = keyBuilder$5(luvio, params);
|
|
950
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
951
|
+
luvio.storeIngestError(key, errorSnapshot);
|
|
952
|
+
return errorSnapshot;
|
|
953
|
+
}
|
|
954
|
+
function createResourceRequest$2(config) {
|
|
955
|
+
const headers = {};
|
|
956
|
+
return {
|
|
957
|
+
baseUri: '/services/data/v66.0',
|
|
958
|
+
basePath: '/ssot/calculated-insights/' + config.urlParams.apiName + '',
|
|
959
|
+
method: 'get',
|
|
960
|
+
body: null,
|
|
961
|
+
urlParams: config.urlParams,
|
|
962
|
+
queryParams: {},
|
|
963
|
+
headers,
|
|
964
|
+
priority: 'normal',
|
|
965
|
+
};
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
const adapterName$2 = 'getCalculatedInsightMetadata';
|
|
969
|
+
const getCalculatedInsightMetadata_ConfigPropertyMetadata = [
|
|
970
|
+
generateParamConfigMetadata('apiName', true, 0 /* UrlParameter */, 0 /* String */),
|
|
971
|
+
];
|
|
972
|
+
const getCalculatedInsightMetadata_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getCalculatedInsightMetadata_ConfigPropertyMetadata);
|
|
973
|
+
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$4(getCalculatedInsightMetadata_ConfigPropertyMetadata);
|
|
974
|
+
function keyBuilder$4(luvio, config) {
|
|
975
|
+
const resourceParams = createResourceParams$2(config);
|
|
976
|
+
return keyBuilder$5(luvio, resourceParams);
|
|
977
|
+
}
|
|
978
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
979
|
+
const config = {};
|
|
980
|
+
typeCheckConfig$4(untrustedConfig, config, getCalculatedInsightMetadata_ConfigPropertyMetadata);
|
|
981
|
+
return config;
|
|
982
|
+
}
|
|
983
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
984
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
985
|
+
return null;
|
|
986
|
+
}
|
|
987
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
988
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
989
|
+
}
|
|
990
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
991
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
992
|
+
return null;
|
|
993
|
+
}
|
|
994
|
+
return config;
|
|
995
|
+
}
|
|
996
|
+
function adapterFragment$2(luvio, config) {
|
|
997
|
+
createResourceParams$2(config);
|
|
998
|
+
return select$3();
|
|
999
|
+
}
|
|
1000
|
+
function onFetchResponseSuccess$2(luvio, config, resourceParams, response) {
|
|
1001
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
|
|
1002
|
+
config,
|
|
1003
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1004
|
+
});
|
|
1005
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1006
|
+
}
|
|
1007
|
+
function onFetchResponseError$2(luvio, config, resourceParams, response) {
|
|
1008
|
+
const snapshot = ingestError$2(luvio, resourceParams, response, {
|
|
1009
|
+
config,
|
|
1010
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1011
|
+
});
|
|
1012
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1013
|
+
}
|
|
1014
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
1015
|
+
const resourceParams = createResourceParams$2(config);
|
|
1016
|
+
const request = createResourceRequest$2(resourceParams);
|
|
1017
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1018
|
+
.then((response) => {
|
|
1019
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$2(luvio, config, resourceParams, response), () => {
|
|
1020
|
+
const cache = new StoreKeyMap();
|
|
1021
|
+
getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
|
|
1022
|
+
return cache;
|
|
1023
|
+
});
|
|
1024
|
+
}, (response) => {
|
|
1025
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$2(luvio, config, resourceParams, response));
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
|
|
1029
|
+
return buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
|
|
1030
|
+
}
|
|
1031
|
+
function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
|
|
1032
|
+
const { luvio, config } = context;
|
|
1033
|
+
const selector = {
|
|
1034
|
+
recordId: keyBuilder$4(luvio, config),
|
|
1035
|
+
node: adapterFragment$2(luvio, config),
|
|
1036
|
+
variables: {},
|
|
1037
|
+
};
|
|
1038
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1039
|
+
config,
|
|
1040
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1041
|
+
});
|
|
1042
|
+
return cacheSnapshot;
|
|
1043
|
+
}
|
|
1044
|
+
const getCalculatedInsightMetadataAdapterFactory = (luvio) => function calculatedInsights__getCalculatedInsightMetadata(untrustedConfig, requestContext) {
|
|
1045
|
+
const config = validateAdapterConfig$2(untrustedConfig, getCalculatedInsightMetadata_ConfigPropertyNames);
|
|
1046
|
+
// Invalid or incomplete config
|
|
1047
|
+
if (config === null) {
|
|
1048
|
+
return null;
|
|
1049
|
+
}
|
|
1050
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1051
|
+
buildCachedSnapshotCachePolicy$2, buildNetworkSnapshotCachePolicy$2);
|
|
1052
|
+
};
|
|
1053
|
+
|
|
1054
|
+
const VERSION = "f7dafa2848516fc627f377709ba0b375";
|
|
1055
|
+
function validate(obj, path = 'CdpQueryOutputRepresentation') {
|
|
1056
|
+
const v_error = (() => {
|
|
1057
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1058
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1059
|
+
}
|
|
1060
|
+
const obj_data = obj.data;
|
|
1061
|
+
const path_data = path + '.data';
|
|
1062
|
+
if (!ArrayIsArray(obj_data)) {
|
|
1063
|
+
return new TypeError('Expected "array" but received "' + typeof obj_data + '" (at "' + path_data + '")');
|
|
1064
|
+
}
|
|
1065
|
+
for (let i = 0; i < obj_data.length; i++) {
|
|
1066
|
+
const obj_data_item = obj_data[i];
|
|
1067
|
+
const path_data_item = path_data + '[' + i + ']';
|
|
1068
|
+
if (typeof obj_data_item !== 'object' || ArrayIsArray(obj_data_item) || obj_data_item === null) {
|
|
1069
|
+
return new TypeError('Expected "object" but received "' + typeof obj_data_item + '" (at "' + path_data_item + '")');
|
|
1070
|
+
}
|
|
1071
|
+
const obj_data_item_keys = ObjectKeys(obj_data_item);
|
|
1072
|
+
for (let i = 0; i < obj_data_item_keys.length; i++) {
|
|
1073
|
+
const key = obj_data_item_keys[i];
|
|
1074
|
+
const obj_data_item_prop = obj_data_item[key];
|
|
1075
|
+
const path_data_item_prop = path_data_item + '["' + key + '"]';
|
|
1076
|
+
if (obj_data_item_prop === undefined) {
|
|
1077
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_data_item_prop + '" (at "' + path_data_item_prop + '")');
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
const obj_done = obj.done;
|
|
1082
|
+
const path_done = path + '.done';
|
|
1083
|
+
if (typeof obj_done !== 'boolean') {
|
|
1084
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_done + '" (at "' + path_done + '")');
|
|
1085
|
+
}
|
|
1086
|
+
if (obj.endTime !== undefined) {
|
|
1087
|
+
const obj_endTime = obj.endTime;
|
|
1088
|
+
const path_endTime = path + '.endTime';
|
|
1089
|
+
if (typeof obj_endTime !== 'string') {
|
|
1090
|
+
return new TypeError('Expected "string" but received "' + typeof obj_endTime + '" (at "' + path_endTime + '")');
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
const obj_metadata = obj.metadata;
|
|
1094
|
+
const path_metadata = path + '.metadata';
|
|
1095
|
+
if (typeof obj_metadata !== 'object' || ArrayIsArray(obj_metadata) || obj_metadata === null) {
|
|
1096
|
+
return new TypeError('Expected "object" but received "' + typeof obj_metadata + '" (at "' + path_metadata + '")');
|
|
1097
|
+
}
|
|
1098
|
+
const obj_metadata_keys = ObjectKeys(obj_metadata);
|
|
1099
|
+
for (let i = 0; i < obj_metadata_keys.length; i++) {
|
|
1100
|
+
const key = obj_metadata_keys[i];
|
|
1101
|
+
const obj_metadata_prop = obj_metadata[key];
|
|
1102
|
+
const path_metadata_prop = path_metadata + '["' + key + '"]';
|
|
1103
|
+
if (obj_metadata_prop === undefined) {
|
|
1104
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_metadata_prop + '" (at "' + path_metadata_prop + '")');
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
if (obj.queryId !== undefined) {
|
|
1108
|
+
const obj_queryId = obj.queryId;
|
|
1109
|
+
const path_queryId = path + '.queryId';
|
|
1110
|
+
if (typeof obj_queryId !== 'string') {
|
|
1111
|
+
return new TypeError('Expected "string" but received "' + typeof obj_queryId + '" (at "' + path_queryId + '")');
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
if (obj.rowCount !== undefined) {
|
|
1115
|
+
const obj_rowCount = obj.rowCount;
|
|
1116
|
+
const path_rowCount = path + '.rowCount';
|
|
1117
|
+
if (typeof obj_rowCount !== 'number' || (typeof obj_rowCount === 'number' && Math.floor(obj_rowCount) !== obj_rowCount)) {
|
|
1118
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_rowCount + '" (at "' + path_rowCount + '")');
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
if (obj.startTime !== undefined) {
|
|
1122
|
+
const obj_startTime = obj.startTime;
|
|
1123
|
+
const path_startTime = path + '.startTime';
|
|
1124
|
+
if (typeof obj_startTime !== 'string') {
|
|
1125
|
+
return new TypeError('Expected "string" but received "' + typeof obj_startTime + '" (at "' + path_startTime + '")');
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
})();
|
|
1129
|
+
return v_error === undefined ? null : v_error;
|
|
1130
|
+
}
|
|
1131
|
+
const RepresentationType = 'CdpQueryOutputRepresentation';
|
|
1132
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
1133
|
+
return input;
|
|
1134
|
+
}
|
|
1135
|
+
const select$2 = function CdpQueryOutputRepresentationSelect() {
|
|
1136
|
+
return {
|
|
1137
|
+
kind: 'Fragment',
|
|
1138
|
+
version: VERSION,
|
|
1139
|
+
private: [],
|
|
1140
|
+
opaque: true
|
|
1141
|
+
};
|
|
1142
|
+
};
|
|
1143
|
+
function equals(existing, incoming) {
|
|
1144
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
1145
|
+
return false;
|
|
1146
|
+
}
|
|
1147
|
+
return true;
|
|
1148
|
+
}
|
|
1149
|
+
const ingest = function CdpQueryOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1150
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1151
|
+
const validateError = validate(input);
|
|
1152
|
+
if (validateError !== null) {
|
|
1153
|
+
throw validateError;
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
const key = path.fullPath;
|
|
1157
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 3000000;
|
|
1158
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "calculated-insights", VERSION, RepresentationType, equals);
|
|
1159
|
+
return createLink(key);
|
|
1160
|
+
};
|
|
1161
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
1162
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1163
|
+
const rootKey = fullPathFactory();
|
|
1164
|
+
rootKeySet.set(rootKey, {
|
|
1165
|
+
namespace: keyPrefix,
|
|
1166
|
+
representationName: RepresentationType,
|
|
1167
|
+
mergeable: false
|
|
1168
|
+
});
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
function select$1(luvio, params) {
|
|
1172
|
+
return select$2();
|
|
1173
|
+
}
|
|
1174
|
+
function keyBuilder$3(luvio, params) {
|
|
1175
|
+
return keyPrefix + '::CdpQueryOutputRepresentation:(' + 'batchSize:' + params.queryParams.batchSize + ',' + 'dataspace:' + params.queryParams.dataspace + ',' + 'dimensions:' + params.queryParams.dimensions + ',' + 'filters:' + params.queryParams.filters + ',' + 'measures:' + params.queryParams.measures + ',' + 'offset:' + params.queryParams.offset + ',' + 'orderby:' + params.queryParams.orderby + ',' + 'timeGranularity:' + params.queryParams.timeGranularity + ',' + 'ciName:' + params.urlParams.ciName + ')';
|
|
1176
|
+
}
|
|
1177
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
1178
|
+
getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$3(luvio, resourceParams));
|
|
1179
|
+
}
|
|
1180
|
+
function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
1181
|
+
const { body } = response;
|
|
1182
|
+
const key = keyBuilder$3(luvio, resourceParams);
|
|
1183
|
+
luvio.storeIngest(key, ingest, body);
|
|
1184
|
+
const snapshot = luvio.storeLookup({
|
|
1185
|
+
recordId: key,
|
|
1186
|
+
node: select$1(),
|
|
1187
|
+
variables: {},
|
|
1188
|
+
}, snapshotRefresh);
|
|
1189
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1190
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1191
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
deepFreeze(snapshot.data);
|
|
1195
|
+
return snapshot;
|
|
1196
|
+
}
|
|
1197
|
+
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
1198
|
+
const key = keyBuilder$3(luvio, params);
|
|
1199
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1200
|
+
luvio.storeIngestError(key, errorSnapshot);
|
|
1201
|
+
return errorSnapshot;
|
|
1202
|
+
}
|
|
1203
|
+
function createResourceRequest$1(config) {
|
|
1204
|
+
const headers = {};
|
|
1205
|
+
return {
|
|
1206
|
+
baseUri: '/services/data/v66.0',
|
|
1207
|
+
basePath: '/ssot/insight/calculated-insights/' + config.urlParams.ciName + '',
|
|
1208
|
+
method: 'get',
|
|
1209
|
+
body: null,
|
|
1210
|
+
urlParams: config.urlParams,
|
|
1211
|
+
queryParams: config.queryParams,
|
|
1212
|
+
headers,
|
|
1213
|
+
priority: 'normal',
|
|
1214
|
+
};
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
const adapterName$1 = 'queryCalculatedInsight';
|
|
1218
|
+
const queryCalculatedInsight_ConfigPropertyMetadata = [
|
|
1219
|
+
generateParamConfigMetadata('ciName', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1220
|
+
generateParamConfigMetadata('batchSize', false, 1 /* QueryParameter */, 3 /* Integer */),
|
|
1221
|
+
generateParamConfigMetadata('dataspace', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1222
|
+
generateParamConfigMetadata('dimensions', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1223
|
+
generateParamConfigMetadata('filters', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1224
|
+
generateParamConfigMetadata('measures', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1225
|
+
generateParamConfigMetadata('offset', false, 1 /* QueryParameter */, 3 /* Integer */),
|
|
1226
|
+
generateParamConfigMetadata('orderby', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1227
|
+
generateParamConfigMetadata('timeGranularity', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1228
|
+
];
|
|
1229
|
+
const queryCalculatedInsight_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, queryCalculatedInsight_ConfigPropertyMetadata);
|
|
1230
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$4(queryCalculatedInsight_ConfigPropertyMetadata);
|
|
1231
|
+
function keyBuilder$2(luvio, config) {
|
|
1232
|
+
const resourceParams = createResourceParams$1(config);
|
|
1233
|
+
return keyBuilder$3(luvio, resourceParams);
|
|
1234
|
+
}
|
|
1235
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
1236
|
+
const config = {};
|
|
1237
|
+
typeCheckConfig$4(untrustedConfig, config, queryCalculatedInsight_ConfigPropertyMetadata);
|
|
1238
|
+
return config;
|
|
1239
|
+
}
|
|
1240
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
1241
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1242
|
+
return null;
|
|
1243
|
+
}
|
|
1244
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1245
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1246
|
+
}
|
|
1247
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
1248
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1249
|
+
return null;
|
|
1250
|
+
}
|
|
1251
|
+
return config;
|
|
1252
|
+
}
|
|
1253
|
+
function adapterFragment$1(luvio, config) {
|
|
1254
|
+
createResourceParams$1(config);
|
|
1255
|
+
return select$1();
|
|
1256
|
+
}
|
|
1257
|
+
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
1258
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
|
|
1259
|
+
config,
|
|
1260
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
1261
|
+
});
|
|
1262
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1263
|
+
}
|
|
1264
|
+
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
1265
|
+
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
1266
|
+
config,
|
|
1267
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
1268
|
+
});
|
|
1269
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1270
|
+
}
|
|
1271
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
1272
|
+
const resourceParams = createResourceParams$1(config);
|
|
1273
|
+
const request = createResourceRequest$1(resourceParams);
|
|
1274
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1275
|
+
.then((response) => {
|
|
1276
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
|
|
1277
|
+
const cache = new StoreKeyMap();
|
|
1278
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
1279
|
+
return cache;
|
|
1280
|
+
});
|
|
1281
|
+
}, (response) => {
|
|
1282
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1285
|
+
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
1286
|
+
return buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
|
|
1287
|
+
}
|
|
1288
|
+
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
1289
|
+
const { luvio, config } = context;
|
|
1290
|
+
const selector = {
|
|
1291
|
+
recordId: keyBuilder$2(luvio, config),
|
|
1292
|
+
node: adapterFragment$1(luvio, config),
|
|
1293
|
+
variables: {},
|
|
1294
|
+
};
|
|
1295
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1296
|
+
config,
|
|
1297
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
1298
|
+
});
|
|
1299
|
+
return cacheSnapshot;
|
|
1300
|
+
}
|
|
1301
|
+
const queryCalculatedInsightAdapterFactory = (luvio) => function calculatedInsights__queryCalculatedInsight(untrustedConfig, requestContext) {
|
|
1302
|
+
const config = validateAdapterConfig$1(untrustedConfig, queryCalculatedInsight_ConfigPropertyNames);
|
|
1303
|
+
// Invalid or incomplete config
|
|
1304
|
+
if (config === null) {
|
|
1305
|
+
return null;
|
|
1306
|
+
}
|
|
1307
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1308
|
+
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
1309
|
+
};
|
|
1310
|
+
|
|
1311
|
+
function select(luvio, params) {
|
|
1312
|
+
return select$2();
|
|
1313
|
+
}
|
|
1314
|
+
function keyBuilder$1(luvio, params) {
|
|
1315
|
+
return keyPrefix + '::CdpQueryOutputRepresentation:(' + 'batchSize:' + params.queryParams.batchSize + ',' + 'dataspace:' + params.queryParams.dataspace + ',' + 'dimensions:' + params.queryParams.dimensions + ',' + 'fields:' + params.queryParams.fields + ',' + 'filters:' + params.queryParams.filters + ',' + 'measures:' + params.queryParams.measures + ',' + 'offset:' + params.queryParams.offset + ',' + 'orderby:' + params.queryParams.orderby + ',' + 'searchKey:' + params.queryParams.searchKey + ',' + 'timeGranularity:' + params.queryParams.timeGranularity + ',' + 'ciName:' + params.urlParams.ciName + ',' + 'dataModelName:' + params.urlParams.dataModelName + ',' + 'id:' + params.urlParams.id + ')';
|
|
1316
|
+
}
|
|
1317
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
1318
|
+
getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
1319
|
+
}
|
|
1320
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
1321
|
+
const { body } = response;
|
|
1322
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
1323
|
+
luvio.storeIngest(key, ingest, body);
|
|
1324
|
+
const snapshot = luvio.storeLookup({
|
|
1325
|
+
recordId: key,
|
|
1326
|
+
node: select(),
|
|
1327
|
+
variables: {},
|
|
1328
|
+
}, snapshotRefresh);
|
|
1329
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1330
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1331
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
deepFreeze(snapshot.data);
|
|
1335
|
+
return snapshot;
|
|
1336
|
+
}
|
|
1337
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
1338
|
+
const key = keyBuilder$1(luvio, params);
|
|
1339
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1340
|
+
luvio.storeIngestError(key, errorSnapshot);
|
|
1341
|
+
return errorSnapshot;
|
|
1342
|
+
}
|
|
1343
|
+
function createResourceRequest(config) {
|
|
1344
|
+
const headers = {};
|
|
1345
|
+
return {
|
|
1346
|
+
baseUri: '/services/data/v66.0',
|
|
1347
|
+
basePath: '/ssot/profile/' + config.urlParams.dataModelName + '/' + config.urlParams.id + '/calculated-insights/' + config.urlParams.ciName + '',
|
|
1348
|
+
method: 'get',
|
|
1349
|
+
body: null,
|
|
1350
|
+
urlParams: config.urlParams,
|
|
1351
|
+
queryParams: config.queryParams,
|
|
1352
|
+
headers,
|
|
1353
|
+
priority: 'normal',
|
|
1354
|
+
};
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
const adapterName = 'queryProfileCalculatedInsight';
|
|
1358
|
+
const queryProfileCalculatedInsight_ConfigPropertyMetadata = [
|
|
1359
|
+
generateParamConfigMetadata('ciName', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1360
|
+
generateParamConfigMetadata('dataModelName', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1361
|
+
generateParamConfigMetadata('id', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1362
|
+
generateParamConfigMetadata('batchSize', false, 1 /* QueryParameter */, 3 /* Integer */),
|
|
1363
|
+
generateParamConfigMetadata('dataspace', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1364
|
+
generateParamConfigMetadata('dimensions', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1365
|
+
generateParamConfigMetadata('fields', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1366
|
+
generateParamConfigMetadata('filters', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1367
|
+
generateParamConfigMetadata('measures', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1368
|
+
generateParamConfigMetadata('offset', false, 1 /* QueryParameter */, 3 /* Integer */),
|
|
1369
|
+
generateParamConfigMetadata('orderby', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1370
|
+
generateParamConfigMetadata('searchKey', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1371
|
+
generateParamConfigMetadata('timeGranularity', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1372
|
+
];
|
|
1373
|
+
const queryProfileCalculatedInsight_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, queryProfileCalculatedInsight_ConfigPropertyMetadata);
|
|
1374
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$4(queryProfileCalculatedInsight_ConfigPropertyMetadata);
|
|
1375
|
+
function keyBuilder(luvio, config) {
|
|
1376
|
+
const resourceParams = createResourceParams(config);
|
|
1377
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
1378
|
+
}
|
|
1379
|
+
function typeCheckConfig(untrustedConfig) {
|
|
1380
|
+
const config = {};
|
|
1381
|
+
typeCheckConfig$4(untrustedConfig, config, queryProfileCalculatedInsight_ConfigPropertyMetadata);
|
|
1382
|
+
return config;
|
|
1383
|
+
}
|
|
1384
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
1385
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1386
|
+
return null;
|
|
1387
|
+
}
|
|
1388
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1389
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1390
|
+
}
|
|
1391
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
1392
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1393
|
+
return null;
|
|
1394
|
+
}
|
|
1395
|
+
return config;
|
|
1396
|
+
}
|
|
1397
|
+
function adapterFragment(luvio, config) {
|
|
1398
|
+
createResourceParams(config);
|
|
1399
|
+
return select();
|
|
1400
|
+
}
|
|
1401
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
1402
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
1403
|
+
config,
|
|
1404
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1405
|
+
});
|
|
1406
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1407
|
+
}
|
|
1408
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
1409
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
1410
|
+
config,
|
|
1411
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1412
|
+
});
|
|
1413
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1414
|
+
}
|
|
1415
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
1416
|
+
const resourceParams = createResourceParams(config);
|
|
1417
|
+
const request = createResourceRequest(resourceParams);
|
|
1418
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1419
|
+
.then((response) => {
|
|
1420
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
1421
|
+
const cache = new StoreKeyMap();
|
|
1422
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
1423
|
+
return cache;
|
|
1424
|
+
});
|
|
1425
|
+
}, (response) => {
|
|
1426
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
1427
|
+
});
|
|
1428
|
+
}
|
|
1429
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
1430
|
+
return buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
|
|
1431
|
+
}
|
|
1432
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
1433
|
+
const { luvio, config } = context;
|
|
1434
|
+
const selector = {
|
|
1435
|
+
recordId: keyBuilder(luvio, config),
|
|
1436
|
+
node: adapterFragment(luvio, config),
|
|
1437
|
+
variables: {},
|
|
1438
|
+
};
|
|
1439
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1440
|
+
config,
|
|
1441
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1442
|
+
});
|
|
1443
|
+
return cacheSnapshot;
|
|
1444
|
+
}
|
|
1445
|
+
const queryProfileCalculatedInsightAdapterFactory = (luvio) => function calculatedInsights__queryProfileCalculatedInsight(untrustedConfig, requestContext) {
|
|
1446
|
+
const config = validateAdapterConfig(untrustedConfig, queryProfileCalculatedInsight_ConfigPropertyNames);
|
|
1447
|
+
// Invalid or incomplete config
|
|
1448
|
+
if (config === null) {
|
|
1449
|
+
return null;
|
|
1450
|
+
}
|
|
1451
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1452
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
1453
|
+
};
|
|
1454
|
+
|
|
1455
|
+
export { getCalculatedInsightMetadataAdapterFactory, getCalculatedInsightsMetadataAdapterFactory, queryCalculatedInsightAdapterFactory, queryProfileCalculatedInsightAdapterFactory };
|