@salesforce/lds-adapters-analytics-smart-data-discovery 1.100.1

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