@salesforce/lds-adapters-platform-external-services 1.100.2

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 (44) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/platform-external-services.js +2221 -0
  3. package/dist/types/src/generated/adapters/adapter-utils.d.ts +66 -0
  4. package/dist/types/src/generated/adapters/getDataShape.d.ts +28 -0
  5. package/dist/types/src/generated/adapters/getOpenApiSpec.d.ts +28 -0
  6. package/dist/types/src/generated/adapters/getStatistics.d.ts +25 -0
  7. package/dist/types/src/generated/adapters/getStatisticsForService.d.ts +26 -0
  8. package/dist/types/src/generated/adapters/validateSchema.d.ts +16 -0
  9. package/dist/types/src/generated/artifacts/main.d.ts +5 -0
  10. package/dist/types/src/generated/artifacts/sfdc.d.ts +10 -0
  11. package/dist/types/src/generated/resources/getExternalservicesExternalserviceschemarequest.d.ts +17 -0
  12. package/dist/types/src/generated/resources/getExternalservicesStatisticsServices.d.ts +12 -0
  13. package/dist/types/src/generated/resources/getExternalservicesStatisticsServicesByRegistrationName.d.ts +15 -0
  14. package/dist/types/src/generated/resources/postExternalservicesInferenceDatashapeByVersion.d.ts +19 -0
  15. package/dist/types/src/generated/resources/postExternalservicesInferenceOpenapispecByVersion.d.ts +19 -0
  16. package/dist/types/src/generated/resources/postExternalservicesSchemasValidationBySchemaName.d.ts +16 -0
  17. package/dist/types/src/generated/types/ApiInfoRepresentation.d.ts +38 -0
  18. package/dist/types/src/generated/types/ApiListRepresentation.d.ts +30 -0
  19. package/dist/types/src/generated/types/ApiSchemaRepresentation.d.ts +29 -0
  20. package/dist/types/src/generated/types/DataShapeInferenceOutputRepresentation.d.ts +49 -0
  21. package/dist/types/src/generated/types/ExternalServiceSchemaRequestRepresentation.d.ts +32 -0
  22. package/dist/types/src/generated/types/ExternalServiceStatisticsBreakdownRepresentation.d.ts +44 -0
  23. package/dist/types/src/generated/types/ExternalServiceStatisticsForServiceRepresentation.d.ts +42 -0
  24. package/dist/types/src/generated/types/ExternalServiceStatisticsOutputRepresentation.d.ts +37 -0
  25. package/dist/types/src/generated/types/ExternalServiceStatisticsOverviewRepresentation.d.ts +35 -0
  26. package/dist/types/src/generated/types/InferenceErrorMessageRepresentation.d.ts +32 -0
  27. package/dist/types/src/generated/types/NamedCredentialListRepresentation.d.ts +30 -0
  28. package/dist/types/src/generated/types/NamedCredentialRepresentation.d.ts +35 -0
  29. package/dist/types/src/generated/types/OpenApiSpecInferenceInputRepresentation.d.ts +57 -0
  30. package/dist/types/src/generated/types/OpenApiSpecInferenceInputWrapperRepresentation.d.ts +29 -0
  31. package/dist/types/src/generated/types/OpenApiSpecInferenceOutputRepresentation.d.ts +36 -0
  32. package/dist/types/src/generated/types/OpenApiSpecInferenceParameterRepresentation.d.ts +41 -0
  33. package/dist/types/src/generated/types/SchemaValidationInputRepresentation.d.ts +35 -0
  34. package/dist/types/src/generated/types/SchemaValidationInputWrapperRepresentation.d.ts +29 -0
  35. package/dist/types/src/generated/types/SchemaValidationMessageRepresentation.d.ts +53 -0
  36. package/dist/types/src/generated/types/SchemaValidationOutputRepresentation.d.ts +51 -0
  37. package/dist/types/src/generated/types/type-utils.d.ts +39 -0
  38. package/dist/umd/es2018/platform-external-services.js +2233 -0
  39. package/dist/umd/es5/platform-external-services.js +2245 -0
  40. package/package.json +70 -0
  41. package/sfdc/index.d.ts +1 -0
  42. package/sfdc/index.js +2284 -0
  43. package/src/raml/api.raml +485 -0
  44. package/src/raml/luvio.raml +41 -0
