@salesforce/lds-adapters-analytics-smart-data-discovery 0.131.0
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/analytics-smart-data-discovery.js +1085 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +66 -0
- package/dist/es/es2018/types/src/generated/adapters/getStories.d.ts +33 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +1 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +3 -0
- package/dist/es/es2018/types/src/generated/resources/getSmartdatadiscoveryStories.d.ts +22 -0
- package/dist/es/es2018/types/src/generated/types/AbstractBucketingStrategyRepresentation.d.ts +36 -0
- package/dist/es/es2018/types/src/generated/types/AbstractClassificationThresholdRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/AbstractFieldConfigurationRepresentation.d.ts +51 -0
- package/dist/es/es2018/types/src/generated/types/AbstractStorySourceRepresentation.d.ts +35 -0
- package/dist/es/es2018/types/src/generated/types/AnalyticsDatasetSourceRepresentation.d.ts +33 -0
- package/dist/es/es2018/types/src/generated/types/AssetReferenceRepresentation.d.ts +27 -0
- package/dist/es/es2018/types/src/generated/types/AutopilotRepresentation.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/BaseAssetReferenceRepresentation.d.ts +41 -0
- package/dist/es/es2018/types/src/generated/types/BinaryClassificationThresholdRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/DateFieldConfigurationRepresentation.d.ts +40 -0
- package/dist/es/es2018/types/src/generated/types/EvenWidthBucketingStrategyRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/ManualBucketingStrategyRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/NumericFieldConfigurationRepresentation.d.ts +44 -0
- package/dist/es/es2018/types/src/generated/types/PercentileBucketingStrategyRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/ReportSourceRepresentation.d.ts +35 -0
- package/dist/es/es2018/types/src/generated/types/SmartDataDiscoveryCategoricalOutcomeRepresentation.d.ts +40 -0
- package/dist/es/es2018/types/src/generated/types/SmartDataDiscoveryCountOutcomeRepresentation.d.ts +27 -0
- package/dist/es/es2018/types/src/generated/types/SmartDataDiscoveryImputeStrategyRepresentation.d.ts +32 -0
- package/dist/es/es2018/types/src/generated/types/SmartDataDiscoveryModelConfigurationRepresentation.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/SmartDataDiscoveryNumericOutcomeRepresentation.d.ts +43 -0
- package/dist/es/es2018/types/src/generated/types/SmartDataDiscoveryOutcomeRepresentation.d.ts +40 -0
- package/dist/es/es2018/types/src/generated/types/SmartDataDiscoveryTextOutcomeRepresentation.d.ts +43 -0
- package/dist/es/es2018/types/src/generated/types/SmartDataDiscoveryUserRepresentation.d.ts +35 -0
- package/dist/es/es2018/types/src/generated/types/StoryCollectionRepresentation.d.ts +49 -0
- package/dist/es/es2018/types/src/generated/types/StoryRepresentation.d.ts +120 -0
- package/dist/es/es2018/types/src/generated/types/StoryVersionReferenceRepresentation.d.ts +35 -0
- package/dist/es/es2018/types/src/generated/types/TextFieldConfigurationRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/TextFieldValueConfigurationRepresentation.d.ts +32 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +39 -0
- package/package.json +63 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +1117 -0
- package/src/raml/api.raml +648 -0
- package/src/raml/luvio.raml +19 -0
|
@@ -0,0 +1,1085 @@
|
|
|
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, StoreKeyMap } from '@luvio/engine';
|
|
8
|
+
|
|
9
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
10
|
+
const { keys: ObjectKeys$1, freeze: ObjectFreeze$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
|
+
const keyPrefix = 'smart-data-discovery';
|
|
52
|
+
|
|
53
|
+
const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
54
|
+
const { isArray: ArrayIsArray } = Array;
|
|
55
|
+
const { stringify: JSONStringify } = JSON;
|
|
56
|
+
function equalsArray(a, b, equalsItem) {
|
|
57
|
+
const aLength = a.length;
|
|
58
|
+
const bLength = b.length;
|
|
59
|
+
if (aLength !== bLength) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
for (let i = 0; i < aLength; i++) {
|
|
63
|
+
if (equalsItem(a[i], b[i]) === false) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
function deepFreeze$b(value) {
|
|
70
|
+
// No need to freeze primitives
|
|
71
|
+
if (typeof value !== 'object' || value === null) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (ArrayIsArray(value)) {
|
|
75
|
+
for (let i = 0, len = value.length; i < len; i += 1) {
|
|
76
|
+
deepFreeze$b(value[i]);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
const keys = ObjectKeys(value);
|
|
81
|
+
for (let i = 0, len = keys.length; i < len; i += 1) {
|
|
82
|
+
deepFreeze$b(value[keys[i]]);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
ObjectFreeze(value);
|
|
86
|
+
}
|
|
87
|
+
function createLink(ref) {
|
|
88
|
+
return {
|
|
89
|
+
__ref: serializeStructuredKey(ref),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function validate$b(obj, path = 'AutopilotRepresentation') {
|
|
94
|
+
const v_error = (() => {
|
|
95
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
96
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
97
|
+
}
|
|
98
|
+
const obj_enabled = obj.enabled;
|
|
99
|
+
const path_enabled = path + '.enabled';
|
|
100
|
+
if (typeof obj_enabled !== 'boolean') {
|
|
101
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_enabled + '" (at "' + path_enabled + '")');
|
|
102
|
+
}
|
|
103
|
+
})();
|
|
104
|
+
return v_error === undefined ? null : v_error;
|
|
105
|
+
}
|
|
106
|
+
function deepFreeze$a(input) {
|
|
107
|
+
ObjectFreeze(input);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
var DiscriminatorValues$4;
|
|
111
|
+
(function (DiscriminatorValues) {
|
|
112
|
+
DiscriminatorValues["Binary"] = "Binary";
|
|
113
|
+
})(DiscriminatorValues$4 || (DiscriminatorValues$4 = {}));
|
|
114
|
+
function validate$a(obj, path = 'AbstractClassificationThresholdRepresentation') {
|
|
115
|
+
const v_error = (() => {
|
|
116
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
117
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
118
|
+
}
|
|
119
|
+
const obj_type = obj.type;
|
|
120
|
+
const path_type = path + '.type';
|
|
121
|
+
if (typeof obj_type !== 'string') {
|
|
122
|
+
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
123
|
+
}
|
|
124
|
+
})();
|
|
125
|
+
return v_error === undefined ? null : v_error;
|
|
126
|
+
}
|
|
127
|
+
function deepFreeze$9(input) {
|
|
128
|
+
ObjectFreeze(input);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function validate$9(obj, path = 'SmartDataDiscoveryUserRepresentation') {
|
|
132
|
+
const v_error = (() => {
|
|
133
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
134
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
135
|
+
}
|
|
136
|
+
const obj_id = obj.id;
|
|
137
|
+
const path_id = path + '.id';
|
|
138
|
+
if (typeof obj_id !== 'string') {
|
|
139
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
140
|
+
}
|
|
141
|
+
const obj_name = obj.name;
|
|
142
|
+
const path_name = path + '.name';
|
|
143
|
+
if (typeof obj_name !== 'string') {
|
|
144
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
145
|
+
}
|
|
146
|
+
const obj_profilePhotoUrl = obj.profilePhotoUrl;
|
|
147
|
+
const path_profilePhotoUrl = path + '.profilePhotoUrl';
|
|
148
|
+
if (typeof obj_profilePhotoUrl !== 'string') {
|
|
149
|
+
return new TypeError('Expected "string" but received "' + typeof obj_profilePhotoUrl + '" (at "' + path_profilePhotoUrl + '")');
|
|
150
|
+
}
|
|
151
|
+
})();
|
|
152
|
+
return v_error === undefined ? null : v_error;
|
|
153
|
+
}
|
|
154
|
+
function deepFreeze$8(input) {
|
|
155
|
+
ObjectFreeze(input);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
var DiscriminatorValues$3;
|
|
159
|
+
(function (DiscriminatorValues) {
|
|
160
|
+
DiscriminatorValues["EVEN_WIDTH"] = "EVEN_WIDTH";
|
|
161
|
+
DiscriminatorValues["PERCENTILE"] = "PERCENTILE";
|
|
162
|
+
DiscriminatorValues["MANUAL"] = "MANUAL";
|
|
163
|
+
})(DiscriminatorValues$3 || (DiscriminatorValues$3 = {}));
|
|
164
|
+
|
|
165
|
+
var DiscriminatorValues$2;
|
|
166
|
+
(function (DiscriminatorValues) {
|
|
167
|
+
DiscriminatorValues["number"] = "number";
|
|
168
|
+
DiscriminatorValues["text"] = "text";
|
|
169
|
+
DiscriminatorValues["date"] = "date";
|
|
170
|
+
})(DiscriminatorValues$2 || (DiscriminatorValues$2 = {}));
|
|
171
|
+
function validate$8(obj, path = 'AbstractFieldConfigurationRepresentation') {
|
|
172
|
+
const v_error = (() => {
|
|
173
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
174
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
175
|
+
}
|
|
176
|
+
if (obj.highCardinality !== undefined) {
|
|
177
|
+
const obj_highCardinality = obj.highCardinality;
|
|
178
|
+
const path_highCardinality = path + '.highCardinality';
|
|
179
|
+
if (typeof obj_highCardinality !== 'boolean') {
|
|
180
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_highCardinality + '" (at "' + path_highCardinality + '")');
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (obj.ignored !== undefined) {
|
|
184
|
+
const obj_ignored = obj.ignored;
|
|
185
|
+
const path_ignored = path + '.ignored';
|
|
186
|
+
if (typeof obj_ignored !== 'boolean') {
|
|
187
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_ignored + '" (at "' + path_ignored + '")');
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
if (obj.label !== undefined) {
|
|
191
|
+
const obj_label = obj.label;
|
|
192
|
+
const path_label = path + '.label';
|
|
193
|
+
if (typeof obj_label !== 'string') {
|
|
194
|
+
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
const obj_name = obj.name;
|
|
198
|
+
const path_name = path + '.name';
|
|
199
|
+
if (typeof obj_name !== 'string') {
|
|
200
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
201
|
+
}
|
|
202
|
+
if (obj.sensitive !== undefined) {
|
|
203
|
+
const obj_sensitive = obj.sensitive;
|
|
204
|
+
const path_sensitive = path + '.sensitive';
|
|
205
|
+
if (typeof obj_sensitive !== 'boolean') {
|
|
206
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_sensitive + '" (at "' + path_sensitive + '")');
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
const obj_type = obj.type;
|
|
210
|
+
const path_type = path + '.type';
|
|
211
|
+
if (typeof obj_type !== 'string') {
|
|
212
|
+
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
213
|
+
}
|
|
214
|
+
})();
|
|
215
|
+
return v_error === undefined ? null : v_error;
|
|
216
|
+
}
|
|
217
|
+
function deepFreeze$7(input) {
|
|
218
|
+
ObjectFreeze(input);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function validate$7(obj, path = 'BaseAssetReferenceRepresentation') {
|
|
222
|
+
const v_error = (() => {
|
|
223
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
224
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
225
|
+
}
|
|
226
|
+
const obj_id = obj.id;
|
|
227
|
+
const path_id = path + '.id';
|
|
228
|
+
if (typeof obj_id !== 'string') {
|
|
229
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
230
|
+
}
|
|
231
|
+
if (obj.label !== undefined) {
|
|
232
|
+
const obj_label = obj.label;
|
|
233
|
+
const path_label = path + '.label';
|
|
234
|
+
if (typeof obj_label !== 'string') {
|
|
235
|
+
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
if (obj.name !== undefined) {
|
|
239
|
+
const obj_name = obj.name;
|
|
240
|
+
const path_name = path + '.name';
|
|
241
|
+
if (typeof obj_name !== 'string') {
|
|
242
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (obj.namespace !== undefined) {
|
|
246
|
+
const obj_namespace = obj.namespace;
|
|
247
|
+
const path_namespace = path + '.namespace';
|
|
248
|
+
if (typeof obj_namespace !== 'string') {
|
|
249
|
+
return new TypeError('Expected "string" but received "' + typeof obj_namespace + '" (at "' + path_namespace + '")');
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
if (obj.url !== undefined) {
|
|
253
|
+
const obj_url = obj.url;
|
|
254
|
+
const path_url = path + '.url';
|
|
255
|
+
if (typeof obj_url !== 'string') {
|
|
256
|
+
return new TypeError('Expected "string" but received "' + typeof obj_url + '" (at "' + path_url + '")');
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
})();
|
|
260
|
+
return v_error === undefined ? null : v_error;
|
|
261
|
+
}
|
|
262
|
+
function deepFreeze$6(input) {
|
|
263
|
+
ObjectFreeze(input);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function validate$6(obj, path = 'AssetReferenceRepresentation') {
|
|
267
|
+
const validateBaseAssetReferenceRepresentation_validateError = validate$7(obj, path);
|
|
268
|
+
if (validateBaseAssetReferenceRepresentation_validateError !== null) {
|
|
269
|
+
return validateBaseAssetReferenceRepresentation_validateError;
|
|
270
|
+
}
|
|
271
|
+
const v_error = (() => {
|
|
272
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
273
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
274
|
+
}
|
|
275
|
+
})();
|
|
276
|
+
return v_error === undefined ? null : v_error;
|
|
277
|
+
}
|
|
278
|
+
function deepFreeze$5(input) {
|
|
279
|
+
deepFreeze$6(input);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
var DiscriminatorValues$1;
|
|
283
|
+
(function (DiscriminatorValues) {
|
|
284
|
+
DiscriminatorValues["Report"] = "Report";
|
|
285
|
+
DiscriminatorValues["AnalyticsDataset"] = "AnalyticsDataset";
|
|
286
|
+
})(DiscriminatorValues$1 || (DiscriminatorValues$1 = {}));
|
|
287
|
+
function validate$5(obj, path = 'AbstractStorySourceRepresentation') {
|
|
288
|
+
const v_error = (() => {
|
|
289
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
290
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
291
|
+
}
|
|
292
|
+
const obj_type = obj.type;
|
|
293
|
+
const path_type = path + '.type';
|
|
294
|
+
if (typeof obj_type !== 'string') {
|
|
295
|
+
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
296
|
+
}
|
|
297
|
+
})();
|
|
298
|
+
return v_error === undefined ? null : v_error;
|
|
299
|
+
}
|
|
300
|
+
function deepFreeze$4(input) {
|
|
301
|
+
ObjectFreeze(input);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function validate$4(obj, path = 'StoryVersionReferenceRepresentation') {
|
|
305
|
+
const v_error = (() => {
|
|
306
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
307
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
308
|
+
}
|
|
309
|
+
const obj_createdDate = obj.createdDate;
|
|
310
|
+
const path_createdDate = path + '.createdDate';
|
|
311
|
+
if (typeof obj_createdDate !== 'string') {
|
|
312
|
+
return new TypeError('Expected "string" but received "' + typeof obj_createdDate + '" (at "' + path_createdDate + '")');
|
|
313
|
+
}
|
|
314
|
+
const obj_id = obj.id;
|
|
315
|
+
const path_id = path + '.id';
|
|
316
|
+
if (typeof obj_id !== 'string') {
|
|
317
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
318
|
+
}
|
|
319
|
+
const obj_url = obj.url;
|
|
320
|
+
const path_url = path + '.url';
|
|
321
|
+
if (typeof obj_url !== 'string') {
|
|
322
|
+
return new TypeError('Expected "string" but received "' + typeof obj_url + '" (at "' + path_url + '")');
|
|
323
|
+
}
|
|
324
|
+
})();
|
|
325
|
+
return v_error === undefined ? null : v_error;
|
|
326
|
+
}
|
|
327
|
+
function deepFreeze$3(input) {
|
|
328
|
+
ObjectFreeze(input);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
function validate$3(obj, path = 'SmartDataDiscoveryModelConfigurationRepresentation') {
|
|
332
|
+
const v_error = (() => {
|
|
333
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
334
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
335
|
+
}
|
|
336
|
+
if (obj.algorithmType !== undefined) {
|
|
337
|
+
const obj_algorithmType = obj.algorithmType;
|
|
338
|
+
const path_algorithmType = path + '.algorithmType';
|
|
339
|
+
if (typeof obj_algorithmType !== 'string') {
|
|
340
|
+
return new TypeError('Expected "string" but received "' + typeof obj_algorithmType + '" (at "' + path_algorithmType + '")');
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
})();
|
|
344
|
+
return v_error === undefined ? null : v_error;
|
|
345
|
+
}
|
|
346
|
+
function deepFreeze$2(input) {
|
|
347
|
+
ObjectFreeze(input);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
var DiscriminatorValues;
|
|
351
|
+
(function (DiscriminatorValues) {
|
|
352
|
+
DiscriminatorValues["Categorical"] = "Categorical";
|
|
353
|
+
DiscriminatorValues["Text"] = "Text";
|
|
354
|
+
DiscriminatorValues["Number"] = "Number";
|
|
355
|
+
DiscriminatorValues["Count"] = "Count";
|
|
356
|
+
})(DiscriminatorValues || (DiscriminatorValues = {}));
|
|
357
|
+
function validate$2(obj, path = 'SmartDataDiscoveryOutcomeRepresentation') {
|
|
358
|
+
const v_error = (() => {
|
|
359
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
360
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
361
|
+
}
|
|
362
|
+
if (obj.predictionType !== undefined) {
|
|
363
|
+
const obj_predictionType = obj.predictionType;
|
|
364
|
+
const path_predictionType = path + '.predictionType';
|
|
365
|
+
if (typeof obj_predictionType !== 'string') {
|
|
366
|
+
return new TypeError('Expected "string" but received "' + typeof obj_predictionType + '" (at "' + path_predictionType + '")');
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
const obj_type = obj.type;
|
|
370
|
+
const path_type = path + '.type';
|
|
371
|
+
if (typeof obj_type !== 'string') {
|
|
372
|
+
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
373
|
+
}
|
|
374
|
+
})();
|
|
375
|
+
return v_error === undefined ? null : v_error;
|
|
376
|
+
}
|
|
377
|
+
function deepFreeze$1(input) {
|
|
378
|
+
ObjectFreeze(input);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
const VERSION$1 = "d4423c3a95001b87ff287225e769154d";
|
|
382
|
+
function validate$1(obj, path = 'StoryRepresentation') {
|
|
383
|
+
const v_error = (() => {
|
|
384
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
385
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
386
|
+
}
|
|
387
|
+
if (obj.autopilot !== undefined) {
|
|
388
|
+
const obj_autopilot = obj.autopilot;
|
|
389
|
+
const path_autopilot = path + '.autopilot';
|
|
390
|
+
const referencepath_autopilotValidationError = validate$b(obj_autopilot, path_autopilot);
|
|
391
|
+
if (referencepath_autopilotValidationError !== null) {
|
|
392
|
+
let message = 'Object doesn\'t match AutopilotRepresentation (at "' + path_autopilot + '")\n';
|
|
393
|
+
message += referencepath_autopilotValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
394
|
+
return new TypeError(message);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
if (obj.classificationThreshold !== undefined) {
|
|
398
|
+
const obj_classificationThreshold = obj.classificationThreshold;
|
|
399
|
+
const path_classificationThreshold = path + '.classificationThreshold';
|
|
400
|
+
const referencepath_classificationThresholdValidationError = validate$a(obj_classificationThreshold, path_classificationThreshold);
|
|
401
|
+
if (referencepath_classificationThresholdValidationError !== null) {
|
|
402
|
+
let message = 'Object doesn\'t match AbstractClassificationThresholdRepresentation (at "' + path_classificationThreshold + '")\n';
|
|
403
|
+
message += referencepath_classificationThresholdValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
404
|
+
return new TypeError(message);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
if (obj.createdBy !== undefined) {
|
|
408
|
+
const obj_createdBy = obj.createdBy;
|
|
409
|
+
const path_createdBy = path + '.createdBy';
|
|
410
|
+
const referencepath_createdByValidationError = validate$9(obj_createdBy, path_createdBy);
|
|
411
|
+
if (referencepath_createdByValidationError !== null) {
|
|
412
|
+
let message = 'Object doesn\'t match SmartDataDiscoveryUserRepresentation (at "' + path_createdBy + '")\n';
|
|
413
|
+
message += referencepath_createdByValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
414
|
+
return new TypeError(message);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
if (obj.createdDate !== undefined) {
|
|
418
|
+
const obj_createdDate = obj.createdDate;
|
|
419
|
+
const path_createdDate = path + '.createdDate';
|
|
420
|
+
if (typeof obj_createdDate !== 'string') {
|
|
421
|
+
return new TypeError('Expected "string" but received "' + typeof obj_createdDate + '" (at "' + path_createdDate + '")');
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
if (obj.errorCode !== undefined) {
|
|
425
|
+
const obj_errorCode = obj.errorCode;
|
|
426
|
+
const path_errorCode = path + '.errorCode';
|
|
427
|
+
if (typeof obj_errorCode !== 'number' || (typeof obj_errorCode === 'number' && Math.floor(obj_errorCode) !== obj_errorCode)) {
|
|
428
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_errorCode + '" (at "' + path_errorCode + '")');
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
const obj_fields = obj.fields;
|
|
432
|
+
const path_fields = path + '.fields';
|
|
433
|
+
if (!ArrayIsArray(obj_fields)) {
|
|
434
|
+
return new TypeError('Expected "array" but received "' + typeof obj_fields + '" (at "' + path_fields + '")');
|
|
435
|
+
}
|
|
436
|
+
for (let i = 0; i < obj_fields.length; i++) {
|
|
437
|
+
const obj_fields_item = obj_fields[i];
|
|
438
|
+
const path_fields_item = path_fields + '[' + i + ']';
|
|
439
|
+
const referencepath_fields_itemValidationError = validate$8(obj_fields_item, path_fields_item);
|
|
440
|
+
if (referencepath_fields_itemValidationError !== null) {
|
|
441
|
+
let message = 'Object doesn\'t match AbstractFieldConfigurationRepresentation (at "' + path_fields_item + '")\n';
|
|
442
|
+
message += referencepath_fields_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
443
|
+
return new TypeError(message);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
if (obj.folder !== undefined) {
|
|
447
|
+
const obj_folder = obj.folder;
|
|
448
|
+
const path_folder = path + '.folder';
|
|
449
|
+
const referencepath_folderValidationError = validate$6(obj_folder, path_folder);
|
|
450
|
+
if (referencepath_folderValidationError !== null) {
|
|
451
|
+
let message = 'Object doesn\'t match AssetReferenceRepresentation (at "' + path_folder + '")\n';
|
|
452
|
+
message += referencepath_folderValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
453
|
+
return new TypeError(message);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
if (obj.historiesUrl !== undefined) {
|
|
457
|
+
const obj_historiesUrl = obj.historiesUrl;
|
|
458
|
+
const path_historiesUrl = path + '.historiesUrl';
|
|
459
|
+
if (typeof obj_historiesUrl !== 'string') {
|
|
460
|
+
return new TypeError('Expected "string" but received "' + typeof obj_historiesUrl + '" (at "' + path_historiesUrl + '")');
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
const obj_id = obj.id;
|
|
464
|
+
const path_id = path + '.id';
|
|
465
|
+
if (typeof obj_id !== 'string') {
|
|
466
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
467
|
+
}
|
|
468
|
+
if (obj.input !== undefined) {
|
|
469
|
+
const obj_input = obj.input;
|
|
470
|
+
const path_input = path + '.input';
|
|
471
|
+
const referencepath_inputValidationError = validate$5(obj_input, path_input);
|
|
472
|
+
if (referencepath_inputValidationError !== null) {
|
|
473
|
+
let message = 'Object doesn\'t match AbstractStorySourceRepresentation (at "' + path_input + '")\n';
|
|
474
|
+
message += referencepath_inputValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
475
|
+
return new TypeError(message);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
if (obj.inputProfile !== undefined) {
|
|
479
|
+
const obj_inputProfile = obj.inputProfile;
|
|
480
|
+
const path_inputProfile = path + '.inputProfile';
|
|
481
|
+
const referencepath_inputProfileValidationError = validate$6(obj_inputProfile, path_inputProfile);
|
|
482
|
+
if (referencepath_inputProfileValidationError !== null) {
|
|
483
|
+
let message = 'Object doesn\'t match AssetReferenceRepresentation (at "' + path_inputProfile + '")\n';
|
|
484
|
+
message += referencepath_inputProfileValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
485
|
+
return new TypeError(message);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
if (obj.label !== undefined) {
|
|
489
|
+
const obj_label = obj.label;
|
|
490
|
+
const path_label = path + '.label';
|
|
491
|
+
if (typeof obj_label !== 'string') {
|
|
492
|
+
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
if (obj.lastModifiedBy !== undefined) {
|
|
496
|
+
const obj_lastModifiedBy = obj.lastModifiedBy;
|
|
497
|
+
const path_lastModifiedBy = path + '.lastModifiedBy';
|
|
498
|
+
const referencepath_lastModifiedByValidationError = validate$9(obj_lastModifiedBy, path_lastModifiedBy);
|
|
499
|
+
if (referencepath_lastModifiedByValidationError !== null) {
|
|
500
|
+
let message = 'Object doesn\'t match SmartDataDiscoveryUserRepresentation (at "' + path_lastModifiedBy + '")\n';
|
|
501
|
+
message += referencepath_lastModifiedByValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
502
|
+
return new TypeError(message);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
if (obj.lastModifiedDate !== undefined) {
|
|
506
|
+
const obj_lastModifiedDate = obj.lastModifiedDate;
|
|
507
|
+
const path_lastModifiedDate = path + '.lastModifiedDate';
|
|
508
|
+
if (typeof obj_lastModifiedDate !== 'string') {
|
|
509
|
+
return new TypeError('Expected "string" but received "' + typeof obj_lastModifiedDate + '" (at "' + path_lastModifiedDate + '")');
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
if (obj.lastSuccessfulVersion !== undefined) {
|
|
513
|
+
const obj_lastSuccessfulVersion = obj.lastSuccessfulVersion;
|
|
514
|
+
const path_lastSuccessfulVersion = path + '.lastSuccessfulVersion';
|
|
515
|
+
const referencepath_lastSuccessfulVersionValidationError = validate$4(obj_lastSuccessfulVersion, path_lastSuccessfulVersion);
|
|
516
|
+
if (referencepath_lastSuccessfulVersionValidationError !== null) {
|
|
517
|
+
let message = 'Object doesn\'t match StoryVersionReferenceRepresentation (at "' + path_lastSuccessfulVersion + '")\n';
|
|
518
|
+
message += referencepath_lastSuccessfulVersionValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
519
|
+
return new TypeError(message);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
if (obj.message !== undefined) {
|
|
523
|
+
const obj_message = obj.message;
|
|
524
|
+
const path_message = path + '.message';
|
|
525
|
+
if (typeof obj_message !== 'string') {
|
|
526
|
+
return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
if (obj.modelConfiguration !== undefined) {
|
|
530
|
+
const obj_modelConfiguration = obj.modelConfiguration;
|
|
531
|
+
const path_modelConfiguration = path + '.modelConfiguration';
|
|
532
|
+
const referencepath_modelConfigurationValidationError = validate$3(obj_modelConfiguration, path_modelConfiguration);
|
|
533
|
+
if (referencepath_modelConfigurationValidationError !== null) {
|
|
534
|
+
let message = 'Object doesn\'t match SmartDataDiscoveryModelConfigurationRepresentation (at "' + path_modelConfiguration + '")\n';
|
|
535
|
+
message += referencepath_modelConfigurationValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
536
|
+
return new TypeError(message);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
if (obj.name !== undefined) {
|
|
540
|
+
const obj_name = obj.name;
|
|
541
|
+
const path_name = path + '.name';
|
|
542
|
+
if (typeof obj_name !== 'string') {
|
|
543
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
if (obj.namespace !== undefined) {
|
|
547
|
+
const obj_namespace = obj.namespace;
|
|
548
|
+
const path_namespace = path + '.namespace';
|
|
549
|
+
if (typeof obj_namespace !== 'string') {
|
|
550
|
+
return new TypeError('Expected "string" but received "' + typeof obj_namespace + '" (at "' + path_namespace + '")');
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
if (obj.outcome !== undefined) {
|
|
554
|
+
const obj_outcome = obj.outcome;
|
|
555
|
+
const path_outcome = path + '.outcome';
|
|
556
|
+
const referencepath_outcomeValidationError = validate$2(obj_outcome, path_outcome);
|
|
557
|
+
if (referencepath_outcomeValidationError !== null) {
|
|
558
|
+
let message = 'Object doesn\'t match SmartDataDiscoveryOutcomeRepresentation (at "' + path_outcome + '")\n';
|
|
559
|
+
message += referencepath_outcomeValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
560
|
+
return new TypeError(message);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
if (obj.runId !== undefined) {
|
|
564
|
+
const obj_runId = obj.runId;
|
|
565
|
+
const path_runId = path + '.runId';
|
|
566
|
+
if (typeof obj_runId !== 'string') {
|
|
567
|
+
return new TypeError('Expected "string" but received "' + typeof obj_runId + '" (at "' + path_runId + '")');
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
if (obj.setup !== undefined) {
|
|
571
|
+
const obj_setup = obj.setup;
|
|
572
|
+
const path_setup = path + '.setup';
|
|
573
|
+
if (typeof obj_setup !== 'object' || ArrayIsArray(obj_setup) || obj_setup === null) {
|
|
574
|
+
return new TypeError('Expected "object" but received "' + typeof obj_setup + '" (at "' + path_setup + '")');
|
|
575
|
+
}
|
|
576
|
+
const obj_setup_keys = ObjectKeys(obj_setup);
|
|
577
|
+
for (let i = 0; i < obj_setup_keys.length; i++) {
|
|
578
|
+
const key = obj_setup_keys[i];
|
|
579
|
+
const obj_setup_prop = obj_setup[key];
|
|
580
|
+
const path_setup_prop = path_setup + '["' + key + '"]';
|
|
581
|
+
if (obj_setup_prop === undefined) {
|
|
582
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_setup_prop + '" (at "' + path_setup_prop + '")');
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
if (obj.status !== undefined) {
|
|
587
|
+
const obj_status = obj.status;
|
|
588
|
+
const path_status = path + '.status';
|
|
589
|
+
if (typeof obj_status !== 'string') {
|
|
590
|
+
return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
const obj_url = obj.url;
|
|
594
|
+
const path_url = path + '.url';
|
|
595
|
+
if (typeof obj_url !== 'string') {
|
|
596
|
+
return new TypeError('Expected "string" but received "' + typeof obj_url + '" (at "' + path_url + '")');
|
|
597
|
+
}
|
|
598
|
+
})();
|
|
599
|
+
return v_error === undefined ? null : v_error;
|
|
600
|
+
}
|
|
601
|
+
const RepresentationType$1 = 'StoryRepresentation';
|
|
602
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
603
|
+
return input;
|
|
604
|
+
}
|
|
605
|
+
const select$2 = function StoryRepresentationSelect() {
|
|
606
|
+
return {
|
|
607
|
+
kind: 'Fragment',
|
|
608
|
+
version: VERSION$1,
|
|
609
|
+
private: [],
|
|
610
|
+
opaque: true
|
|
611
|
+
};
|
|
612
|
+
};
|
|
613
|
+
function equals$1(existing, incoming) {
|
|
614
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
615
|
+
return false;
|
|
616
|
+
}
|
|
617
|
+
return true;
|
|
618
|
+
}
|
|
619
|
+
function deepFreeze(input) {
|
|
620
|
+
const input_autopilot = input.autopilot;
|
|
621
|
+
if (input_autopilot !== undefined) {
|
|
622
|
+
deepFreeze$a(input_autopilot);
|
|
623
|
+
}
|
|
624
|
+
const input_classificationThreshold = input.classificationThreshold;
|
|
625
|
+
if (input_classificationThreshold !== undefined) {
|
|
626
|
+
deepFreeze$9(input_classificationThreshold);
|
|
627
|
+
}
|
|
628
|
+
const input_createdBy = input.createdBy;
|
|
629
|
+
if (input_createdBy !== undefined) {
|
|
630
|
+
deepFreeze$8(input_createdBy);
|
|
631
|
+
}
|
|
632
|
+
const input_fields = input.fields;
|
|
633
|
+
for (let i = 0; i < input_fields.length; i++) {
|
|
634
|
+
const input_fields_item = input_fields[i];
|
|
635
|
+
deepFreeze$7(input_fields_item);
|
|
636
|
+
}
|
|
637
|
+
ObjectFreeze(input_fields);
|
|
638
|
+
const input_folder = input.folder;
|
|
639
|
+
if (input_folder !== undefined) {
|
|
640
|
+
deepFreeze$5(input_folder);
|
|
641
|
+
}
|
|
642
|
+
const input_input = input.input;
|
|
643
|
+
if (input_input !== undefined) {
|
|
644
|
+
deepFreeze$4(input_input);
|
|
645
|
+
}
|
|
646
|
+
const input_inputProfile = input.inputProfile;
|
|
647
|
+
if (input_inputProfile !== undefined) {
|
|
648
|
+
deepFreeze$5(input_inputProfile);
|
|
649
|
+
}
|
|
650
|
+
const input_lastModifiedBy = input.lastModifiedBy;
|
|
651
|
+
if (input_lastModifiedBy !== undefined) {
|
|
652
|
+
deepFreeze$8(input_lastModifiedBy);
|
|
653
|
+
}
|
|
654
|
+
const input_lastSuccessfulVersion = input.lastSuccessfulVersion;
|
|
655
|
+
if (input_lastSuccessfulVersion !== undefined) {
|
|
656
|
+
deepFreeze$3(input_lastSuccessfulVersion);
|
|
657
|
+
}
|
|
658
|
+
const input_modelConfiguration = input.modelConfiguration;
|
|
659
|
+
if (input_modelConfiguration !== undefined) {
|
|
660
|
+
deepFreeze$2(input_modelConfiguration);
|
|
661
|
+
}
|
|
662
|
+
const input_outcome = input.outcome;
|
|
663
|
+
if (input_outcome !== undefined) {
|
|
664
|
+
deepFreeze$1(input_outcome);
|
|
665
|
+
}
|
|
666
|
+
const input_setup = input.setup;
|
|
667
|
+
if (input_setup !== undefined) {
|
|
668
|
+
const input_setup_keys = Object.keys(input_setup);
|
|
669
|
+
const input_setup_length = input_setup_keys.length;
|
|
670
|
+
for (let i = 0; i < input_setup_length; i++) {
|
|
671
|
+
const key = input_setup_keys[i];
|
|
672
|
+
const input_setup_prop = input_setup[key];
|
|
673
|
+
deepFreeze$b(input_setup_prop);
|
|
674
|
+
}
|
|
675
|
+
ObjectFreeze(input_setup);
|
|
676
|
+
}
|
|
677
|
+
ObjectFreeze(input);
|
|
678
|
+
}
|
|
679
|
+
const ingest$1 = function StoryRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
680
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
681
|
+
const validateError = validate$1(input);
|
|
682
|
+
if (validateError !== null) {
|
|
683
|
+
throw validateError;
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
const key = path.fullPath;
|
|
687
|
+
const existingRecord = store.readEntry(key);
|
|
688
|
+
const ttlToUse = path.ttl;
|
|
689
|
+
let incomingRecord = normalize$1(input, store.readEntry(key), {
|
|
690
|
+
fullPath: key,
|
|
691
|
+
parent: path.parent,
|
|
692
|
+
propertyName: path.propertyName,
|
|
693
|
+
ttl: ttlToUse
|
|
694
|
+
});
|
|
695
|
+
deepFreeze(input);
|
|
696
|
+
if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
|
|
697
|
+
luvio.storePublish(key, incomingRecord);
|
|
698
|
+
}
|
|
699
|
+
if (ttlToUse !== undefined) {
|
|
700
|
+
const storeMetadataParams = {
|
|
701
|
+
ttl: ttlToUse,
|
|
702
|
+
namespace: "smart-data-discovery",
|
|
703
|
+
version: VERSION$1,
|
|
704
|
+
representationName: RepresentationType$1,
|
|
705
|
+
};
|
|
706
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
707
|
+
}
|
|
708
|
+
return createLink(key);
|
|
709
|
+
};
|
|
710
|
+
function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
|
|
711
|
+
const rootKeySet = new StoreKeyMap();
|
|
712
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
713
|
+
const rootKey = fullPathFactory();
|
|
714
|
+
rootKeySet.set(rootKey, {
|
|
715
|
+
namespace: keyPrefix,
|
|
716
|
+
representationName: RepresentationType$1,
|
|
717
|
+
mergeable: false
|
|
718
|
+
});
|
|
719
|
+
return rootKeySet;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
const TTL = 300;
|
|
723
|
+
const VERSION = "d239274afc459b7c18e15e439625fa6c";
|
|
724
|
+
function validate(obj, path = 'StoryCollectionRepresentation') {
|
|
725
|
+
const v_error = (() => {
|
|
726
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
727
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
728
|
+
}
|
|
729
|
+
if (obj.nextPageUrl !== undefined) {
|
|
730
|
+
const obj_nextPageUrl = obj.nextPageUrl;
|
|
731
|
+
const path_nextPageUrl = path + '.nextPageUrl';
|
|
732
|
+
if (typeof obj_nextPageUrl !== 'string') {
|
|
733
|
+
return new TypeError('Expected "string" but received "' + typeof obj_nextPageUrl + '" (at "' + path_nextPageUrl + '")');
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
const obj_stories = obj.stories;
|
|
737
|
+
const path_stories = path + '.stories';
|
|
738
|
+
if (!ArrayIsArray(obj_stories)) {
|
|
739
|
+
return new TypeError('Expected "array" but received "' + typeof obj_stories + '" (at "' + path_stories + '")');
|
|
740
|
+
}
|
|
741
|
+
for (let i = 0; i < obj_stories.length; i++) {
|
|
742
|
+
const obj_stories_item = obj_stories[i];
|
|
743
|
+
const path_stories_item = path_stories + '[' + i + ']';
|
|
744
|
+
if (typeof obj_stories_item !== 'object') {
|
|
745
|
+
return new TypeError('Expected "object" but received "' + typeof obj_stories_item + '" (at "' + path_stories_item + '")');
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
const obj_totalSize = obj.totalSize;
|
|
749
|
+
const path_totalSize = path + '.totalSize';
|
|
750
|
+
if (typeof obj_totalSize !== 'number' || (typeof obj_totalSize === 'number' && Math.floor(obj_totalSize) !== obj_totalSize)) {
|
|
751
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_totalSize + '" (at "' + path_totalSize + '")');
|
|
752
|
+
}
|
|
753
|
+
const obj_url = obj.url;
|
|
754
|
+
const path_url = path + '.url';
|
|
755
|
+
if (typeof obj_url !== 'string') {
|
|
756
|
+
return new TypeError('Expected "string" but received "' + typeof obj_url + '" (at "' + path_url + '")');
|
|
757
|
+
}
|
|
758
|
+
})();
|
|
759
|
+
return v_error === undefined ? null : v_error;
|
|
760
|
+
}
|
|
761
|
+
const RepresentationType = 'StoryCollectionRepresentation';
|
|
762
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
763
|
+
const input_stories = input.stories;
|
|
764
|
+
const input_stories_id = path.fullPath + '__stories';
|
|
765
|
+
for (let i = 0; i < input_stories.length; i++) {
|
|
766
|
+
const input_stories_item = input_stories[i];
|
|
767
|
+
let input_stories_item_id = input_stories_id + '__' + i;
|
|
768
|
+
input_stories[i] = ingest$1(input_stories_item, {
|
|
769
|
+
fullPath: input_stories_item_id,
|
|
770
|
+
propertyName: i,
|
|
771
|
+
parent: {
|
|
772
|
+
data: input,
|
|
773
|
+
key: path.fullPath,
|
|
774
|
+
existing: existing,
|
|
775
|
+
},
|
|
776
|
+
ttl: path.ttl
|
|
777
|
+
}, luvio, store);
|
|
778
|
+
}
|
|
779
|
+
return input;
|
|
780
|
+
}
|
|
781
|
+
const select$1 = function StoryCollectionRepresentationSelect() {
|
|
782
|
+
return {
|
|
783
|
+
kind: 'Fragment',
|
|
784
|
+
version: VERSION,
|
|
785
|
+
private: [],
|
|
786
|
+
selections: [
|
|
787
|
+
{
|
|
788
|
+
name: 'nextPageUrl',
|
|
789
|
+
kind: 'Scalar',
|
|
790
|
+
required: false
|
|
791
|
+
},
|
|
792
|
+
{
|
|
793
|
+
name: 'stories',
|
|
794
|
+
kind: 'Link',
|
|
795
|
+
plural: true,
|
|
796
|
+
fragment: select$2()
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
name: 'totalSize',
|
|
800
|
+
kind: 'Scalar'
|
|
801
|
+
},
|
|
802
|
+
{
|
|
803
|
+
name: 'url',
|
|
804
|
+
kind: 'Scalar'
|
|
805
|
+
}
|
|
806
|
+
]
|
|
807
|
+
};
|
|
808
|
+
};
|
|
809
|
+
function equals(existing, incoming) {
|
|
810
|
+
const existing_totalSize = existing.totalSize;
|
|
811
|
+
const incoming_totalSize = incoming.totalSize;
|
|
812
|
+
if (!(existing_totalSize === incoming_totalSize)) {
|
|
813
|
+
return false;
|
|
814
|
+
}
|
|
815
|
+
const existing_nextPageUrl = existing.nextPageUrl;
|
|
816
|
+
const incoming_nextPageUrl = incoming.nextPageUrl;
|
|
817
|
+
// if at least one of these optionals is defined
|
|
818
|
+
if (existing_nextPageUrl !== undefined || incoming_nextPageUrl !== undefined) {
|
|
819
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
820
|
+
// not equal
|
|
821
|
+
if (existing_nextPageUrl === undefined || incoming_nextPageUrl === undefined) {
|
|
822
|
+
return false;
|
|
823
|
+
}
|
|
824
|
+
if (!(existing_nextPageUrl === incoming_nextPageUrl)) {
|
|
825
|
+
return false;
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
const existing_url = existing.url;
|
|
829
|
+
const incoming_url = incoming.url;
|
|
830
|
+
if (!(existing_url === incoming_url)) {
|
|
831
|
+
return false;
|
|
832
|
+
}
|
|
833
|
+
const existing_stories = existing.stories;
|
|
834
|
+
const incoming_stories = incoming.stories;
|
|
835
|
+
const equals_stories_items = equalsArray(existing_stories, incoming_stories, (existing_stories_item, incoming_stories_item) => {
|
|
836
|
+
if (!(existing_stories_item.__ref === incoming_stories_item.__ref)) {
|
|
837
|
+
return false;
|
|
838
|
+
}
|
|
839
|
+
});
|
|
840
|
+
if (equals_stories_items === false) {
|
|
841
|
+
return false;
|
|
842
|
+
}
|
|
843
|
+
return true;
|
|
844
|
+
}
|
|
845
|
+
const ingest = function StoryCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
846
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
847
|
+
const validateError = validate(input);
|
|
848
|
+
if (validateError !== null) {
|
|
849
|
+
throw validateError;
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
const key = path.fullPath;
|
|
853
|
+
const existingRecord = store.readEntry(key);
|
|
854
|
+
const ttlToUse = TTL;
|
|
855
|
+
let incomingRecord = normalize(input, store.readEntry(key), {
|
|
856
|
+
fullPath: key,
|
|
857
|
+
parent: path.parent,
|
|
858
|
+
propertyName: path.propertyName,
|
|
859
|
+
ttl: ttlToUse
|
|
860
|
+
}, luvio, store);
|
|
861
|
+
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
862
|
+
luvio.storePublish(key, incomingRecord);
|
|
863
|
+
}
|
|
864
|
+
{
|
|
865
|
+
const storeMetadataParams = {
|
|
866
|
+
ttl: ttlToUse,
|
|
867
|
+
namespace: "smart-data-discovery",
|
|
868
|
+
version: VERSION,
|
|
869
|
+
representationName: RepresentationType,
|
|
870
|
+
};
|
|
871
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
872
|
+
}
|
|
873
|
+
return createLink(key);
|
|
874
|
+
};
|
|
875
|
+
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
876
|
+
const rootKeySet = new StoreKeyMap();
|
|
877
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
878
|
+
const rootKey = fullPathFactory();
|
|
879
|
+
rootKeySet.set(rootKey, {
|
|
880
|
+
namespace: keyPrefix,
|
|
881
|
+
representationName: RepresentationType,
|
|
882
|
+
mergeable: false
|
|
883
|
+
});
|
|
884
|
+
const input_stories_length = input.stories.length;
|
|
885
|
+
for (let i = 0; i < input_stories_length; i++) {
|
|
886
|
+
rootKeySet.merge(getTypeCacheKeys$1(luvio, input.stories[i], () => ''));
|
|
887
|
+
}
|
|
888
|
+
return rootKeySet;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
function select(luvio, params) {
|
|
892
|
+
return select$1();
|
|
893
|
+
}
|
|
894
|
+
function keyBuilder$1(luvio, params) {
|
|
895
|
+
return keyPrefix + '::StoryCollectionRepresentation:(' + 'folderId:' + params.queryParams.folderId + ',' + 'inputId:' + params.queryParams.inputId + ',' + 'page:' + params.queryParams.page + ',' + 'pageSize:' + params.queryParams.pageSize + ',' + 'q:' + params.queryParams.q + ',' + 'scope:' + params.queryParams.scope + ',' + 'sourceType:' + params.queryParams.sourceType + ',' + 'sourceTypes:' + params.queryParams.sourceTypes + ')';
|
|
896
|
+
}
|
|
897
|
+
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
898
|
+
return getTypeCacheKeys(luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
899
|
+
}
|
|
900
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
901
|
+
const { body } = response;
|
|
902
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
903
|
+
luvio.storeIngest(key, ingest, body);
|
|
904
|
+
const snapshot = luvio.storeLookup({
|
|
905
|
+
recordId: key,
|
|
906
|
+
node: select(),
|
|
907
|
+
variables: {},
|
|
908
|
+
}, snapshotRefresh);
|
|
909
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
910
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
911
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
return snapshot;
|
|
915
|
+
}
|
|
916
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
917
|
+
const key = keyBuilder$1(luvio, params);
|
|
918
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
919
|
+
const storeMetadataParams = {
|
|
920
|
+
ttl: TTL,
|
|
921
|
+
namespace: keyPrefix,
|
|
922
|
+
version: VERSION,
|
|
923
|
+
representationName: RepresentationType
|
|
924
|
+
};
|
|
925
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
926
|
+
return errorSnapshot;
|
|
927
|
+
}
|
|
928
|
+
function createResourceRequest(config) {
|
|
929
|
+
const headers = {};
|
|
930
|
+
return {
|
|
931
|
+
baseUri: '/services/data/v58.0',
|
|
932
|
+
basePath: '/smartdatadiscovery/stories',
|
|
933
|
+
method: 'get',
|
|
934
|
+
body: null,
|
|
935
|
+
urlParams: {},
|
|
936
|
+
queryParams: config.queryParams,
|
|
937
|
+
headers,
|
|
938
|
+
priority: 'normal',
|
|
939
|
+
};
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
const getStories_ConfigPropertyNames = {
|
|
943
|
+
displayName: 'getStories',
|
|
944
|
+
parameters: {
|
|
945
|
+
required: [],
|
|
946
|
+
optional: ['folderId', 'inputId', 'page', 'pageSize', 'q', 'scope', 'sourceType', 'sourceTypes']
|
|
947
|
+
}
|
|
948
|
+
};
|
|
949
|
+
function createResourceParams(config) {
|
|
950
|
+
const resourceParams = {
|
|
951
|
+
queryParams: {
|
|
952
|
+
folderId: config.folderId, inputId: config.inputId, page: config.page, pageSize: config.pageSize, q: config.q, scope: config.scope, sourceType: config.sourceType, sourceTypes: config.sourceTypes
|
|
953
|
+
}
|
|
954
|
+
};
|
|
955
|
+
return resourceParams;
|
|
956
|
+
}
|
|
957
|
+
function keyBuilder(luvio, config) {
|
|
958
|
+
const resourceParams = createResourceParams(config);
|
|
959
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
960
|
+
}
|
|
961
|
+
function typeCheckConfig(untrustedConfig) {
|
|
962
|
+
const config = {};
|
|
963
|
+
const untrustedConfig_folderId = untrustedConfig.folderId;
|
|
964
|
+
if (typeof untrustedConfig_folderId === 'string') {
|
|
965
|
+
config.folderId = untrustedConfig_folderId;
|
|
966
|
+
}
|
|
967
|
+
const untrustedConfig_inputId = untrustedConfig.inputId;
|
|
968
|
+
if (typeof untrustedConfig_inputId === 'string') {
|
|
969
|
+
config.inputId = untrustedConfig_inputId;
|
|
970
|
+
}
|
|
971
|
+
const untrustedConfig_page = untrustedConfig.page;
|
|
972
|
+
if (typeof untrustedConfig_page === 'string') {
|
|
973
|
+
config.page = untrustedConfig_page;
|
|
974
|
+
}
|
|
975
|
+
const untrustedConfig_pageSize = untrustedConfig.pageSize;
|
|
976
|
+
if (typeof untrustedConfig_pageSize === 'number' && Math.floor(untrustedConfig_pageSize) === untrustedConfig_pageSize) {
|
|
977
|
+
config.pageSize = untrustedConfig_pageSize;
|
|
978
|
+
}
|
|
979
|
+
const untrustedConfig_q = untrustedConfig.q;
|
|
980
|
+
if (typeof untrustedConfig_q === 'string') {
|
|
981
|
+
config.q = untrustedConfig_q;
|
|
982
|
+
}
|
|
983
|
+
const untrustedConfig_scope = untrustedConfig.scope;
|
|
984
|
+
if (typeof untrustedConfig_scope === 'string') {
|
|
985
|
+
config.scope = untrustedConfig_scope;
|
|
986
|
+
}
|
|
987
|
+
const untrustedConfig_sourceType = untrustedConfig.sourceType;
|
|
988
|
+
if (typeof untrustedConfig_sourceType === 'string') {
|
|
989
|
+
config.sourceType = untrustedConfig_sourceType;
|
|
990
|
+
}
|
|
991
|
+
const untrustedConfig_sourceTypes = untrustedConfig.sourceTypes;
|
|
992
|
+
if (ArrayIsArray$1(untrustedConfig_sourceTypes)) {
|
|
993
|
+
const untrustedConfig_sourceTypes_array = [];
|
|
994
|
+
for (let i = 0, arrayLength = untrustedConfig_sourceTypes.length; i < arrayLength; i++) {
|
|
995
|
+
const untrustedConfig_sourceTypes_item = untrustedConfig_sourceTypes[i];
|
|
996
|
+
if (typeof untrustedConfig_sourceTypes_item === 'string') {
|
|
997
|
+
untrustedConfig_sourceTypes_array.push(untrustedConfig_sourceTypes_item);
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
config.sourceTypes = untrustedConfig_sourceTypes_array;
|
|
1001
|
+
}
|
|
1002
|
+
return config;
|
|
1003
|
+
}
|
|
1004
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
1005
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1006
|
+
return null;
|
|
1007
|
+
}
|
|
1008
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1009
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1010
|
+
}
|
|
1011
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
1012
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1013
|
+
return null;
|
|
1014
|
+
}
|
|
1015
|
+
return config;
|
|
1016
|
+
}
|
|
1017
|
+
function adapterFragment(luvio, config) {
|
|
1018
|
+
createResourceParams(config);
|
|
1019
|
+
return select();
|
|
1020
|
+
}
|
|
1021
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
1022
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
1023
|
+
config,
|
|
1024
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1025
|
+
});
|
|
1026
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1027
|
+
}
|
|
1028
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
1029
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
1030
|
+
config,
|
|
1031
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1032
|
+
});
|
|
1033
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1034
|
+
}
|
|
1035
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
1036
|
+
const resourceParams = createResourceParams(config);
|
|
1037
|
+
const request = createResourceRequest(resourceParams);
|
|
1038
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1039
|
+
.then((response) => {
|
|
1040
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys(luvio, resourceParams, response.body));
|
|
1041
|
+
}, (response) => {
|
|
1042
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
1043
|
+
});
|
|
1044
|
+
}
|
|
1045
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
1046
|
+
const { luvio, config } = context;
|
|
1047
|
+
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
1048
|
+
const dispatchOptions = {
|
|
1049
|
+
resourceRequestContext: {
|
|
1050
|
+
requestCorrelator,
|
|
1051
|
+
luvioRequestMethod: undefined,
|
|
1052
|
+
},
|
|
1053
|
+
eventObservers
|
|
1054
|
+
};
|
|
1055
|
+
if (networkPriority !== 'normal') {
|
|
1056
|
+
dispatchOptions.overrides = {
|
|
1057
|
+
priority: networkPriority
|
|
1058
|
+
};
|
|
1059
|
+
}
|
|
1060
|
+
return buildNetworkSnapshot(luvio, config, dispatchOptions);
|
|
1061
|
+
}
|
|
1062
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
1063
|
+
const { luvio, config } = context;
|
|
1064
|
+
const selector = {
|
|
1065
|
+
recordId: keyBuilder(luvio, config),
|
|
1066
|
+
node: adapterFragment(luvio, config),
|
|
1067
|
+
variables: {},
|
|
1068
|
+
};
|
|
1069
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1070
|
+
config,
|
|
1071
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1072
|
+
});
|
|
1073
|
+
return cacheSnapshot;
|
|
1074
|
+
}
|
|
1075
|
+
const getStoriesAdapterFactory = (luvio) => function smartDataDiscovery__getStories(untrustedConfig, requestContext) {
|
|
1076
|
+
const config = validateAdapterConfig(untrustedConfig, getStories_ConfigPropertyNames);
|
|
1077
|
+
// Invalid or incomplete config
|
|
1078
|
+
if (config === null) {
|
|
1079
|
+
return null;
|
|
1080
|
+
}
|
|
1081
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1082
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
1083
|
+
};
|
|
1084
|
+
|
|
1085
|
+
export { getStoriesAdapterFactory };
|