package/sfdc/index.js ADDED
@@ -0,0 +1,2284 @@
1
+ /**
2
+ * Copyright (c) 2022, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ /* *******************************************************************************************
8
+ * ATTENTION!
9
+ * THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
10
+ * If you would like to contribute to LDS, please follow the steps outlined in the git repo.
11
+ * Any changes made to this file in p4 will be automatically overwritten.
12
+ * *******************************************************************************************
13
+ */
14
+ /* proxy-compat-disable */
15
+ import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
16
+ import { withDefaultLuvio } from 'force/ldsEngine';
17
+ import { serializeStructuredKey, StoreKeyMap } from 'force/luvioEngine';
18
+
19
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
20
+ const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = Object;
21
+ const { isArray: ArrayIsArray$1 } = Array;
22
+ /**
23
+ * Validates an adapter config is well-formed.
24
+ * @param config The config to validate.
25
+ * @param adapter The adapter validation configuration.
26
+ * @param oneOf The keys the config must contain at least one of.
27
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
28
+ */
29
+ function validateConfig(config, adapter, oneOf) {
30
+ const { displayName } = adapter;
31
+ const { required, optional, unsupported } = adapter.parameters;
32
+ if (config === undefined ||
33
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
34
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
35
+ }
36
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
37
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
38
+ }
39
+ if (unsupported !== undefined &&
40
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
41
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
42
+ }
43
+ const supported = required.concat(optional);
44
+ if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
45
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
46
+ }
47
+ }
48
+ function untrustedIsObject(untrusted) {
49
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
50
+ }
51
+ function areRequiredParametersPresent(config, configPropertyNames) {
52
+ return configPropertyNames.parameters.required.every(req => req in config);
53
+ }
54
+ const snapshotRefreshOptions = {
55
+ overrides: {
56
+ headers: {
57
+ 'Cache-Control': 'no-cache',
58
+ },
59
+ }
60
+ };
61
+ const keyPrefix = 'external-services';
62
+
63
+ const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
64
+ const { isArray: ArrayIsArray } = Array;
65
+ const { stringify: JSONStringify } = JSON;
66
+ function equalsArray(a, b, equalsItem) {
67
+ const aLength = a.length;
68
+ const bLength = b.length;
69
+ if (aLength !== bLength) {
70
+ return false;
71
+ }
72
+ for (let i = 0; i < aLength; i++) {
73
+ if (equalsItem(a[i], b[i]) === false) {
74
+ return false;
75
+ }
76
+ }
77
+ return true;
78
+ }
79
+ function deepFreeze$2(value) {
80
+ // No need to freeze primitives
81
+ if (typeof value !== 'object' || value === null) {
82
+ return;
83
+ }
84
+ if (ArrayIsArray(value)) {
85
+ for (let i = 0, len = value.length; i < len; i += 1) {
86
+ deepFreeze$2(value[i]);
87
+ }
88
+ }
89
+ else {
90
+ const keys = ObjectKeys(value);
91
+ for (let i = 0, len = keys.length; i < len; i += 1) {
92
+ deepFreeze$2(value[keys[i]]);
93
+ }
94
+ }
95
+ ObjectFreeze(value);
96
+ }
97
+ function createLink(ref) {
98
+ return {
99
+ __ref: serializeStructuredKey(ref),
100
+ };
101
+ }
102
+
103
+ const VERSION$8 = "68601d043a553523b207d5fcc707e053";
104
+ function validate$b(obj, path = 'InferenceErrorMessageRepresentation') {
105
+ const v_error = (() => {
106
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
107
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
108
+ }
109
+ const obj_message = obj.message;
110
+ const path_message = path + '.message';
111
+ if (typeof obj_message !== 'string') {
112
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
113
+ }
114
+ const obj_severityLevel = obj.severityLevel;
115
+ const path_severityLevel = path + '.severityLevel';
116
+ if (typeof obj_severityLevel !== 'string') {
117
+ return new TypeError('Expected "string" but received "' + typeof obj_severityLevel + '" (at "' + path_severityLevel + '")');
118
+ }
119
+ })();
120
+ return v_error === undefined ? null : v_error;
121
+ }
122
+ const select$d = function InferenceErrorMessageRepresentationSelect() {
123
+ return {
124
+ kind: 'Fragment',
125
+ version: VERSION$8,
126
+ private: [],
127
+ selections: [
128
+ {
129
+ name: 'message',
130
+ kind: 'Scalar'
131
+ },
132
+ {
133
+ name: 'severityLevel',
134
+ kind: 'Scalar'
135
+ }
136
+ ]
137
+ };
138
+ };
139
+ function equals$8(existing, incoming) {
140
+ const existing_message = existing.message;
141
+ const incoming_message = incoming.message;
142
+ if (!(existing_message === incoming_message)) {
143
+ return false;
144
+ }
145
+ const existing_severityLevel = existing.severityLevel;
146
+ const incoming_severityLevel = incoming.severityLevel;
147
+ if (!(existing_severityLevel === incoming_severityLevel)) {
148
+ return false;
149
+ }
150
+ return true;
151
+ }
152
+ function deepFreeze$1(input) {
153
+ ObjectFreeze(input);
154
+ }
155
+
156
+ const VERSION$7 = "d45a6a39072862479f5c25fe921c0926";
157
+ function validate$a(obj, path = 'DataShapeInferenceOutputRepresentation') {
158
+ const v_error = (() => {
159
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
160
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
161
+ }
162
+ const obj_errorMessages = obj.errorMessages;
163
+ const path_errorMessages = path + '.errorMessages';
164
+ if (!ArrayIsArray(obj_errorMessages)) {
165
+ return new TypeError('Expected "array" but received "' + typeof obj_errorMessages + '" (at "' + path_errorMessages + '")');
166
+ }
167
+ for (let i = 0; i < obj_errorMessages.length; i++) {
168
+ const obj_errorMessages_item = obj_errorMessages[i];
169
+ const path_errorMessages_item = path_errorMessages + '[' + i + ']';
170
+ const referencepath_errorMessages_itemValidationError = validate$b(obj_errorMessages_item, path_errorMessages_item);
171
+ if (referencepath_errorMessages_itemValidationError !== null) {
172
+ let message = 'Object doesn\'t match InferenceErrorMessageRepresentation (at "' + path_errorMessages_item + '")\n';
173
+ message += referencepath_errorMessages_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
174
+ return new TypeError(message);
175
+ }
176
+ }
177
+ if (obj.example !== undefined) {
178
+ const obj_example = obj.example;
179
+ const path_example = path + '.example';
180
+ if (typeof obj_example !== 'string') {
181
+ return new TypeError('Expected "string" but received "' + typeof obj_example + '" (at "' + path_example + '")');
182
+ }
183
+ }
184
+ const obj_items = obj.items;
185
+ const path_items = path + '.items';
186
+ if (!ArrayIsArray(obj_items)) {
187
+ return new TypeError('Expected "array" but received "' + typeof obj_items + '" (at "' + path_items + '")');
188
+ }
189
+ for (let i = 0; i < obj_items.length; i++) {
190
+ const obj_items_item = obj_items[i];
191
+ const path_items_item = path_items + '[' + i + ']';
192
+ const referencepath_items_itemValidationError = validate$a(obj_items_item, path_items_item);
193
+ if (referencepath_items_itemValidationError !== null) {
194
+ let message = 'Object doesn\'t match DataShapeInferenceOutputRepresentation (at "' + path_items_item + '")\n';
195
+ message += referencepath_items_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
196
+ return new TypeError(message);
197
+ }
198
+ }
199
+ const obj_properties = obj.properties;
200
+ const path_properties = path + '.properties';
201
+ if (typeof obj_properties !== 'object' || ArrayIsArray(obj_properties) || obj_properties === null) {
202
+ return new TypeError('Expected "object" but received "' + typeof obj_properties + '" (at "' + path_properties + '")');
203
+ }
204
+ const obj_properties_keys = ObjectKeys(obj_properties);
205
+ for (let i = 0; i < obj_properties_keys.length; i++) {
206
+ const key = obj_properties_keys[i];
207
+ const obj_properties_prop = obj_properties[key];
208
+ const path_properties_prop = path_properties + '["' + key + '"]';
209
+ const referencepath_properties_propValidationError = validate$a(obj_properties_prop, path_properties_prop);
210
+ if (referencepath_properties_propValidationError !== null) {
211
+ let message = 'Object doesn\'t match DataShapeInferenceOutputRepresentation (at "' + path_properties_prop + '")\n';
212
+ message += referencepath_properties_propValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
213
+ return new TypeError(message);
214
+ }
215
+ }
216
+ const obj_success = obj.success;
217
+ const path_success = path + '.success';
218
+ if (typeof obj_success !== 'boolean') {
219
+ return new TypeError('Expected "boolean" but received "' + typeof obj_success + '" (at "' + path_success + '")');
220
+ }
221
+ if (obj.type !== undefined) {
222
+ const obj_type = obj.type;
223
+ const path_type = path + '.type';
224
+ if (typeof obj_type !== 'string') {
225
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
226
+ }
227
+ }
228
+ })();
229
+ return v_error === undefined ? null : v_error;
230
+ }
231
+ const RepresentationType$3 = 'DataShapeInferenceOutputRepresentation';
232
+ function normalize$3(input, existing, path, luvio, store, timestamp) {
233
+ return input;
234
+ }
235
+ const select$c = function DataShapeInferenceOutputRepresentationSelect() {
236
+ return {
237
+ kind: 'Fragment',
238
+ version: VERSION$7,
239
+ private: [],
240
+ opaque: true
241
+ };
242
+ };
243
+ function equals$7(existing, incoming) {
244
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
245
+ return false;
246
+ }
247
+ return true;
248
+ }
249
+ function deepFreeze(input) {
250
+ const input_errorMessages = input.errorMessages;
251
+ for (let i = 0; i < input_errorMessages.length; i++) {
252
+ const input_errorMessages_item = input_errorMessages[i];
253
+ deepFreeze$1(input_errorMessages_item);
254
+ }
255
+ ObjectFreeze(input_errorMessages);
256
+ const input_items = input.items;
257
+ for (let i = 0; i < input_items.length; i++) {
258
+ const input_items_item = input_items[i];
259
+ deepFreeze(input_items_item);
260
+ }
261
+ ObjectFreeze(input_items);
262
+ const input_properties = input.properties;
263
+ const input_properties_keys = Object.keys(input_properties);
264
+ const input_properties_length = input_properties_keys.length;
265
+ for (let i = 0; i < input_properties_length; i++) {
266
+ const key = input_properties_keys[i];
267
+ const input_properties_prop = input_properties[key];
268
+ deepFreeze(input_properties_prop);
269
+ }
270
+ ObjectFreeze(input_properties);
271
+ ObjectFreeze(input);
272
+ }
273
+ const ingest$3 = function DataShapeInferenceOutputRepresentationIngest(input, path, luvio, store, timestamp) {
274
+ if (process.env.NODE_ENV !== 'production') {
275
+ const validateError = validate$a(input);
276
+ if (validateError !== null) {
277
+ throw validateError;
278
+ }
279
+ }
280
+ const key = path.fullPath;
281
+ const existingRecord = store.readEntry(key);
282
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 300000;
283
+ let incomingRecord = normalize$3(input, store.readEntry(key), {
284
+ fullPath: key,
285
+ parent: path.parent,
286
+ propertyName: path.propertyName,
287
+ ttl: ttlToUse
288
+ });
289
+ deepFreeze(input);
290
+ if (existingRecord === undefined || equals$7(existingRecord, incomingRecord) === false) {
291
+ luvio.storePublish(key, incomingRecord);
292
+ }
293
+ if (ttlToUse !== undefined) {
294
+ const storeMetadataParams = {
295
+ ttl: ttlToUse,
296
+ namespace: "external-services",
297
+ version: VERSION$7,
298
+ representationName: RepresentationType$3,
299
+ };
300
+ luvio.publishStoreMetadata(key, storeMetadataParams);
301
+ }
302
+ return createLink(key);
303
+ };
304
+ function getTypeCacheKeys$3(luvio, input, fullPathFactory) {
305
+ const rootKeySet = new StoreKeyMap();
306
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
307
+ const rootKey = fullPathFactory();
308
+ rootKeySet.set(rootKey, {
309
+ namespace: keyPrefix,
310
+ representationName: RepresentationType$3,
311
+ mergeable: false
312
+ });
313
+ return rootKeySet;
314
+ }
315
+
316
+ function select$b(luvio, params) {
317
+ return select$c();
318
+ }
319
+ function keyBuilder$8(luvio, params) {
320
+ return keyPrefix + '::DataShapeInferenceOutputRepresentation:(' + 'exampleData:' + params.queryParams.exampleData + ',' + 'mediaType:' + params.queryParams.mediaType + ',' + 'version:' + params.urlParams.version + ')';
321
+ }
322
+ function getResponseCacheKeys$4(luvio, resourceParams, response) {
323
+ return getTypeCacheKeys$3(luvio, response, () => keyBuilder$8(luvio, resourceParams));
324
+ }
325
+ function ingestSuccess$4(luvio, resourceParams, response, snapshotRefresh) {
326
+ const { body } = response;
327
+ const key = keyBuilder$8(luvio, resourceParams);
328
+ luvio.storeIngest(key, ingest$3, body);
329
+ const snapshot = luvio.storeLookup({
330
+ recordId: key,
331
+ node: select$b(),
332
+ variables: {},
333
+ }, snapshotRefresh);
334
+ if (process.env.NODE_ENV !== 'production') {
335
+ if (snapshot.state !== 'Fulfilled') {
336
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
337
+ }
338
+ }
339
+ return snapshot;
340
+ }
341
+ function ingestError$3(luvio, params, error, snapshotRefresh) {
342
+ const key = keyBuilder$8(luvio, params);
343
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
344
+ luvio.storeIngestError(key, errorSnapshot);
345
+ return errorSnapshot;
346
+ }
347
+ function createResourceRequest$4(config) {
348
+ const headers = {};
349
+ return {
350
+ baseUri: '/services/data/v58.0',
351
+ basePath: '/externalservices/inference/datashape/' + config.urlParams.version + '',
352
+ method: 'post',
353
+ body: null,
354
+ urlParams: config.urlParams,
355
+ queryParams: config.queryParams,
356
+ headers,
357
+ priority: 'normal',
358
+ };
359
+ }
360
+
361
+ const getDataShape_ConfigPropertyNames = {
362
+ displayName: 'getDataShape',
363
+ parameters: {
364
+ required: ['version'],
365
+ optional: ['exampleData', 'mediaType']
366
+ }
367
+ };
368
+ function createResourceParams$4(config) {
369
+ const resourceParams = {
370
+ urlParams: {
371
+ version: config.version
372
+ },
373
+ queryParams: {
374
+ exampleData: config.exampleData, mediaType: config.mediaType
375
+ }
376
+ };
377
+ return resourceParams;
378
+ }
379
+ function keyBuilder$7(luvio, config) {
380
+ const resourceParams = createResourceParams$4(config);
381
+ return keyBuilder$8(luvio, resourceParams);
382
+ }
383
+ function typeCheckConfig$4(untrustedConfig) {
384
+ const config = {};
385
+ const untrustedConfig_version = untrustedConfig.version;
386
+ if (typeof untrustedConfig_version === 'string') {
387
+ config.version = untrustedConfig_version;
388
+ }
389
+ const untrustedConfig_exampleData = untrustedConfig.exampleData;
390
+ if (typeof untrustedConfig_exampleData === 'string') {
391
+ config.exampleData = untrustedConfig_exampleData;
392
+ }
393
+ const untrustedConfig_mediaType = untrustedConfig.mediaType;
394
+ if (typeof untrustedConfig_mediaType === 'string') {
395
+ config.mediaType = untrustedConfig_mediaType;
396
+ }
397
+ return config;
398
+ }
399
+ function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
400
+ if (!untrustedIsObject(untrustedConfig)) {
401
+ return null;
402
+ }
403
+ if (process.env.NODE_ENV !== 'production') {
404
+ validateConfig(untrustedConfig, configPropertyNames);
405
+ }
406
+ const config = typeCheckConfig$4(untrustedConfig);
407
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
408
+ return null;
409
+ }
410
+ return config;
411
+ }
412
+ function adapterFragment$3(luvio, config) {
413
+ createResourceParams$4(config);
414
+ return select$b();
415
+ }
416
+ function onFetchResponseSuccess$3(luvio, config, resourceParams, response) {
417
+ const snapshot = ingestSuccess$4(luvio, resourceParams, response, {
418
+ config,
419
+ resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
420
+ });
421
+ return luvio.storeBroadcast().then(() => snapshot);
422
+ }
423
+ function onFetchResponseError$3(luvio, config, resourceParams, response) {
424
+ const snapshot = ingestError$3(luvio, resourceParams, response, {
425
+ config,
426
+ resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
427
+ });
428
+ return luvio.storeBroadcast().then(() => snapshot);
429
+ }
430
+ function buildNetworkSnapshot$4(luvio, config, options) {
431
+ const resourceParams = createResourceParams$4(config);
432
+ const request = createResourceRequest$4(resourceParams);
433
+ return luvio.dispatchResourceRequest(request, options)
434
+ .then((response) => {
435
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$3(luvio, config, resourceParams, response), () => getResponseCacheKeys$4(luvio, resourceParams, response.body));
436
+ }, (response) => {
437
+ return luvio.handleErrorResponse(() => onFetchResponseError$3(luvio, config, resourceParams, response));
438
+ });
439
+ }
440
+ function buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext) {
441
+ const { luvio, config } = context;
442
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
443
+ const dispatchOptions = {
444
+ resourceRequestContext: {
445
+ requestCorrelator,
446
+ luvioRequestMethod: 'get',
447
+ },
448
+ eventObservers
449
+ };
450
+ if (networkPriority !== 'normal') {
451
+ dispatchOptions.overrides = {
452
+ priority: networkPriority
453
+ };
454
+ }
455
+ return buildNetworkSnapshot$4(luvio, config, dispatchOptions);
456
+ }
457
+ function buildCachedSnapshotCachePolicy$3(context, storeLookup) {
458
+ const { luvio, config } = context;
459
+ const selector = {
460
+ recordId: keyBuilder$7(luvio, config),
461
+ node: adapterFragment$3(luvio, config),
462
+ variables: {},
463
+ };
464
+ const cacheSnapshot = storeLookup(selector, {
465
+ config,
466
+ resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
467
+ });
468
+ return cacheSnapshot;
469
+ }
470
+ const getDataShapeAdapterFactory = (luvio) => function externalServices__getDataShape(untrustedConfig, requestContext) {
471
+ const config = validateAdapterConfig$4(untrustedConfig, getDataShape_ConfigPropertyNames);
472
+ // Invalid or incomplete config
473
+ if (config === null) {
474
+ return null;
475
+ }
476
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
477
+ buildCachedSnapshotCachePolicy$3, buildNetworkSnapshotCachePolicy$3);
478
+ };
479
+
480
+ function validate$9(obj, path = 'OpenApiSpecInferenceParameterRepresentation') {
481
+ const v_error = (() => {
482
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
483
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
484
+ }
485
+ if (obj.description !== undefined) {
486
+ const obj_description = obj.description;
487
+ const path_description = path + '.description';
488
+ if (typeof obj_description !== 'string') {
489
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
490
+ }
491
+ }
492
+ const obj_location = obj.location;
493
+ const path_location = path + '.location';
494
+ if (typeof obj_location !== 'string') {
495
+ return new TypeError('Expected "string" but received "' + typeof obj_location + '" (at "' + path_location + '")');
496
+ }
497
+ const obj_name = obj.name;
498
+ const path_name = path + '.name';
499
+ if (typeof obj_name !== 'string') {
500
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
501
+ }
502
+ const obj_required = obj.required;
503
+ const path_required = path + '.required';
504
+ if (typeof obj_required !== 'boolean') {
505
+ return new TypeError('Expected "boolean" but received "' + typeof obj_required + '" (at "' + path_required + '")');
506
+ }
507
+ const obj_type = obj.type;
508
+ const path_type = path + '.type';
509
+ if (typeof obj_type !== 'string') {
510
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
511
+ }
512
+ })();
513
+ return v_error === undefined ? null : v_error;
514
+ }
515
+
516
+ function validate$8(obj, path = 'OpenApiSpecInferenceInputRepresentation') {
517
+ const v_error = (() => {
518
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
519
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
520
+ }
521
+ const obj_description = obj.description;
522
+ const path_description = path + '.description';
523
+ if (typeof obj_description !== 'string') {
524
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
525
+ }
526
+ if (obj.externalServiceId !== undefined) {
527
+ const obj_externalServiceId = obj.externalServiceId;
528
+ const path_externalServiceId = path + '.externalServiceId';
529
+ if (typeof obj_externalServiceId !== 'string') {
530
+ return new TypeError('Expected "string" but received "' + typeof obj_externalServiceId + '" (at "' + path_externalServiceId + '")');
531
+ }
532
+ }
533
+ const obj_method = obj.method;
534
+ const path_method = path + '.method';
535
+ if (typeof obj_method !== 'string') {
536
+ return new TypeError('Expected "string" but received "' + typeof obj_method + '" (at "' + path_method + '")');
537
+ }
538
+ const obj_name = obj.name;
539
+ const path_name = path + '.name';
540
+ if (typeof obj_name !== 'string') {
541
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
542
+ }
543
+ const obj_operationDescription = obj.operationDescription;
544
+ const path_operationDescription = path + '.operationDescription';
545
+ if (typeof obj_operationDescription !== 'string') {
546
+ return new TypeError('Expected "string" but received "' + typeof obj_operationDescription + '" (at "' + path_operationDescription + '")');
547
+ }
548
+ const obj_operationName = obj.operationName;
549
+ const path_operationName = path + '.operationName';
550
+ if (typeof obj_operationName !== 'string') {
551
+ return new TypeError('Expected "string" but received "' + typeof obj_operationName + '" (at "' + path_operationName + '")');
552
+ }
553
+ const obj_parameters = obj.parameters;
554
+ const path_parameters = path + '.parameters';
555
+ if (!ArrayIsArray(obj_parameters)) {
556
+ return new TypeError('Expected "array" but received "' + typeof obj_parameters + '" (at "' + path_parameters + '")');
557
+ }
558
+ for (let i = 0; i < obj_parameters.length; i++) {
559
+ const obj_parameters_item = obj_parameters[i];
560
+ const path_parameters_item = path_parameters + '[' + i + ']';
561
+ const referencepath_parameters_itemValidationError = validate$9(obj_parameters_item, path_parameters_item);
562
+ if (referencepath_parameters_itemValidationError !== null) {
563
+ let message = 'Object doesn\'t match OpenApiSpecInferenceParameterRepresentation (at "' + path_parameters_item + '")\n';
564
+ message += referencepath_parameters_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
565
+ return new TypeError(message);
566
+ }
567
+ }
568
+ const obj_path = obj.path;
569
+ const path_path = path + '.path';
570
+ if (typeof obj_path !== 'string') {
571
+ return new TypeError('Expected "string" but received "' + typeof obj_path + '" (at "' + path_path + '")');
572
+ }
573
+ if (obj.requestBody !== undefined) {
574
+ const obj_requestBody = obj.requestBody;
575
+ const path_requestBody = path + '.requestBody';
576
+ if (typeof obj_requestBody !== 'object' || ArrayIsArray(obj_requestBody) || obj_requestBody === null) {
577
+ return new TypeError('Expected "object" but received "' + typeof obj_requestBody + '" (at "' + path_requestBody + '")');
578
+ }
579
+ }
580
+ const obj_responseBody = obj.responseBody;
581
+ const path_responseBody = path + '.responseBody';
582
+ if (typeof obj_responseBody !== 'object' || ArrayIsArray(obj_responseBody) || obj_responseBody === null) {
583
+ return new TypeError('Expected "object" but received "' + typeof obj_responseBody + '" (at "' + path_responseBody + '")');
584
+ }
585
+ })();
586
+ return v_error === undefined ? null : v_error;
587
+ }
588
+
589
+ const VERSION$6 = "9f5779e32b8c9e02976609db89831dbb";
590
+ function validate$7(obj, path = 'OpenApiSpecInferenceOutputRepresentation') {
591
+ const v_error = (() => {
592
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
593
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
594
+ }
595
+ const obj_errorMessages = obj.errorMessages;
596
+ const path_errorMessages = path + '.errorMessages';
597
+ if (!ArrayIsArray(obj_errorMessages)) {
598
+ return new TypeError('Expected "array" but received "' + typeof obj_errorMessages + '" (at "' + path_errorMessages + '")');
599
+ }
600
+ for (let i = 0; i < obj_errorMessages.length; i++) {
601
+ const obj_errorMessages_item = obj_errorMessages[i];
602
+ const path_errorMessages_item = path_errorMessages + '[' + i + ']';
603
+ const referencepath_errorMessages_itemValidationError = validate$b(obj_errorMessages_item, path_errorMessages_item);
604
+ if (referencepath_errorMessages_itemValidationError !== null) {
605
+ let message = 'Object doesn\'t match InferenceErrorMessageRepresentation (at "' + path_errorMessages_item + '")\n';
606
+ message += referencepath_errorMessages_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
607
+ return new TypeError(message);
608
+ }
609
+ }
610
+ const obj_schema = obj.schema;
611
+ const path_schema = path + '.schema';
612
+ if (typeof obj_schema !== 'string') {
613
+ return new TypeError('Expected "string" but received "' + typeof obj_schema + '" (at "' + path_schema + '")');
614
+ }
615
+ const obj_success = obj.success;
616
+ const path_success = path + '.success';
617
+ if (typeof obj_success !== 'boolean') {
618
+ return new TypeError('Expected "boolean" but received "' + typeof obj_success + '" (at "' + path_success + '")');
619
+ }
620
+ })();
621
+ return v_error === undefined ? null : v_error;
622
+ }
623
+ const RepresentationType$2 = 'OpenApiSpecInferenceOutputRepresentation';
624
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
625
+ return input;
626
+ }
627
+ const select$a = function OpenApiSpecInferenceOutputRepresentationSelect() {
628
+ const { selections: InferenceErrorMessageRepresentation__selections, opaque: InferenceErrorMessageRepresentation__opaque, } = select$d();
629
+ return {
630
+ kind: 'Fragment',
631
+ version: VERSION$6,
632
+ private: [],
633
+ selections: [
634
+ {
635
+ name: 'errorMessages',
636
+ kind: 'Object',
637
+ plural: true,
638
+ selections: InferenceErrorMessageRepresentation__selections
639
+ },
640
+ {
641
+ name: 'schema',
642
+ kind: 'Scalar'
643
+ },
644
+ {
645
+ name: 'success',
646
+ kind: 'Scalar'
647
+ }
648
+ ]
649
+ };
650
+ };
651
+ function equals$6(existing, incoming) {
652
+ const existing_success = existing.success;
653
+ const incoming_success = incoming.success;
654
+ if (!(existing_success === incoming_success)) {
655
+ return false;
656
+ }
657
+ const existing_schema = existing.schema;
658
+ const incoming_schema = incoming.schema;
659
+ if (!(existing_schema === incoming_schema)) {
660
+ return false;
661
+ }
662
+ const existing_errorMessages = existing.errorMessages;
663
+ const incoming_errorMessages = incoming.errorMessages;
664
+ const equals_errorMessages_items = equalsArray(existing_errorMessages, incoming_errorMessages, (existing_errorMessages_item, incoming_errorMessages_item) => {
665
+ if (!(equals$8(existing_errorMessages_item, incoming_errorMessages_item))) {
666
+ return false;
667
+ }
668
+ });
669
+ if (equals_errorMessages_items === false) {
670
+ return false;
671
+ }
672
+ return true;
673
+ }
674
+ const ingest$2 = function OpenApiSpecInferenceOutputRepresentationIngest(input, path, luvio, store, timestamp) {
675
+ if (process.env.NODE_ENV !== 'production') {
676
+ const validateError = validate$7(input);
677
+ if (validateError !== null) {
678
+ throw validateError;
679
+ }
680
+ }
681
+ const key = path.fullPath;
682
+ const existingRecord = store.readEntry(key);
683
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 300000;
684
+ let incomingRecord = normalize$2(input, store.readEntry(key), {
685
+ fullPath: key,
686
+ parent: path.parent,
687
+ propertyName: path.propertyName,
688
+ ttl: ttlToUse
689
+ });
690
+ if (existingRecord === undefined || equals$6(existingRecord, incomingRecord) === false) {
691
+ luvio.storePublish(key, incomingRecord);
692
+ }
693
+ if (ttlToUse !== undefined) {
694
+ const storeMetadataParams = {
695
+ ttl: ttlToUse,
696
+ namespace: "external-services",
697
+ version: VERSION$6,
698
+ representationName: RepresentationType$2,
699
+ };
700
+ luvio.publishStoreMetadata(key, storeMetadataParams);
701
+ }
702
+ return createLink(key);
703
+ };
704
+ function getTypeCacheKeys$2(luvio, input, fullPathFactory) {
705
+ const rootKeySet = new StoreKeyMap();
706
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
707
+ const rootKey = fullPathFactory();
708
+ rootKeySet.set(rootKey, {
709
+ namespace: keyPrefix,
710
+ representationName: RepresentationType$2,
711
+ mergeable: false
712
+ });
713
+ return rootKeySet;
714
+ }
715
+
716
+ function select$9(luvio, params) {
717
+ return select$a();
718
+ }
719
+ function keyBuilder$6(luvio, params) {
720
+ return keyPrefix + '::OpenApiSpecInferenceOutputRepresentation:(' + 'version:' + params.urlParams.version + ',' + 'input.description:' + params.body.input.description + '::' + (params.body.input.externalServiceId === undefined ? 'input.externalServiceId' : 'input.externalServiceId:' + params.body.input.externalServiceId) + '::' + 'input.method:' + params.body.input.method + '::' + 'input.name:' + params.body.input.name + '::' + 'input.operationDescription:' + params.body.input.operationDescription + '::' + 'input.operationName:' + params.body.input.operationName + '::' + 'input.parameters:' + params.body.input.parameters + '::' + 'input.path:' + params.body.input.path + '::' + +'::' + +')';
721
+ }
722
+ function getResponseCacheKeys$3(luvio, resourceParams, response) {
723
+ return getTypeCacheKeys$2(luvio, response, () => keyBuilder$6(luvio, resourceParams));
724
+ }
725
+ function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
726
+ const { body } = response;
727
+ const key = keyBuilder$6(luvio, resourceParams);
728
+ luvio.storeIngest(key, ingest$2, body);
729
+ const snapshot = luvio.storeLookup({
730
+ recordId: key,
731
+ node: select$9(),
732
+ variables: {},
733
+ }, snapshotRefresh);
734
+ if (process.env.NODE_ENV !== 'production') {
735
+ if (snapshot.state !== 'Fulfilled') {
736
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
737
+ }
738
+ }
739
+ return snapshot;
740
+ }
741
+ function ingestError$2(luvio, params, error, snapshotRefresh) {
742
+ const key = keyBuilder$6(luvio, params);
743
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
744
+ luvio.storeIngestError(key, errorSnapshot);
745
+ return errorSnapshot;
746
+ }
747
+ function createResourceRequest$3(config) {
748
+ const headers = {};
749
+ return {
750
+ baseUri: '/services/data/v58.0',
751
+ basePath: '/externalservices/inference/openapispec/' + config.urlParams.version + '',
752
+ method: 'post',
753
+ body: config.body,
754
+ urlParams: config.urlParams,
755
+ queryParams: {},
756
+ headers,
757
+ priority: 'normal',
758
+ };
759
+ }
760
+
761
+ const getOpenApiSpec_ConfigPropertyNames = {
762
+ displayName: 'getOpenApiSpec',
763
+ parameters: {
764
+ required: ['version', 'input'],
765
+ optional: []
766
+ }
767
+ };
768
+ function createResourceParams$3(config) {
769
+ const resourceParams = {
770
+ urlParams: {
771
+ version: config.version
772
+ },
773
+ body: {
774
+ input: config.input
775
+ }
776
+ };
777
+ return resourceParams;
778
+ }
779
+ function keyBuilder$5(luvio, config) {
780
+ const resourceParams = createResourceParams$3(config);
781
+ return keyBuilder$6(luvio, resourceParams);
782
+ }
783
+ function typeCheckConfig$3(untrustedConfig) {
784
+ const config = {};
785
+ const untrustedConfig_version = untrustedConfig.version;
786
+ if (typeof untrustedConfig_version === 'string') {
787
+ config.version = untrustedConfig_version;
788
+ }
789
+ const untrustedConfig_input = untrustedConfig.input;
790
+ const referenceOpenApiSpecInferenceInputRepresentationValidationError = validate$8(untrustedConfig_input);
791
+ if (referenceOpenApiSpecInferenceInputRepresentationValidationError === null) {
792
+ config.input = untrustedConfig_input;
793
+ }
794
+ return config;
795
+ }
796
+ function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
797
+ if (!untrustedIsObject(untrustedConfig)) {
798
+ return null;
799
+ }
800
+ if (process.env.NODE_ENV !== 'production') {
801
+ validateConfig(untrustedConfig, configPropertyNames);
802
+ }
803
+ const config = typeCheckConfig$3(untrustedConfig);
804
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
805
+ return null;
806
+ }
807
+ return config;
808
+ }
809
+ function adapterFragment$2(luvio, config) {
810
+ createResourceParams$3(config);
811
+ return select$9();
812
+ }
813
+ function onFetchResponseSuccess$2(luvio, config, resourceParams, response) {
814
+ const snapshot = ingestSuccess$3(luvio, resourceParams, response, {
815
+ config,
816
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
817
+ });
818
+ return luvio.storeBroadcast().then(() => snapshot);
819
+ }
820
+ function onFetchResponseError$2(luvio, config, resourceParams, response) {
821
+ const snapshot = ingestError$2(luvio, resourceParams, response, {
822
+ config,
823
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
824
+ });
825
+ return luvio.storeBroadcast().then(() => snapshot);
826
+ }
827
+ function buildNetworkSnapshot$3(luvio, config, options) {
828
+ const resourceParams = createResourceParams$3(config);
829
+ const request = createResourceRequest$3(resourceParams);
830
+ return luvio.dispatchResourceRequest(request, options)
831
+ .then((response) => {
832
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$2(luvio, config, resourceParams, response), () => getResponseCacheKeys$3(luvio, resourceParams, response.body));
833
+ }, (response) => {
834
+ return luvio.handleErrorResponse(() => onFetchResponseError$2(luvio, config, resourceParams, response));
835
+ });
836
+ }
837
+ function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
838
+ const { luvio, config } = context;
839
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
840
+ const dispatchOptions = {
841
+ resourceRequestContext: {
842
+ requestCorrelator,
843
+ luvioRequestMethod: 'get',
844
+ },
845
+ eventObservers
846
+ };
847
+ if (networkPriority !== 'normal') {
848
+ dispatchOptions.overrides = {
849
+ priority: networkPriority
850
+ };
851
+ }
852
+ return buildNetworkSnapshot$3(luvio, config, dispatchOptions);
853
+ }
854
+ function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
855
+ const { luvio, config } = context;
856
+ const selector = {
857
+ recordId: keyBuilder$5(luvio, config),
858
+ node: adapterFragment$2(luvio, config),
859
+ variables: {},
860
+ };
861
+ const cacheSnapshot = storeLookup(selector, {
862
+ config,
863
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
864
+ });
865
+ return cacheSnapshot;
866
+ }
867
+ const getOpenApiSpecAdapterFactory = (luvio) => function externalServices__getOpenApiSpec(untrustedConfig, requestContext) {
868
+ const config = validateAdapterConfig$3(untrustedConfig, getOpenApiSpec_ConfigPropertyNames);
869
+ // Invalid or incomplete config
870
+ if (config === null) {
871
+ return null;
872
+ }
873
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
874
+ buildCachedSnapshotCachePolicy$2, buildNetworkSnapshotCachePolicy$2);
875
+ };
876
+
877
+ const VERSION$5 = "7dd4168caef7cc755bcbcb7dddf11b57";
878
+ function validate$6(obj, path = 'ExternalServiceStatisticsBreakdownRepresentation') {
879
+ const v_error = (() => {
880
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
881
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
882
+ }
883
+ const obj_active = obj.active;
884
+ const path_active = path + '.active';
885
+ if (typeof obj_active !== 'boolean') {
886
+ return new TypeError('Expected "boolean" but received "' + typeof obj_active + '" (at "' + path_active + '")');
887
+ }
888
+ const obj_activeCount = obj.activeCount;
889
+ const path_activeCount = path + '.activeCount';
890
+ if (typeof obj_activeCount !== 'number' || (typeof obj_activeCount === 'number' && Math.floor(obj_activeCount) !== obj_activeCount)) {
891
+ return new TypeError('Expected "integer" but received "' + typeof obj_activeCount + '" (at "' + path_activeCount + '")');
892
+ }
893
+ const obj_component = obj.component;
894
+ const path_component = path + '.component';
895
+ if (typeof obj_component !== 'string') {
896
+ return new TypeError('Expected "string" but received "' + typeof obj_component + '" (at "' + path_component + '")');
897
+ }
898
+ const obj_componentType = obj.componentType;
899
+ const path_componentType = path + '.componentType';
900
+ if (typeof obj_componentType !== 'string') {
901
+ return new TypeError('Expected "string" but received "' + typeof obj_componentType + '" (at "' + path_componentType + '")');
902
+ }
903
+ const obj_statisticFor = obj.statisticFor;
904
+ const path_statisticFor = path + '.statisticFor';
905
+ if (typeof obj_statisticFor !== 'string') {
906
+ return new TypeError('Expected "string" but received "' + typeof obj_statisticFor + '" (at "' + path_statisticFor + '")');
907
+ }
908
+ const obj_totalCount = obj.totalCount;
909
+ const path_totalCount = path + '.totalCount';
910
+ if (typeof obj_totalCount !== 'number' || (typeof obj_totalCount === 'number' && Math.floor(obj_totalCount) !== obj_totalCount)) {
911
+ return new TypeError('Expected "integer" but received "' + typeof obj_totalCount + '" (at "' + path_totalCount + '")');
912
+ }
913
+ })();
914
+ return v_error === undefined ? null : v_error;
915
+ }
916
+ const select$8 = function ExternalServiceStatisticsBreakdownRepresentationSelect() {
917
+ return {
918
+ kind: 'Fragment',
919
+ version: VERSION$5,
920
+ private: [],
921
+ selections: [
922
+ {
923
+ name: 'active',
924
+ kind: 'Scalar'
925
+ },
926
+ {
927
+ name: 'activeCount',
928
+ kind: 'Scalar'
929
+ },
930
+ {
931
+ name: 'component',
932
+ kind: 'Scalar'
933
+ },
934
+ {
935
+ name: 'componentType',
936
+ kind: 'Scalar'
937
+ },
938
+ {
939
+ name: 'statisticFor',
940
+ kind: 'Scalar'
941
+ },
942
+ {
943
+ name: 'totalCount',
944
+ kind: 'Scalar'
945
+ }
946
+ ]
947
+ };
948
+ };
949
+ function equals$5(existing, incoming) {
950
+ const existing_active = existing.active;
951
+ const incoming_active = incoming.active;
952
+ if (!(existing_active === incoming_active)) {
953
+ return false;
954
+ }
955
+ const existing_activeCount = existing.activeCount;
956
+ const incoming_activeCount = incoming.activeCount;
957
+ if (!(existing_activeCount === incoming_activeCount)) {
958
+ return false;
959
+ }
960
+ const existing_totalCount = existing.totalCount;
961
+ const incoming_totalCount = incoming.totalCount;
962
+ if (!(existing_totalCount === incoming_totalCount)) {
963
+ return false;
964
+ }
965
+ const existing_component = existing.component;
966
+ const incoming_component = incoming.component;
967
+ if (!(existing_component === incoming_component)) {
968
+ return false;
969
+ }
970
+ const existing_componentType = existing.componentType;
971
+ const incoming_componentType = incoming.componentType;
972
+ if (!(existing_componentType === incoming_componentType)) {
973
+ return false;
974
+ }
975
+ const existing_statisticFor = existing.statisticFor;
976
+ const incoming_statisticFor = incoming.statisticFor;
977
+ if (!(existing_statisticFor === incoming_statisticFor)) {
978
+ return false;
979
+ }
980
+ return true;
981
+ }
982
+
983
+ const VERSION$4 = "6bd958289eba0fb66f626c73737f8c00";
984
+ function validate$5(obj, path = 'ExternalServiceStatisticsForServiceRepresentation') {
985
+ const v_error = (() => {
986
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
987
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
988
+ }
989
+ const obj_schemaSize = obj.schemaSize;
990
+ const path_schemaSize = path + '.schemaSize';
991
+ if (typeof obj_schemaSize !== 'number' || (typeof obj_schemaSize === 'number' && Math.floor(obj_schemaSize) !== obj_schemaSize)) {
992
+ return new TypeError('Expected "integer" but received "' + typeof obj_schemaSize + '" (at "' + path_schemaSize + '")');
993
+ }
994
+ const obj_schemaType = obj.schemaType;
995
+ const path_schemaType = path + '.schemaType';
996
+ if (typeof obj_schemaType !== 'string') {
997
+ return new TypeError('Expected "string" but received "' + typeof obj_schemaType + '" (at "' + path_schemaType + '")');
998
+ }
999
+ const obj_serviceName = obj.serviceName;
1000
+ const path_serviceName = path + '.serviceName';
1001
+ if (typeof obj_serviceName !== 'string') {
1002
+ return new TypeError('Expected "string" but received "' + typeof obj_serviceName + '" (at "' + path_serviceName + '")');
1003
+ }
1004
+ const obj_statistics = obj.statistics;
1005
+ const path_statistics = path + '.statistics';
1006
+ if (!ArrayIsArray(obj_statistics)) {
1007
+ return new TypeError('Expected "array" but received "' + typeof obj_statistics + '" (at "' + path_statistics + '")');
1008
+ }
1009
+ for (let i = 0; i < obj_statistics.length; i++) {
1010
+ const obj_statistics_item = obj_statistics[i];
1011
+ const path_statistics_item = path_statistics + '[' + i + ']';
1012
+ const referencepath_statistics_itemValidationError = validate$6(obj_statistics_item, path_statistics_item);
1013
+ if (referencepath_statistics_itemValidationError !== null) {
1014
+ let message = 'Object doesn\'t match ExternalServiceStatisticsBreakdownRepresentation (at "' + path_statistics_item + '")\n';
1015
+ message += referencepath_statistics_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1016
+ return new TypeError(message);
1017
+ }
1018
+ }
1019
+ const obj_systemVersion = obj.systemVersion;
1020
+ const path_systemVersion = path + '.systemVersion';
1021
+ if (typeof obj_systemVersion !== 'number' || (typeof obj_systemVersion === 'number' && Math.floor(obj_systemVersion) !== obj_systemVersion)) {
1022
+ return new TypeError('Expected "integer" but received "' + typeof obj_systemVersion + '" (at "' + path_systemVersion + '")');
1023
+ }
1024
+ })();
1025
+ return v_error === undefined ? null : v_error;
1026
+ }
1027
+ const select$7 = function ExternalServiceStatisticsForServiceRepresentationSelect() {
1028
+ const { selections: ExternalServiceStatisticsBreakdownRepresentation__selections, opaque: ExternalServiceStatisticsBreakdownRepresentation__opaque, } = select$8();
1029
+ return {
1030
+ kind: 'Fragment',
1031
+ version: VERSION$4,
1032
+ private: [],
1033
+ selections: [
1034
+ {
1035
+ name: 'schemaSize',
1036
+ kind: 'Scalar'
1037
+ },
1038
+ {
1039
+ name: 'schemaType',
1040
+ kind: 'Scalar'
1041
+ },
1042
+ {
1043
+ name: 'serviceName',
1044
+ kind: 'Scalar'
1045
+ },
1046
+ {
1047
+ name: 'statistics',
1048
+ kind: 'Object',
1049
+ plural: true,
1050
+ selections: ExternalServiceStatisticsBreakdownRepresentation__selections
1051
+ },
1052
+ {
1053
+ name: 'systemVersion',
1054
+ kind: 'Scalar'
1055
+ }
1056
+ ]
1057
+ };
1058
+ };
1059
+ function equals$4(existing, incoming) {
1060
+ const existing_schemaSize = existing.schemaSize;
1061
+ const incoming_schemaSize = incoming.schemaSize;
1062
+ if (!(existing_schemaSize === incoming_schemaSize)) {
1063
+ return false;
1064
+ }
1065
+ const existing_systemVersion = existing.systemVersion;
1066
+ const incoming_systemVersion = incoming.systemVersion;
1067
+ if (!(existing_systemVersion === incoming_systemVersion)) {
1068
+ return false;
1069
+ }
1070
+ const existing_schemaType = existing.schemaType;
1071
+ const incoming_schemaType = incoming.schemaType;
1072
+ if (!(existing_schemaType === incoming_schemaType)) {
1073
+ return false;
1074
+ }
1075
+ const existing_serviceName = existing.serviceName;
1076
+ const incoming_serviceName = incoming.serviceName;
1077
+ if (!(existing_serviceName === incoming_serviceName)) {
1078
+ return false;
1079
+ }
1080
+ const existing_statistics = existing.statistics;
1081
+ const incoming_statistics = incoming.statistics;
1082
+ const equals_statistics_items = equalsArray(existing_statistics, incoming_statistics, (existing_statistics_item, incoming_statistics_item) => {
1083
+ if (!(equals$5(existing_statistics_item, incoming_statistics_item))) {
1084
+ return false;
1085
+ }
1086
+ });
1087
+ if (equals_statistics_items === false) {
1088
+ return false;
1089
+ }
1090
+ return true;
1091
+ }
1092
+
1093
+ const VERSION$3 = "3ff0c02babe6583f09a09544b2c045fd";
1094
+ function validate$4(obj, path = 'ExternalServiceStatisticsOverviewRepresentation') {
1095
+ const v_error = (() => {
1096
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1097
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1098
+ }
1099
+ const obj_activeCount = obj.activeCount;
1100
+ const path_activeCount = path + '.activeCount';
1101
+ if (typeof obj_activeCount !== 'number' || (typeof obj_activeCount === 'number' && Math.floor(obj_activeCount) !== obj_activeCount)) {
1102
+ return new TypeError('Expected "integer" but received "' + typeof obj_activeCount + '" (at "' + path_activeCount + '")');
1103
+ }
1104
+ const obj_statisticFor = obj.statisticFor;
1105
+ const path_statisticFor = path + '.statisticFor';
1106
+ if (typeof obj_statisticFor !== 'string') {
1107
+ return new TypeError('Expected "string" but received "' + typeof obj_statisticFor + '" (at "' + path_statisticFor + '")');
1108
+ }
1109
+ const obj_totalCount = obj.totalCount;
1110
+ const path_totalCount = path + '.totalCount';
1111
+ if (typeof obj_totalCount !== 'number' || (typeof obj_totalCount === 'number' && Math.floor(obj_totalCount) !== obj_totalCount)) {
1112
+ return new TypeError('Expected "integer" but received "' + typeof obj_totalCount + '" (at "' + path_totalCount + '")');
1113
+ }
1114
+ })();
1115
+ return v_error === undefined ? null : v_error;
1116
+ }
1117
+ const select$6 = function ExternalServiceStatisticsOverviewRepresentationSelect() {
1118
+ return {
1119
+ kind: 'Fragment',
1120
+ version: VERSION$3,
1121
+ private: [],
1122
+ selections: [
1123
+ {
1124
+ name: 'activeCount',
1125
+ kind: 'Scalar'
1126
+ },
1127
+ {
1128
+ name: 'statisticFor',
1129
+ kind: 'Scalar'
1130
+ },
1131
+ {
1132
+ name: 'totalCount',
1133
+ kind: 'Scalar'
1134
+ }
1135
+ ]
1136
+ };
1137
+ };
1138
+ function equals$3(existing, incoming) {
1139
+ const existing_activeCount = existing.activeCount;
1140
+ const incoming_activeCount = incoming.activeCount;
1141
+ if (!(existing_activeCount === incoming_activeCount)) {
1142
+ return false;
1143
+ }
1144
+ const existing_totalCount = existing.totalCount;
1145
+ const incoming_totalCount = incoming.totalCount;
1146
+ if (!(existing_totalCount === incoming_totalCount)) {
1147
+ return false;
1148
+ }
1149
+ const existing_statisticFor = existing.statisticFor;
1150
+ const incoming_statisticFor = incoming.statisticFor;
1151
+ if (!(existing_statisticFor === incoming_statisticFor)) {
1152
+ return false;
1153
+ }
1154
+ return true;
1155
+ }
1156
+
1157
+ const VERSION$2 = "4246bda5c0cab4f897003ca8900ef381";
1158
+ function validate$3(obj, path = 'ExternalServiceStatisticsOutputRepresentation') {
1159
+ const v_error = (() => {
1160
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1161
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1162
+ }
1163
+ const obj_serviceCount = obj.serviceCount;
1164
+ const path_serviceCount = path + '.serviceCount';
1165
+ if (typeof obj_serviceCount !== 'number' || (typeof obj_serviceCount === 'number' && Math.floor(obj_serviceCount) !== obj_serviceCount)) {
1166
+ return new TypeError('Expected "integer" but received "' + typeof obj_serviceCount + '" (at "' + path_serviceCount + '")');
1167
+ }
1168
+ const obj_services = obj.services;
1169
+ const path_services = path + '.services';
1170
+ if (!ArrayIsArray(obj_services)) {
1171
+ return new TypeError('Expected "array" but received "' + typeof obj_services + '" (at "' + path_services + '")');
1172
+ }
1173
+ for (let i = 0; i < obj_services.length; i++) {
1174
+ const obj_services_item = obj_services[i];
1175
+ const path_services_item = path_services + '[' + i + ']';
1176
+ const referencepath_services_itemValidationError = validate$5(obj_services_item, path_services_item);
1177
+ if (referencepath_services_itemValidationError !== null) {
1178
+ let message = 'Object doesn\'t match ExternalServiceStatisticsForServiceRepresentation (at "' + path_services_item + '")\n';
1179
+ message += referencepath_services_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1180
+ return new TypeError(message);
1181
+ }
1182
+ }
1183
+ const obj_statistics = obj.statistics;
1184
+ const path_statistics = path + '.statistics';
1185
+ if (!ArrayIsArray(obj_statistics)) {
1186
+ return new TypeError('Expected "array" but received "' + typeof obj_statistics + '" (at "' + path_statistics + '")');
1187
+ }
1188
+ for (let i = 0; i < obj_statistics.length; i++) {
1189
+ const obj_statistics_item = obj_statistics[i];
1190
+ const path_statistics_item = path_statistics + '[' + i + ']';
1191
+ const referencepath_statistics_itemValidationError = validate$4(obj_statistics_item, path_statistics_item);
1192
+ if (referencepath_statistics_itemValidationError !== null) {
1193
+ let message = 'Object doesn\'t match ExternalServiceStatisticsOverviewRepresentation (at "' + path_statistics_item + '")\n';
1194
+ message += referencepath_statistics_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1195
+ return new TypeError(message);
1196
+ }
1197
+ }
1198
+ })();
1199
+ return v_error === undefined ? null : v_error;
1200
+ }
1201
+ const RepresentationType$1 = 'ExternalServiceStatisticsOutputRepresentation';
1202
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
1203
+ return input;
1204
+ }
1205
+ const select$5 = function ExternalServiceStatisticsOutputRepresentationSelect() {
1206
+ const { selections: ExternalServiceStatisticsForServiceRepresentation__selections, opaque: ExternalServiceStatisticsForServiceRepresentation__opaque, } = select$7();
1207
+ const { selections: ExternalServiceStatisticsOverviewRepresentation__selections, opaque: ExternalServiceStatisticsOverviewRepresentation__opaque, } = select$6();
1208
+ return {
1209
+ kind: 'Fragment',
1210
+ version: VERSION$2,
1211
+ private: [],
1212
+ selections: [
1213
+ {
1214
+ name: 'serviceCount',
1215
+ kind: 'Scalar'
1216
+ },
1217
+ {
1218
+ name: 'services',
1219
+ kind: 'Object',
1220
+ plural: true,
1221
+ selections: ExternalServiceStatisticsForServiceRepresentation__selections
1222
+ },
1223
+ {
1224
+ name: 'statistics',
1225
+ kind: 'Object',
1226
+ plural: true,
1227
+ selections: ExternalServiceStatisticsOverviewRepresentation__selections
1228
+ }
1229
+ ]
1230
+ };
1231
+ };
1232
+ function equals$2(existing, incoming) {
1233
+ const existing_serviceCount = existing.serviceCount;
1234
+ const incoming_serviceCount = incoming.serviceCount;
1235
+ if (!(existing_serviceCount === incoming_serviceCount)) {
1236
+ return false;
1237
+ }
1238
+ const existing_services = existing.services;
1239
+ const incoming_services = incoming.services;
1240
+ const equals_services_items = equalsArray(existing_services, incoming_services, (existing_services_item, incoming_services_item) => {
1241
+ if (!(equals$4(existing_services_item, incoming_services_item))) {
1242
+ return false;
1243
+ }
1244
+ });
1245
+ if (equals_services_items === false) {
1246
+ return false;
1247
+ }
1248
+ const existing_statistics = existing.statistics;
1249
+ const incoming_statistics = incoming.statistics;
1250
+ const equals_statistics_items = equalsArray(existing_statistics, incoming_statistics, (existing_statistics_item, incoming_statistics_item) => {
1251
+ if (!(equals$3(existing_statistics_item, incoming_statistics_item))) {
1252
+ return false;
1253
+ }
1254
+ });
1255
+ if (equals_statistics_items === false) {
1256
+ return false;
1257
+ }
1258
+ return true;
1259
+ }
1260
+ const ingest$1 = function ExternalServiceStatisticsOutputRepresentationIngest(input, path, luvio, store, timestamp) {
1261
+ if (process.env.NODE_ENV !== 'production') {
1262
+ const validateError = validate$3(input);
1263
+ if (validateError !== null) {
1264
+ throw validateError;
1265
+ }
1266
+ }
1267
+ const key = path.fullPath;
1268
+ const existingRecord = store.readEntry(key);
1269
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 300000;
1270
+ let incomingRecord = normalize$1(input, store.readEntry(key), {
1271
+ fullPath: key,
1272
+ parent: path.parent,
1273
+ propertyName: path.propertyName,
1274
+ ttl: ttlToUse
1275
+ });
1276
+ if (existingRecord === undefined || equals$2(existingRecord, incomingRecord) === false) {
1277
+ luvio.storePublish(key, incomingRecord);
1278
+ }
1279
+ if (ttlToUse !== undefined) {
1280
+ const storeMetadataParams = {
1281
+ ttl: ttlToUse,
1282
+ namespace: "external-services",
1283
+ version: VERSION$2,
1284
+ representationName: RepresentationType$1,
1285
+ };
1286
+ luvio.publishStoreMetadata(key, storeMetadataParams);
1287
+ }
1288
+ return createLink(key);
1289
+ };
1290
+ function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
1291
+ const rootKeySet = new StoreKeyMap();
1292
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1293
+ const rootKey = fullPathFactory();
1294
+ rootKeySet.set(rootKey, {
1295
+ namespace: keyPrefix,
1296
+ representationName: RepresentationType$1,
1297
+ mergeable: false
1298
+ });
1299
+ return rootKeySet;
1300
+ }
1301
+
1302
+ function select$4(luvio, params) {
1303
+ return select$5();
1304
+ }
1305
+ function keyBuilder$4(luvio, params) {
1306
+ return keyPrefix + '::ExternalServiceStatisticsOutputRepresentation:(' + ')';
1307
+ }
1308
+ function getResponseCacheKeys$2(luvio, resourceParams, response) {
1309
+ return getTypeCacheKeys$1(luvio, response, () => keyBuilder$4());
1310
+ }
1311
+ function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
1312
+ const { body } = response;
1313
+ const key = keyBuilder$4();
1314
+ luvio.storeIngest(key, ingest$1, body);
1315
+ const snapshot = luvio.storeLookup({
1316
+ recordId: key,
1317
+ node: select$4(),
1318
+ variables: {},
1319
+ }, snapshotRefresh);
1320
+ if (process.env.NODE_ENV !== 'production') {
1321
+ if (snapshot.state !== 'Fulfilled') {
1322
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1323
+ }
1324
+ }
1325
+ return snapshot;
1326
+ }
1327
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
1328
+ const key = keyBuilder$4();
1329
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1330
+ luvio.storeIngestError(key, errorSnapshot);
1331
+ return errorSnapshot;
1332
+ }
1333
+ function createResourceRequest$2(config) {
1334
+ const headers = {};
1335
+ return {
1336
+ baseUri: '/services/data/v58.0',
1337
+ basePath: '/externalservices/statistics/services',
1338
+ method: 'get',
1339
+ body: null,
1340
+ urlParams: {},
1341
+ queryParams: {},
1342
+ headers,
1343
+ priority: 'normal',
1344
+ };
1345
+ }
1346
+
1347
+ const getStatistics_ConfigPropertyNames = {
1348
+ displayName: 'getStatistics',
1349
+ parameters: {
1350
+ required: [],
1351
+ optional: []
1352
+ }
1353
+ };
1354
+ function createResourceParams$2(config) {
1355
+ const resourceParams = {};
1356
+ return resourceParams;
1357
+ }
1358
+ function keyBuilder$3(luvio, config) {
1359
+ return keyBuilder$4();
1360
+ }
1361
+ function typeCheckConfig$2(untrustedConfig) {
1362
+ const config = {};
1363
+ return config;
1364
+ }
1365
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
1366
+ if (!untrustedIsObject(untrustedConfig)) {
1367
+ return null;
1368
+ }
1369
+ if (process.env.NODE_ENV !== 'production') {
1370
+ validateConfig(untrustedConfig, configPropertyNames);
1371
+ }
1372
+ const config = typeCheckConfig$2();
1373
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1374
+ return null;
1375
+ }
1376
+ return config;
1377
+ }
1378
+ function adapterFragment$1(luvio, config) {
1379
+ return select$4();
1380
+ }
1381
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
1382
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
1383
+ config,
1384
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
1385
+ });
1386
+ return luvio.storeBroadcast().then(() => snapshot);
1387
+ }
1388
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
1389
+ const snapshot = ingestError$1(luvio, resourceParams, response, {
1390
+ config,
1391
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
1392
+ });
1393
+ return luvio.storeBroadcast().then(() => snapshot);
1394
+ }
1395
+ function buildNetworkSnapshot$2(luvio, config, options) {
1396
+ const resourceParams = createResourceParams$2();
1397
+ const request = createResourceRequest$2();
1398
+ return luvio.dispatchResourceRequest(request, options)
1399
+ .then((response) => {
1400
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => getResponseCacheKeys$2(luvio, resourceParams, response.body));
1401
+ }, (response) => {
1402
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
1403
+ });
1404
+ }
1405
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
1406
+ const { luvio, config } = context;
1407
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
1408
+ const dispatchOptions = {
1409
+ resourceRequestContext: {
1410
+ requestCorrelator,
1411
+ luvioRequestMethod: undefined,
1412
+ },
1413
+ eventObservers
1414
+ };
1415
+ if (networkPriority !== 'normal') {
1416
+ dispatchOptions.overrides = {
1417
+ priority: networkPriority
1418
+ };
1419
+ }
1420
+ return buildNetworkSnapshot$2(luvio, config, dispatchOptions);
1421
+ }
1422
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
1423
+ const { luvio, config } = context;
1424
+ const selector = {
1425
+ recordId: keyBuilder$3(),
1426
+ node: adapterFragment$1(),
1427
+ variables: {},
1428
+ };
1429
+ const cacheSnapshot = storeLookup(selector, {
1430
+ config,
1431
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
1432
+ });
1433
+ return cacheSnapshot;
1434
+ }
1435
+ const getStatisticsAdapterFactory = (luvio) => function externalServices__getStatistics(untrustedConfig, requestContext) {
1436
+ const config = validateAdapterConfig$2(untrustedConfig, getStatistics_ConfigPropertyNames);
1437
+ // Invalid or incomplete config
1438
+ if (config === null) {
1439
+ return null;
1440
+ }
1441
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1442
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
1443
+ };
1444
+
1445
+ function select$3(luvio, params) {
1446
+ return select$5();
1447
+ }
1448
+ function keyBuilder$2(luvio, params) {
1449
+ return keyPrefix + '::ExternalServiceStatisticsOutputRepresentation:(' + 'registrationName:' + params.urlParams.registrationName + ')';
1450
+ }
1451
+ function getResponseCacheKeys$1(luvio, resourceParams, response) {
1452
+ return getTypeCacheKeys$1(luvio, response, () => keyBuilder$2(luvio, resourceParams));
1453
+ }
1454
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
1455
+ const { body } = response;
1456
+ const key = keyBuilder$2(luvio, resourceParams);
1457
+ luvio.storeIngest(key, ingest$1, body);
1458
+ const snapshot = luvio.storeLookup({
1459
+ recordId: key,
1460
+ node: select$3(),
1461
+ variables: {},
1462
+ }, snapshotRefresh);
1463
+ if (process.env.NODE_ENV !== 'production') {
1464
+ if (snapshot.state !== 'Fulfilled') {
1465
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1466
+ }
1467
+ }
1468
+ return snapshot;
1469
+ }
1470
+ function ingestError(luvio, params, error, snapshotRefresh) {
1471
+ const key = keyBuilder$2(luvio, params);
1472
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1473
+ luvio.storeIngestError(key, errorSnapshot);
1474
+ return errorSnapshot;
1475
+ }
1476
+ function createResourceRequest$1(config) {
1477
+ const headers = {};
1478
+ return {
1479
+ baseUri: '/services/data/v58.0',
1480
+ basePath: '/externalservices/statistics/services/' + config.urlParams.registrationName + '',
1481
+ method: 'get',
1482
+ body: null,
1483
+ urlParams: config.urlParams,
1484
+ queryParams: {},
1485
+ headers,
1486
+ priority: 'normal',
1487
+ };
1488
+ }
1489
+
1490
+ const getStatisticsForService_ConfigPropertyNames = {
1491
+ displayName: 'getStatisticsForService',
1492
+ parameters: {
1493
+ required: ['registrationName'],
1494
+ optional: []
1495
+ }
1496
+ };
1497
+ function createResourceParams$1(config) {
1498
+ const resourceParams = {
1499
+ urlParams: {
1500
+ registrationName: config.registrationName
1501
+ }
1502
+ };
1503
+ return resourceParams;
1504
+ }
1505
+ function keyBuilder$1(luvio, config) {
1506
+ const resourceParams = createResourceParams$1(config);
1507
+ return keyBuilder$2(luvio, resourceParams);
1508
+ }
1509
+ function typeCheckConfig$1(untrustedConfig) {
1510
+ const config = {};
1511
+ const untrustedConfig_registrationName = untrustedConfig.registrationName;
1512
+ if (typeof untrustedConfig_registrationName === 'string') {
1513
+ config.registrationName = untrustedConfig_registrationName;
1514
+ }
1515
+ return config;
1516
+ }
1517
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
1518
+ if (!untrustedIsObject(untrustedConfig)) {
1519
+ return null;
1520
+ }
1521
+ if (process.env.NODE_ENV !== 'production') {
1522
+ validateConfig(untrustedConfig, configPropertyNames);
1523
+ }
1524
+ const config = typeCheckConfig$1(untrustedConfig);
1525
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1526
+ return null;
1527
+ }
1528
+ return config;
1529
+ }
1530
+ function adapterFragment(luvio, config) {
1531
+ createResourceParams$1(config);
1532
+ return select$3();
1533
+ }
1534
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
1535
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
1536
+ config,
1537
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1538
+ });
1539
+ return luvio.storeBroadcast().then(() => snapshot);
1540
+ }
1541
+ function onFetchResponseError(luvio, config, resourceParams, response) {
1542
+ const snapshot = ingestError(luvio, resourceParams, response, {
1543
+ config,
1544
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1545
+ });
1546
+ return luvio.storeBroadcast().then(() => snapshot);
1547
+ }
1548
+ function buildNetworkSnapshot$1(luvio, config, options) {
1549
+ const resourceParams = createResourceParams$1(config);
1550
+ const request = createResourceRequest$1(resourceParams);
1551
+ return luvio.dispatchResourceRequest(request, options)
1552
+ .then((response) => {
1553
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys$1(luvio, resourceParams, response.body));
1554
+ }, (response) => {
1555
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
1556
+ });
1557
+ }
1558
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
1559
+ const { luvio, config } = context;
1560
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
1561
+ const dispatchOptions = {
1562
+ resourceRequestContext: {
1563
+ requestCorrelator,
1564
+ luvioRequestMethod: undefined,
1565
+ },
1566
+ eventObservers
1567
+ };
1568
+ if (networkPriority !== 'normal') {
1569
+ dispatchOptions.overrides = {
1570
+ priority: networkPriority
1571
+ };
1572
+ }
1573
+ return buildNetworkSnapshot$1(luvio, config, dispatchOptions);
1574
+ }
1575
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
1576
+ const { luvio, config } = context;
1577
+ const selector = {
1578
+ recordId: keyBuilder$1(luvio, config),
1579
+ node: adapterFragment(luvio, config),
1580
+ variables: {},
1581
+ };
1582
+ const cacheSnapshot = storeLookup(selector, {
1583
+ config,
1584
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1585
+ });
1586
+ return cacheSnapshot;
1587
+ }
1588
+ const getStatisticsForServiceAdapterFactory = (luvio) => function externalServices__getStatisticsForService(untrustedConfig, requestContext) {
1589
+ const config = validateAdapterConfig$1(untrustedConfig, getStatisticsForService_ConfigPropertyNames);
1590
+ // Invalid or incomplete config
1591
+ if (config === null) {
1592
+ return null;
1593
+ }
1594
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1595
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
1596
+ };
1597
+
1598
+ function validate$2(obj, path = 'SchemaValidationInputRepresentation') {
1599
+ const v_error = (() => {
1600
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1601
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1602
+ }
1603
+ const obj_schema = obj.schema;
1604
+ const path_schema = path + '.schema';
1605
+ if (typeof obj_schema !== 'string') {
1606
+ return new TypeError('Expected "string" but received "' + typeof obj_schema + '" (at "' + path_schema + '")');
1607
+ }
1608
+ const obj_schemaName = obj.schemaName;
1609
+ const path_schemaName = path + '.schemaName';
1610
+ if (typeof obj_schemaName !== 'string') {
1611
+ return new TypeError('Expected "string" but received "' + typeof obj_schemaName + '" (at "' + path_schemaName + '")');
1612
+ }
1613
+ const obj_systemVersion = obj.systemVersion;
1614
+ const path_systemVersion = path + '.systemVersion';
1615
+ if (typeof obj_systemVersion !== 'number' || (typeof obj_systemVersion === 'number' && Math.floor(obj_systemVersion) !== obj_systemVersion)) {
1616
+ return new TypeError('Expected "integer" but received "' + typeof obj_systemVersion + '" (at "' + path_systemVersion + '")');
1617
+ }
1618
+ })();
1619
+ return v_error === undefined ? null : v_error;
1620
+ }
1621
+
1622
+ const VERSION$1 = "970029a80f127a32c6e30cda09b02a11";
1623
+ function validate$1(obj, path = 'SchemaValidationMessageRepresentation') {
1624
+ const v_error = (() => {
1625
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1626
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1627
+ }
1628
+ if (obj.endColumn !== undefined) {
1629
+ const obj_endColumn = obj.endColumn;
1630
+ const path_endColumn = path + '.endColumn';
1631
+ let obj_endColumn_union0 = null;
1632
+ const obj_endColumn_union0_error = (() => {
1633
+ if (typeof obj_endColumn !== 'number' || (typeof obj_endColumn === 'number' && Math.floor(obj_endColumn) !== obj_endColumn)) {
1634
+ return new TypeError('Expected "integer" but received "' + typeof obj_endColumn + '" (at "' + path_endColumn + '")');
1635
+ }
1636
+ })();
1637
+ if (obj_endColumn_union0_error != null) {
1638
+ obj_endColumn_union0 = obj_endColumn_union0_error.message;
1639
+ }
1640
+ let obj_endColumn_union1 = null;
1641
+ const obj_endColumn_union1_error = (() => {
1642
+ if (obj_endColumn !== null) {
1643
+ return new TypeError('Expected "null" but received "' + typeof obj_endColumn + '" (at "' + path_endColumn + '")');
1644
+ }
1645
+ })();
1646
+ if (obj_endColumn_union1_error != null) {
1647
+ obj_endColumn_union1 = obj_endColumn_union1_error.message;
1648
+ }
1649
+ if (obj_endColumn_union0 && obj_endColumn_union1) {
1650
+ let message = 'Object doesn\'t match union (at "' + path_endColumn + '")';
1651
+ message += '\n' + obj_endColumn_union0.split('\n').map((line) => '\t' + line).join('\n');
1652
+ message += '\n' + obj_endColumn_union1.split('\n').map((line) => '\t' + line).join('\n');
1653
+ return new TypeError(message);
1654
+ }
1655
+ }
1656
+ if (obj.endLine !== undefined) {
1657
+ const obj_endLine = obj.endLine;
1658
+ const path_endLine = path + '.endLine';
1659
+ let obj_endLine_union0 = null;
1660
+ const obj_endLine_union0_error = (() => {
1661
+ if (typeof obj_endLine !== 'number' || (typeof obj_endLine === 'number' && Math.floor(obj_endLine) !== obj_endLine)) {
1662
+ return new TypeError('Expected "integer" but received "' + typeof obj_endLine + '" (at "' + path_endLine + '")');
1663
+ }
1664
+ })();
1665
+ if (obj_endLine_union0_error != null) {
1666
+ obj_endLine_union0 = obj_endLine_union0_error.message;
1667
+ }
1668
+ let obj_endLine_union1 = null;
1669
+ const obj_endLine_union1_error = (() => {
1670
+ if (obj_endLine !== null) {
1671
+ return new TypeError('Expected "null" but received "' + typeof obj_endLine + '" (at "' + path_endLine + '")');
1672
+ }
1673
+ })();
1674
+ if (obj_endLine_union1_error != null) {
1675
+ obj_endLine_union1 = obj_endLine_union1_error.message;
1676
+ }
1677
+ if (obj_endLine_union0 && obj_endLine_union1) {
1678
+ let message = 'Object doesn\'t match union (at "' + path_endLine + '")';
1679
+ message += '\n' + obj_endLine_union0.split('\n').map((line) => '\t' + line).join('\n');
1680
+ message += '\n' + obj_endLine_union1.split('\n').map((line) => '\t' + line).join('\n');
1681
+ return new TypeError(message);
1682
+ }
1683
+ }
1684
+ if (obj.endPosition !== undefined) {
1685
+ const obj_endPosition = obj.endPosition;
1686
+ const path_endPosition = path + '.endPosition';
1687
+ let obj_endPosition_union0 = null;
1688
+ const obj_endPosition_union0_error = (() => {
1689
+ if (typeof obj_endPosition !== 'number' || (typeof obj_endPosition === 'number' && Math.floor(obj_endPosition) !== obj_endPosition)) {
1690
+ return new TypeError('Expected "integer" but received "' + typeof obj_endPosition + '" (at "' + path_endPosition + '")');
1691
+ }
1692
+ })();
1693
+ if (obj_endPosition_union0_error != null) {
1694
+ obj_endPosition_union0 = obj_endPosition_union0_error.message;
1695
+ }
1696
+ let obj_endPosition_union1 = null;
1697
+ const obj_endPosition_union1_error = (() => {
1698
+ if (obj_endPosition !== null) {
1699
+ return new TypeError('Expected "null" but received "' + typeof obj_endPosition + '" (at "' + path_endPosition + '")');
1700
+ }
1701
+ })();
1702
+ if (obj_endPosition_union1_error != null) {
1703
+ obj_endPosition_union1 = obj_endPosition_union1_error.message;
1704
+ }
1705
+ if (obj_endPosition_union0 && obj_endPosition_union1) {
1706
+ let message = 'Object doesn\'t match union (at "' + path_endPosition + '")';
1707
+ message += '\n' + obj_endPosition_union0.split('\n').map((line) => '\t' + line).join('\n');
1708
+ message += '\n' + obj_endPosition_union1.split('\n').map((line) => '\t' + line).join('\n');
1709
+ return new TypeError(message);
1710
+ }
1711
+ }
1712
+ const obj_message = obj.message;
1713
+ const path_message = path + '.message';
1714
+ if (typeof obj_message !== 'string') {
1715
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
1716
+ }
1717
+ if (obj.startColumn !== undefined) {
1718
+ const obj_startColumn = obj.startColumn;
1719
+ const path_startColumn = path + '.startColumn';
1720
+ let obj_startColumn_union0 = null;
1721
+ const obj_startColumn_union0_error = (() => {
1722
+ if (typeof obj_startColumn !== 'number' || (typeof obj_startColumn === 'number' && Math.floor(obj_startColumn) !== obj_startColumn)) {
1723
+ return new TypeError('Expected "integer" but received "' + typeof obj_startColumn + '" (at "' + path_startColumn + '")');
1724
+ }
1725
+ })();
1726
+ if (obj_startColumn_union0_error != null) {
1727
+ obj_startColumn_union0 = obj_startColumn_union0_error.message;
1728
+ }
1729
+ let obj_startColumn_union1 = null;
1730
+ const obj_startColumn_union1_error = (() => {
1731
+ if (obj_startColumn !== null) {
1732
+ return new TypeError('Expected "null" but received "' + typeof obj_startColumn + '" (at "' + path_startColumn + '")');
1733
+ }
1734
+ })();
1735
+ if (obj_startColumn_union1_error != null) {
1736
+ obj_startColumn_union1 = obj_startColumn_union1_error.message;
1737
+ }
1738
+ if (obj_startColumn_union0 && obj_startColumn_union1) {
1739
+ let message = 'Object doesn\'t match union (at "' + path_startColumn + '")';
1740
+ message += '\n' + obj_startColumn_union0.split('\n').map((line) => '\t' + line).join('\n');
1741
+ message += '\n' + obj_startColumn_union1.split('\n').map((line) => '\t' + line).join('\n');
1742
+ return new TypeError(message);
1743
+ }
1744
+ }
1745
+ if (obj.startLine !== undefined) {
1746
+ const obj_startLine = obj.startLine;
1747
+ const path_startLine = path + '.startLine';
1748
+ let obj_startLine_union0 = null;
1749
+ const obj_startLine_union0_error = (() => {
1750
+ if (typeof obj_startLine !== 'number' || (typeof obj_startLine === 'number' && Math.floor(obj_startLine) !== obj_startLine)) {
1751
+ return new TypeError('Expected "integer" but received "' + typeof obj_startLine + '" (at "' + path_startLine + '")');
1752
+ }
1753
+ })();
1754
+ if (obj_startLine_union0_error != null) {
1755
+ obj_startLine_union0 = obj_startLine_union0_error.message;
1756
+ }
1757
+ let obj_startLine_union1 = null;
1758
+ const obj_startLine_union1_error = (() => {
1759
+ if (obj_startLine !== null) {
1760
+ return new TypeError('Expected "null" but received "' + typeof obj_startLine + '" (at "' + path_startLine + '")');
1761
+ }
1762
+ })();
1763
+ if (obj_startLine_union1_error != null) {
1764
+ obj_startLine_union1 = obj_startLine_union1_error.message;
1765
+ }
1766
+ if (obj_startLine_union0 && obj_startLine_union1) {
1767
+ let message = 'Object doesn\'t match union (at "' + path_startLine + '")';
1768
+ message += '\n' + obj_startLine_union0.split('\n').map((line) => '\t' + line).join('\n');
1769
+ message += '\n' + obj_startLine_union1.split('\n').map((line) => '\t' + line).join('\n');
1770
+ return new TypeError(message);
1771
+ }
1772
+ }
1773
+ if (obj.startPosition !== undefined) {
1774
+ const obj_startPosition = obj.startPosition;
1775
+ const path_startPosition = path + '.startPosition';
1776
+ let obj_startPosition_union0 = null;
1777
+ const obj_startPosition_union0_error = (() => {
1778
+ if (typeof obj_startPosition !== 'number' || (typeof obj_startPosition === 'number' && Math.floor(obj_startPosition) !== obj_startPosition)) {
1779
+ return new TypeError('Expected "integer" but received "' + typeof obj_startPosition + '" (at "' + path_startPosition + '")');
1780
+ }
1781
+ })();
1782
+ if (obj_startPosition_union0_error != null) {
1783
+ obj_startPosition_union0 = obj_startPosition_union0_error.message;
1784
+ }
1785
+ let obj_startPosition_union1 = null;
1786
+ const obj_startPosition_union1_error = (() => {
1787
+ if (obj_startPosition !== null) {
1788
+ return new TypeError('Expected "null" but received "' + typeof obj_startPosition + '" (at "' + path_startPosition + '")');
1789
+ }
1790
+ })();
1791
+ if (obj_startPosition_union1_error != null) {
1792
+ obj_startPosition_union1 = obj_startPosition_union1_error.message;
1793
+ }
1794
+ if (obj_startPosition_union0 && obj_startPosition_union1) {
1795
+ let message = 'Object doesn\'t match union (at "' + path_startPosition + '")';
1796
+ message += '\n' + obj_startPosition_union0.split('\n').map((line) => '\t' + line).join('\n');
1797
+ message += '\n' + obj_startPosition_union1.split('\n').map((line) => '\t' + line).join('\n');
1798
+ return new TypeError(message);
1799
+ }
1800
+ }
1801
+ const obj_validationClass = obj.validationClass;
1802
+ const path_validationClass = path + '.validationClass';
1803
+ if (typeof obj_validationClass !== 'string') {
1804
+ return new TypeError('Expected "string" but received "' + typeof obj_validationClass + '" (at "' + path_validationClass + '")');
1805
+ }
1806
+ const obj_validationLevel = obj.validationLevel;
1807
+ const path_validationLevel = path + '.validationLevel';
1808
+ if (typeof obj_validationLevel !== 'string') {
1809
+ return new TypeError('Expected "string" but received "' + typeof obj_validationLevel + '" (at "' + path_validationLevel + '")');
1810
+ }
1811
+ })();
1812
+ return v_error === undefined ? null : v_error;
1813
+ }
1814
+ const select$2 = function SchemaValidationMessageRepresentationSelect() {
1815
+ return {
1816
+ kind: 'Fragment',
1817
+ version: VERSION$1,
1818
+ private: [],
1819
+ selections: [
1820
+ {
1821
+ name: 'endColumn',
1822
+ kind: 'Scalar',
1823
+ required: false
1824
+ },
1825
+ {
1826
+ name: 'endLine',
1827
+ kind: 'Scalar',
1828
+ required: false
1829
+ },
1830
+ {
1831
+ name: 'endPosition',
1832
+ kind: 'Scalar',
1833
+ required: false
1834
+ },
1835
+ {
1836
+ name: 'message',
1837
+ kind: 'Scalar'
1838
+ },
1839
+ {
1840
+ name: 'startColumn',
1841
+ kind: 'Scalar',
1842
+ required: false
1843
+ },
1844
+ {
1845
+ name: 'startLine',
1846
+ kind: 'Scalar',
1847
+ required: false
1848
+ },
1849
+ {
1850
+ name: 'startPosition',
1851
+ kind: 'Scalar',
1852
+ required: false
1853
+ },
1854
+ {
1855
+ name: 'validationClass',
1856
+ kind: 'Scalar'
1857
+ },
1858
+ {
1859
+ name: 'validationLevel',
1860
+ kind: 'Scalar'
1861
+ }
1862
+ ]
1863
+ };
1864
+ };
1865
+ function equals$1(existing, incoming) {
1866
+ const existing_message = existing.message;
1867
+ const incoming_message = incoming.message;
1868
+ if (!(existing_message === incoming_message)) {
1869
+ return false;
1870
+ }
1871
+ const existing_validationClass = existing.validationClass;
1872
+ const incoming_validationClass = incoming.validationClass;
1873
+ if (!(existing_validationClass === incoming_validationClass)) {
1874
+ return false;
1875
+ }
1876
+ const existing_validationLevel = existing.validationLevel;
1877
+ const incoming_validationLevel = incoming.validationLevel;
1878
+ if (!(existing_validationLevel === incoming_validationLevel)) {
1879
+ return false;
1880
+ }
1881
+ const existing_endColumn = existing.endColumn;
1882
+ const incoming_endColumn = incoming.endColumn;
1883
+ // if at least one of these optionals is defined
1884
+ if (existing_endColumn !== undefined || incoming_endColumn !== undefined) {
1885
+ // if one of these is not defined we know the other is defined and therefore
1886
+ // not equal
1887
+ if (existing_endColumn === undefined || incoming_endColumn === undefined) {
1888
+ return false;
1889
+ }
1890
+ if (!(existing_endColumn === incoming_endColumn)) {
1891
+ return false;
1892
+ }
1893
+ }
1894
+ const existing_endLine = existing.endLine;
1895
+ const incoming_endLine = incoming.endLine;
1896
+ // if at least one of these optionals is defined
1897
+ if (existing_endLine !== undefined || incoming_endLine !== undefined) {
1898
+ // if one of these is not defined we know the other is defined and therefore
1899
+ // not equal
1900
+ if (existing_endLine === undefined || incoming_endLine === undefined) {
1901
+ return false;
1902
+ }
1903
+ if (!(existing_endLine === incoming_endLine)) {
1904
+ return false;
1905
+ }
1906
+ }
1907
+ const existing_endPosition = existing.endPosition;
1908
+ const incoming_endPosition = incoming.endPosition;
1909
+ // if at least one of these optionals is defined
1910
+ if (existing_endPosition !== undefined || incoming_endPosition !== undefined) {
1911
+ // if one of these is not defined we know the other is defined and therefore
1912
+ // not equal
1913
+ if (existing_endPosition === undefined || incoming_endPosition === undefined) {
1914
+ return false;
1915
+ }
1916
+ if (!(existing_endPosition === incoming_endPosition)) {
1917
+ return false;
1918
+ }
1919
+ }
1920
+ const existing_startColumn = existing.startColumn;
1921
+ const incoming_startColumn = incoming.startColumn;
1922
+ // if at least one of these optionals is defined
1923
+ if (existing_startColumn !== undefined || incoming_startColumn !== undefined) {
1924
+ // if one of these is not defined we know the other is defined and therefore
1925
+ // not equal
1926
+ if (existing_startColumn === undefined || incoming_startColumn === undefined) {
1927
+ return false;
1928
+ }
1929
+ if (!(existing_startColumn === incoming_startColumn)) {
1930
+ return false;
1931
+ }
1932
+ }
1933
+ const existing_startLine = existing.startLine;
1934
+ const incoming_startLine = incoming.startLine;
1935
+ // if at least one of these optionals is defined
1936
+ if (existing_startLine !== undefined || incoming_startLine !== undefined) {
1937
+ // if one of these is not defined we know the other is defined and therefore
1938
+ // not equal
1939
+ if (existing_startLine === undefined || incoming_startLine === undefined) {
1940
+ return false;
1941
+ }
1942
+ if (!(existing_startLine === incoming_startLine)) {
1943
+ return false;
1944
+ }
1945
+ }
1946
+ const existing_startPosition = existing.startPosition;
1947
+ const incoming_startPosition = incoming.startPosition;
1948
+ // if at least one of these optionals is defined
1949
+ if (existing_startPosition !== undefined || incoming_startPosition !== undefined) {
1950
+ // if one of these is not defined we know the other is defined and therefore
1951
+ // not equal
1952
+ if (existing_startPosition === undefined || incoming_startPosition === undefined) {
1953
+ return false;
1954
+ }
1955
+ if (!(existing_startPosition === incoming_startPosition)) {
1956
+ return false;
1957
+ }
1958
+ }
1959
+ return true;
1960
+ }
1961
+
1962
+ const VERSION = "056d3062f884a64afdf97b374daf2e75";
1963
+ function validate(obj, path = 'SchemaValidationOutputRepresentation') {
1964
+ const v_error = (() => {
1965
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1966
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1967
+ }
1968
+ const obj_schemaName = obj.schemaName;
1969
+ const path_schemaName = path + '.schemaName';
1970
+ if (typeof obj_schemaName !== 'string') {
1971
+ return new TypeError('Expected "string" but received "' + typeof obj_schemaName + '" (at "' + path_schemaName + '")');
1972
+ }
1973
+ const obj_schemaSize = obj.schemaSize;
1974
+ const path_schemaSize = path + '.schemaSize';
1975
+ if (typeof obj_schemaSize !== 'number' || (typeof obj_schemaSize === 'number' && Math.floor(obj_schemaSize) !== obj_schemaSize)) {
1976
+ return new TypeError('Expected "integer" but received "' + typeof obj_schemaSize + '" (at "' + path_schemaSize + '")');
1977
+ }
1978
+ const obj_schemaType = obj.schemaType;
1979
+ const path_schemaType = path + '.schemaType';
1980
+ if (typeof obj_schemaType !== 'string') {
1981
+ return new TypeError('Expected "string" but received "' + typeof obj_schemaType + '" (at "' + path_schemaType + '")');
1982
+ }
1983
+ const obj_schemaValidation = obj.schemaValidation;
1984
+ const path_schemaValidation = path + '.schemaValidation';
1985
+ if (!ArrayIsArray(obj_schemaValidation)) {
1986
+ return new TypeError('Expected "array" but received "' + typeof obj_schemaValidation + '" (at "' + path_schemaValidation + '")');
1987
+ }
1988
+ for (let i = 0; i < obj_schemaValidation.length; i++) {
1989
+ const obj_schemaValidation_item = obj_schemaValidation[i];
1990
+ const path_schemaValidation_item = path_schemaValidation + '[' + i + ']';
1991
+ const referencepath_schemaValidation_itemValidationError = validate$1(obj_schemaValidation_item, path_schemaValidation_item);
1992
+ if (referencepath_schemaValidation_itemValidationError !== null) {
1993
+ let message = 'Object doesn\'t match SchemaValidationMessageRepresentation (at "' + path_schemaValidation_item + '")\n';
1994
+ message += referencepath_schemaValidation_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1995
+ return new TypeError(message);
1996
+ }
1997
+ }
1998
+ const obj_systemVersion = obj.systemVersion;
1999
+ const path_systemVersion = path + '.systemVersion';
2000
+ if (typeof obj_systemVersion !== 'number' || (typeof obj_systemVersion === 'number' && Math.floor(obj_systemVersion) !== obj_systemVersion)) {
2001
+ return new TypeError('Expected "integer" but received "' + typeof obj_systemVersion + '" (at "' + path_systemVersion + '")');
2002
+ }
2003
+ })();
2004
+ return v_error === undefined ? null : v_error;
2005
+ }
2006
+ const RepresentationType = 'SchemaValidationOutputRepresentation';
2007
+ function keyBuilder(luvio, config) {
2008
+ return keyPrefix + '::' + RepresentationType + ':' + config.schemaName;
2009
+ }
2010
+ function keyBuilderFromType(luvio, object) {
2011
+ const keyParams = {
2012
+ schemaName: object.schemaName
2013
+ };
2014
+ return keyBuilder(luvio, keyParams);
2015
+ }
2016
+ function normalize(input, existing, path, luvio, store, timestamp) {
2017
+ return input;
2018
+ }
2019
+ const select$1 = function SchemaValidationOutputRepresentationSelect() {
2020
+ const { selections: SchemaValidationMessageRepresentation__selections, opaque: SchemaValidationMessageRepresentation__opaque, } = select$2();
2021
+ return {
2022
+ kind: 'Fragment',
2023
+ version: VERSION,
2024
+ private: [],
2025
+ selections: [
2026
+ {
2027
+ name: 'schemaName',
2028
+ kind: 'Scalar'
2029
+ },
2030
+ {
2031
+ name: 'schemaSize',
2032
+ kind: 'Scalar'
2033
+ },
2034
+ {
2035
+ name: 'schemaType',
2036
+ kind: 'Scalar'
2037
+ },
2038
+ {
2039
+ name: 'schemaValidation',
2040
+ kind: 'Object',
2041
+ plural: true,
2042
+ selections: SchemaValidationMessageRepresentation__selections
2043
+ },
2044
+ {
2045
+ name: 'systemVersion',
2046
+ kind: 'Scalar'
2047
+ }
2048
+ ]
2049
+ };
2050
+ };
2051
+ function equals(existing, incoming) {
2052
+ const existing_schemaSize = existing.schemaSize;
2053
+ const incoming_schemaSize = incoming.schemaSize;
2054
+ if (!(existing_schemaSize === incoming_schemaSize)) {
2055
+ return false;
2056
+ }
2057
+ const existing_systemVersion = existing.systemVersion;
2058
+ const incoming_systemVersion = incoming.systemVersion;
2059
+ if (!(existing_systemVersion === incoming_systemVersion)) {
2060
+ return false;
2061
+ }
2062
+ const existing_schemaName = existing.schemaName;
2063
+ const incoming_schemaName = incoming.schemaName;
2064
+ if (!(existing_schemaName === incoming_schemaName)) {
2065
+ return false;
2066
+ }
2067
+ const existing_schemaType = existing.schemaType;
2068
+ const incoming_schemaType = incoming.schemaType;
2069
+ if (!(existing_schemaType === incoming_schemaType)) {
2070
+ return false;
2071
+ }
2072
+ const existing_schemaValidation = existing.schemaValidation;
2073
+ const incoming_schemaValidation = incoming.schemaValidation;
2074
+ const equals_schemaValidation_items = equalsArray(existing_schemaValidation, incoming_schemaValidation, (existing_schemaValidation_item, incoming_schemaValidation_item) => {
2075
+ if (!(equals$1(existing_schemaValidation_item, incoming_schemaValidation_item))) {
2076
+ return false;
2077
+ }
2078
+ });
2079
+ if (equals_schemaValidation_items === false) {
2080
+ return false;
2081
+ }
2082
+ return true;
2083
+ }
2084
+ const ingest = function SchemaValidationOutputRepresentationIngest(input, path, luvio, store, timestamp) {
2085
+ if (process.env.NODE_ENV !== 'production') {
2086
+ const validateError = validate(input);
2087
+ if (validateError !== null) {
2088
+ throw validateError;
2089
+ }
2090
+ }
2091
+ const key = keyBuilderFromType(luvio, input);
2092
+ const existingRecord = store.readEntry(key);
2093
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 300000;
2094
+ let incomingRecord = normalize(input, store.readEntry(key), {
2095
+ fullPath: key,
2096
+ parent: path.parent,
2097
+ propertyName: path.propertyName,
2098
+ ttl: ttlToUse
2099
+ });
2100
+ if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
2101
+ luvio.storePublish(key, incomingRecord);
2102
+ }
2103
+ if (ttlToUse !== undefined) {
2104
+ const storeMetadataParams = {
2105
+ ttl: ttlToUse,
2106
+ namespace: "external-services",
2107
+ version: VERSION,
2108
+ representationName: RepresentationType,
2109
+ };
2110
+ luvio.publishStoreMetadata(key, storeMetadataParams);
2111
+ }
2112
+ return createLink(key);
2113
+ };
2114
+ function getTypeCacheKeys(luvio, input, fullPathFactory) {
2115
+ const rootKeySet = new StoreKeyMap();
2116
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
2117
+ const rootKey = keyBuilderFromType(luvio, input);
2118
+ rootKeySet.set(rootKey, {
2119
+ namespace: keyPrefix,
2120
+ representationName: RepresentationType,
2121
+ mergeable: false
2122
+ });
2123
+ return rootKeySet;
2124
+ }
2125
+
2126
+ function select(luvio, params) {
2127
+ return select$1();
2128
+ }
2129
+ function getResponseCacheKeys(luvio, resourceParams, response) {
2130
+ return getTypeCacheKeys(luvio, response);
2131
+ }
2132
+ function ingestSuccess(luvio, resourceParams, response) {
2133
+ const { body } = response;
2134
+ const key = keyBuilderFromType(luvio, body);
2135
+ luvio.storeIngest(key, ingest, body);
2136
+ const snapshot = luvio.storeLookup({
2137
+ recordId: key,
2138
+ node: select(),
2139
+ variables: {},
2140
+ });
2141
+ if (process.env.NODE_ENV !== 'production') {
2142
+ if (snapshot.state !== 'Fulfilled') {
2143
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
2144
+ }
2145
+ }
2146
+ return snapshot;
2147
+ }
2148
+ function createResourceRequest(config) {
2149
+ const headers = {};
2150
+ return {
2151
+ baseUri: '/services/data/v58.0',
2152
+ basePath: '/externalservices/schemas/' + config.urlParams.schemaName + '/validation',
2153
+ method: 'post',
2154
+ body: config.body,
2155
+ urlParams: config.urlParams,
2156
+ queryParams: {},
2157
+ headers,
2158
+ priority: 'normal',
2159
+ };
2160
+ }
2161
+
2162
+ const validateSchema_ConfigPropertyNames = {
2163
+ displayName: 'validateSchema',
2164
+ parameters: {
2165
+ required: ['schemaName', 'schema'],
2166
+ optional: []
2167
+ }
2168
+ };
2169
+ function createResourceParams(config) {
2170
+ const resourceParams = {
2171
+ urlParams: {
2172
+ schemaName: config.schemaName
2173
+ },
2174
+ body: {
2175
+ schema: config.schema
2176
+ }
2177
+ };
2178
+ return resourceParams;
2179
+ }
2180
+ function typeCheckConfig(untrustedConfig) {
2181
+ const config = {};
2182
+ const untrustedConfig_schemaName = untrustedConfig.schemaName;
2183
+ if (typeof untrustedConfig_schemaName === 'string') {
2184
+ config.schemaName = untrustedConfig_schemaName;
2185
+ }
2186
+ const untrustedConfig_schema = untrustedConfig.schema;
2187
+ const referenceSchemaValidationInputRepresentationValidationError = validate$2(untrustedConfig_schema);
2188
+ if (referenceSchemaValidationInputRepresentationValidationError === null) {
2189
+ config.schema = untrustedConfig_schema;
2190
+ }
2191
+ return config;
2192
+ }
2193
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
2194
+ if (!untrustedIsObject(untrustedConfig)) {
2195
+ return null;
2196
+ }
2197
+ if (process.env.NODE_ENV !== 'production') {
2198
+ validateConfig(untrustedConfig, configPropertyNames);
2199
+ }
2200
+ const config = typeCheckConfig(untrustedConfig);
2201
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
2202
+ return null;
2203
+ }
2204
+ return config;
2205
+ }
2206
+ function buildNetworkSnapshot(luvio, config, options) {
2207
+ const resourceParams = createResourceParams(config);
2208
+ const request = createResourceRequest(resourceParams);
2209
+ return luvio.dispatchResourceRequest(request, options)
2210
+ .then((response) => {
2211
+ return luvio.handleSuccessResponse(() => {
2212
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
2213
+ return luvio.storeBroadcast().then(() => snapshot);
2214
+ }, () => getResponseCacheKeys(luvio, resourceParams, response.body));
2215
+ }, (response) => {
2216
+ deepFreeze$2(response);
2217
+ throw response;
2218
+ });
2219
+ }
2220
+ const validateSchemaAdapterFactory = (luvio) => {
2221
+ return function validateSchema(untrustedConfig) {
2222
+ const config = validateAdapterConfig(untrustedConfig, validateSchema_ConfigPropertyNames);
2223
+ // Invalid or incomplete config
2224
+ if (config === null) {
2225
+ throw new Error('Invalid config for "validateSchema"');
2226
+ }
2227
+ return buildNetworkSnapshot(luvio, config);
2228
+ };
2229
+ };
2230
+
2231
+ let getDataShape;
2232
+ let getOpenApiSpec;
2233
+ let getStatistics;
2234
+ let getStatisticsForService;
2235
+ let validateSchema;
2236
+ // Imperative GET Adapters
2237
+ let getDataShape_imperative;
2238
+ let getOpenApiSpec_imperative;
2239
+ let getStatistics_imperative;
2240
+ let getStatisticsForService_imperative;
2241
+ // Adapter Metadata
2242
+ const getDataShapeMetadata = { apiFamily: 'externalservices', name: 'getDataShape' };
2243
+ const getOpenApiSpecMetadata = { apiFamily: 'externalservices', name: 'getOpenApiSpec' };
2244
+ const getStatisticsMetadata = { apiFamily: 'externalservices', name: 'getStatistics' };
2245
+ const getStatisticsForServiceMetadata = { apiFamily: 'externalservices', name: 'getStatisticsForService' };
2246
+ function bindExportsTo(luvio) {
2247
+ // LDS Adapters
2248
+ const getDataShape_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getDataShape', getDataShapeAdapterFactory), getDataShapeMetadata);
2249
+ const getOpenApiSpec_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getOpenApiSpec', getOpenApiSpecAdapterFactory), getOpenApiSpecMetadata);
2250
+ const getStatistics_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getStatistics', getStatisticsAdapterFactory), getStatisticsMetadata);
2251
+ const getStatisticsForService_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getStatisticsForService', getStatisticsForServiceAdapterFactory), getStatisticsForServiceMetadata);
2252
+ function unwrapSnapshotData(factory) {
2253
+ const adapter = factory(luvio);
2254
+ return (config) => adapter(config).then(snapshot => snapshot.data);
2255
+ }
2256
+ return {
2257
+ getDataShape: createWireAdapterConstructor(luvio, getDataShape_ldsAdapter, getDataShapeMetadata),
2258
+ getOpenApiSpec: createWireAdapterConstructor(luvio, getOpenApiSpec_ldsAdapter, getOpenApiSpecMetadata),
2259
+ getStatistics: createWireAdapterConstructor(luvio, getStatistics_ldsAdapter, getStatisticsMetadata),
2260
+ getStatisticsForService: createWireAdapterConstructor(luvio, getStatisticsForService_ldsAdapter, getStatisticsForServiceMetadata),
2261
+ validateSchema: unwrapSnapshotData(validateSchemaAdapterFactory),
2262
+ // Imperative GET Adapters
2263
+ getDataShape_imperative: createImperativeAdapter(luvio, getDataShape_ldsAdapter, getDataShapeMetadata),
2264
+ getOpenApiSpec_imperative: createImperativeAdapter(luvio, getOpenApiSpec_ldsAdapter, getOpenApiSpecMetadata),
2265
+ getStatistics_imperative: createImperativeAdapter(luvio, getStatistics_ldsAdapter, getStatisticsMetadata),
2266
+ getStatisticsForService_imperative: createImperativeAdapter(luvio, getStatisticsForService_ldsAdapter, getStatisticsForServiceMetadata)
2267
+ };
2268
+ }
2269
+ withDefaultLuvio((luvio) => {
2270
+ ({
2271
+ getDataShape,
2272
+ getOpenApiSpec,
2273
+ getStatistics,
2274
+ getStatisticsForService,
2275
+ validateSchema,
2276
+ getDataShape_imperative,
2277
+ getOpenApiSpec_imperative,
2278
+ getStatistics_imperative,
2279
+ getStatisticsForService_imperative
2280
+ } = bindExportsTo(luvio));
2281
+ });
2282
+
2283
+ export { getDataShape, getDataShape_imperative, getOpenApiSpec, getOpenApiSpec_imperative, getStatistics, getStatisticsForService, getStatisticsForService_imperative, getStatistics_imperative, validateSchema };
2284
+ // version: 1.100.2-ca56bb821