@salesforce/lds-adapters-platform-lightning-types 0.1.0-dev1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/platform-lightning-types.js +1887 -0
  3. package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
  4. package/dist/es/es2018/types/src/generated/adapters/getLightningType.d.ts +32 -0
  5. package/dist/es/es2018/types/src/generated/adapters/getLightningTypes.d.ts +33 -0
  6. package/dist/es/es2018/types/src/generated/adapters/getTypes.d.ts +29 -0
  7. package/dist/es/es2018/types/src/generated/adapters/validateLightningModel.d.ts +32 -0
  8. package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +4 -0
  9. package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +9 -0
  10. package/dist/es/es2018/types/src/generated/resources/getConnectLightningTypes.d.ts +21 -0
  11. package/dist/es/es2018/types/src/generated/resources/getConnectLightningTypesByFullyQualifiedName.d.ts +22 -0
  12. package/dist/es/es2018/types/src/generated/resources/postConnectLightningModelTypes.d.ts +17 -0
  13. package/dist/es/es2018/types/src/generated/resources/postConnectLightningModelValidate.d.ts +20 -0
  14. package/dist/es/es2018/types/src/generated/types/LightningModelEditorConfigInputRepresentation.d.ts +37 -0
  15. package/dist/es/es2018/types/src/generated/types/LightningModelFilterConfigInputRepresentation.d.ts +28 -0
  16. package/dist/es/es2018/types/src/generated/types/LightningModelRendererConfigInputRepresentation.d.ts +37 -0
  17. package/dist/es/es2018/types/src/generated/types/LightningModelSchemaConfigInputRepresentation.d.ts +31 -0
  18. package/dist/es/es2018/types/src/generated/types/LightningModelSourceDescriptorInputRepresentation.d.ts +31 -0
  19. package/dist/es/es2018/types/src/generated/types/LightningModelTypesCollectionRepresentation.d.ts +30 -0
  20. package/dist/es/es2018/types/src/generated/types/LightningModelTypesConfigInputRepresentation.d.ts +44 -0
  21. package/dist/es/es2018/types/src/generated/types/LightningModelTypesErrorRepresentation.d.ts +31 -0
  22. package/dist/es/es2018/types/src/generated/types/LightningModelTypesInputRepresentation.d.ts +32 -0
  23. package/dist/es/es2018/types/src/generated/types/LightningModelTypesRepresentation.d.ts +59 -0
  24. package/dist/es/es2018/types/src/generated/types/LightningModelValidateFilterConfigInputRepresentation.d.ts +31 -0
  25. package/dist/es/es2018/types/src/generated/types/LightningModelValidateInputRepresentation.d.ts +39 -0
  26. package/dist/es/es2018/types/src/generated/types/LightningModelValidationErrorRepresentation.d.ts +47 -0
  27. package/dist/es/es2018/types/src/generated/types/LightningModelValidationResultRepresentation.d.ts +33 -0
  28. package/dist/es/es2018/types/src/generated/types/LightningTypeCollectionRepresentation.d.ts +51 -0
  29. package/dist/es/es2018/types/src/generated/types/LightningTypeDetailRepresentation.d.ts +54 -0
  30. package/dist/es/es2018/types/src/generated/types/LightningTypeSummaryRepresentation.d.ts +44 -0
  31. package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
  32. package/package.json +66 -0
  33. package/sfdc/index.d.ts +1 -0
  34. package/sfdc/index.js +1956 -0
  35. package/src/raml/api.raml +561 -0
  36. package/src/raml/luvio.raml +98 -0
package/sfdc/index.js ADDED
@@ -0,0 +1,1956 @@
1
+ /**
2
+ * Copyright (c) 2022, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ /*
8
+ * ATTENTION!
9
+ * THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
10
+ * If you would like to contribute to LDS, please follow the steps outlined in the git repo.
11
+ * Any changes made to this file in p4 will be automatically overwritten.
12
+ * *******************************************************************************************
13
+ */
14
+ /* proxy-compat-disable */
15
+ import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
16
+ import { withDefaultLuvio } from 'force/ldsEngine';
17
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$4, typeCheckConfig as typeCheckConfig$4, StoreKeyMap, createResourceParams as createResourceParams$4 } from 'force/luvioEngine';
18
+
19
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
20
+ const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
21
+ const { stringify: JSONStringify$1 } = JSON;
22
+ const { isArray: ArrayIsArray$1 } = Array;
23
+ /**
24
+ * Validates an adapter config is well-formed.
25
+ * @param config The config to validate.
26
+ * @param adapter The adapter validation configuration.
27
+ * @param oneOf The keys the config must contain at least one of.
28
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
29
+ */
30
+ function validateConfig(config, adapter, oneOf) {
31
+ const { displayName } = adapter;
32
+ const { required, optional, unsupported } = adapter.parameters;
33
+ if (config === undefined ||
34
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
35
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
36
+ }
37
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
38
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
39
+ }
40
+ if (unsupported !== undefined &&
41
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
42
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
43
+ }
44
+ const supported = required.concat(optional);
45
+ if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
46
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
47
+ }
48
+ }
49
+ function untrustedIsObject(untrusted) {
50
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
51
+ }
52
+ function areRequiredParametersPresent(config, configPropertyNames) {
53
+ return configPropertyNames.parameters.required.every(req => req in config);
54
+ }
55
+ const snapshotRefreshOptions = {
56
+ overrides: {
57
+ headers: {
58
+ 'Cache-Control': 'no-cache',
59
+ },
60
+ }
61
+ };
62
+ /**
63
+ * A deterministic JSON stringify implementation. Heavily adapted from https://github.com/epoberezkin/fast-json-stable-stringify.
64
+ * This is needed because insertion order for JSON.stringify(object) affects output:
65
+ * JSON.stringify({a: 1, b: 2})
66
+ * "{"a":1,"b":2}"
67
+ * JSON.stringify({b: 2, a: 1})
68
+ * "{"b":2,"a":1}"
69
+ * @param data Data to be JSON-stringified.
70
+ * @returns JSON.stringified value with consistent ordering of keys.
71
+ */
72
+ function stableJSONStringify(node) {
73
+ // This is for Date values.
74
+ if (node && node.toJSON && typeof node.toJSON === 'function') {
75
+ // eslint-disable-next-line no-param-reassign
76
+ node = node.toJSON();
77
+ }
78
+ if (node === undefined) {
79
+ return;
80
+ }
81
+ if (typeof node === 'number') {
82
+ return isFinite(node) ? '' + node : 'null';
83
+ }
84
+ if (typeof node !== 'object') {
85
+ return JSONStringify$1(node);
86
+ }
87
+ let i;
88
+ let out;
89
+ if (ArrayIsArray$1(node)) {
90
+ out = '[';
91
+ for (i = 0; i < node.length; i++) {
92
+ if (i) {
93
+ out += ',';
94
+ }
95
+ out += stableJSONStringify(node[i]) || 'null';
96
+ }
97
+ return out + ']';
98
+ }
99
+ if (node === null) {
100
+ return 'null';
101
+ }
102
+ const keys = ObjectKeys$1(node).sort();
103
+ out = '';
104
+ for (i = 0; i < keys.length; i++) {
105
+ const key = keys[i];
106
+ const value = stableJSONStringify(node[key]);
107
+ if (!value) {
108
+ continue;
109
+ }
110
+ if (out) {
111
+ out += ',';
112
+ }
113
+ out += JSONStringify$1(key) + ':' + value;
114
+ }
115
+ return '{' + out + '}';
116
+ }
117
+ function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
118
+ return {
119
+ name,
120
+ required,
121
+ resourceType,
122
+ typeCheckShape,
123
+ isArrayShape,
124
+ coerceFn,
125
+ };
126
+ }
127
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
128
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
129
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
130
+ return {
131
+ displayName,
132
+ parameters: {
133
+ required,
134
+ optional,
135
+ }
136
+ };
137
+ }
138
+ const keyPrefix = 'lightning-types';
139
+
140
+ const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
141
+ const { isArray: ArrayIsArray } = Array;
142
+ const { stringify: JSONStringify } = JSON;
143
+ function equalsArray(a, b, equalsItem) {
144
+ const aLength = a.length;
145
+ const bLength = b.length;
146
+ if (aLength !== bLength) {
147
+ return false;
148
+ }
149
+ for (let i = 0; i < aLength; i++) {
150
+ if (equalsItem(a[i], b[i]) === false) {
151
+ return false;
152
+ }
153
+ }
154
+ return true;
155
+ }
156
+ function createLink(ref) {
157
+ return {
158
+ __ref: serializeStructuredKey(ref),
159
+ };
160
+ }
161
+
162
+ const TTL$4 = 100;
163
+ const VERSION$4 = "ec107620eea2293ec74a88bdcac66085";
164
+ function validate$e(obj, path = 'LightningTypeDetailRepresentation') {
165
+ const v_error = (() => {
166
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
167
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
168
+ }
169
+ if (obj.description !== undefined) {
170
+ const obj_description = obj.description;
171
+ const path_description = path + '.description';
172
+ let obj_description_union0 = null;
173
+ const obj_description_union0_error = (() => {
174
+ if (typeof obj_description !== 'string') {
175
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
176
+ }
177
+ })();
178
+ if (obj_description_union0_error != null) {
179
+ obj_description_union0 = obj_description_union0_error.message;
180
+ }
181
+ let obj_description_union1 = null;
182
+ const obj_description_union1_error = (() => {
183
+ if (obj_description !== null) {
184
+ return new TypeError('Expected "null" but received "' + typeof obj_description + '" (at "' + path_description + '")');
185
+ }
186
+ })();
187
+ if (obj_description_union1_error != null) {
188
+ obj_description_union1 = obj_description_union1_error.message;
189
+ }
190
+ if (obj_description_union0 && obj_description_union1) {
191
+ let message = 'Object doesn\'t match union (at "' + path_description + '")';
192
+ message += '\n' + obj_description_union0.split('\n').map((line) => '\t' + line).join('\n');
193
+ message += '\n' + obj_description_union1.split('\n').map((line) => '\t' + line).join('\n');
194
+ return new TypeError(message);
195
+ }
196
+ }
197
+ const obj_developerName = obj.developerName;
198
+ const path_developerName = path + '.developerName';
199
+ if (typeof obj_developerName !== 'string') {
200
+ return new TypeError('Expected "string" but received "' + typeof obj_developerName + '" (at "' + path_developerName + '")');
201
+ }
202
+ if (obj.editorConfig !== undefined) {
203
+ const obj_editorConfig = obj.editorConfig;
204
+ const path_editorConfig = path + '.editorConfig';
205
+ if (obj_editorConfig === undefined) {
206
+ return new TypeError('Expected "defined" but received "' + typeof obj_editorConfig + '" (at "' + path_editorConfig + '")');
207
+ }
208
+ }
209
+ if (obj.id !== undefined) {
210
+ const obj_id = obj.id;
211
+ const path_id = path + '.id';
212
+ let obj_id_union0 = null;
213
+ const obj_id_union0_error = (() => {
214
+ if (typeof obj_id !== 'string') {
215
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
216
+ }
217
+ })();
218
+ if (obj_id_union0_error != null) {
219
+ obj_id_union0 = obj_id_union0_error.message;
220
+ }
221
+ let obj_id_union1 = null;
222
+ const obj_id_union1_error = (() => {
223
+ if (obj_id !== null) {
224
+ return new TypeError('Expected "null" but received "' + typeof obj_id + '" (at "' + path_id + '")');
225
+ }
226
+ })();
227
+ if (obj_id_union1_error != null) {
228
+ obj_id_union1 = obj_id_union1_error.message;
229
+ }
230
+ if (obj_id_union0 && obj_id_union1) {
231
+ let message = 'Object doesn\'t match union (at "' + path_id + '")';
232
+ message += '\n' + obj_id_union0.split('\n').map((line) => '\t' + line).join('\n');
233
+ message += '\n' + obj_id_union1.split('\n').map((line) => '\t' + line).join('\n');
234
+ return new TypeError(message);
235
+ }
236
+ }
237
+ const obj_namespacePrefix = obj.namespacePrefix;
238
+ const path_namespacePrefix = path + '.namespacePrefix';
239
+ if (typeof obj_namespacePrefix !== 'string') {
240
+ return new TypeError('Expected "string" but received "' + typeof obj_namespacePrefix + '" (at "' + path_namespacePrefix + '")');
241
+ }
242
+ if (obj.rendererConfig !== undefined) {
243
+ const obj_rendererConfig = obj.rendererConfig;
244
+ const path_rendererConfig = path + '.rendererConfig';
245
+ if (obj_rendererConfig === undefined) {
246
+ return new TypeError('Expected "defined" but received "' + typeof obj_rendererConfig + '" (at "' + path_rendererConfig + '")');
247
+ }
248
+ }
249
+ const obj_schema = obj.schema;
250
+ const path_schema = path + '.schema';
251
+ if (typeof obj_schema !== 'object' || ArrayIsArray(obj_schema) || obj_schema === null) {
252
+ return new TypeError('Expected "object" but received "' + typeof obj_schema + '" (at "' + path_schema + '")');
253
+ }
254
+ const obj_schema_keys = ObjectKeys(obj_schema);
255
+ for (let i = 0; i < obj_schema_keys.length; i++) {
256
+ const key = obj_schema_keys[i];
257
+ const obj_schema_prop = obj_schema[key];
258
+ const path_schema_prop = path_schema + '["' + key + '"]';
259
+ if (obj_schema_prop === undefined) {
260
+ return new TypeError('Expected "defined" but received "' + typeof obj_schema_prop + '" (at "' + path_schema_prop + '")');
261
+ }
262
+ }
263
+ if (obj.title !== undefined) {
264
+ const obj_title = obj.title;
265
+ const path_title = path + '.title';
266
+ let obj_title_union0 = null;
267
+ const obj_title_union0_error = (() => {
268
+ if (typeof obj_title !== 'string') {
269
+ return new TypeError('Expected "string" but received "' + typeof obj_title + '" (at "' + path_title + '")');
270
+ }
271
+ })();
272
+ if (obj_title_union0_error != null) {
273
+ obj_title_union0 = obj_title_union0_error.message;
274
+ }
275
+ let obj_title_union1 = null;
276
+ const obj_title_union1_error = (() => {
277
+ if (obj_title !== null) {
278
+ return new TypeError('Expected "null" but received "' + typeof obj_title + '" (at "' + path_title + '")');
279
+ }
280
+ })();
281
+ if (obj_title_union1_error != null) {
282
+ obj_title_union1 = obj_title_union1_error.message;
283
+ }
284
+ if (obj_title_union0 && obj_title_union1) {
285
+ let message = 'Object doesn\'t match union (at "' + path_title + '")';
286
+ message += '\n' + obj_title_union0.split('\n').map((line) => '\t' + line).join('\n');
287
+ message += '\n' + obj_title_union1.split('\n').map((line) => '\t' + line).join('\n');
288
+ return new TypeError(message);
289
+ }
290
+ }
291
+ })();
292
+ return v_error === undefined ? null : v_error;
293
+ }
294
+ const RepresentationType$4 = 'LightningTypeDetailRepresentation';
295
+ function normalize$4(input, existing, path, luvio, store, timestamp) {
296
+ return input;
297
+ }
298
+ const select$8 = function LightningTypeDetailRepresentationSelect() {
299
+ return {
300
+ kind: 'Fragment',
301
+ version: VERSION$4,
302
+ private: [],
303
+ opaque: true
304
+ };
305
+ };
306
+ function equals$4(existing, incoming) {
307
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
308
+ return false;
309
+ }
310
+ return true;
311
+ }
312
+ const ingest$4 = function LightningTypeDetailRepresentationIngest(input, path, luvio, store, timestamp) {
313
+ if (process.env.NODE_ENV !== 'production') {
314
+ const validateError = validate$e(input);
315
+ if (validateError !== null) {
316
+ throw validateError;
317
+ }
318
+ }
319
+ const key = path.fullPath;
320
+ const ttlToUse = TTL$4;
321
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$4, "lightning-types", VERSION$4, RepresentationType$4, equals$4);
322
+ return createLink(key);
323
+ };
324
+ function getTypeCacheKeys$4(rootKeySet, luvio, input, fullPathFactory) {
325
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
326
+ const rootKey = fullPathFactory();
327
+ rootKeySet.set(rootKey, {
328
+ namespace: keyPrefix,
329
+ representationName: RepresentationType$4,
330
+ mergeable: false
331
+ });
332
+ }
333
+
334
+ function select$7(luvio, params) {
335
+ return select$8();
336
+ }
337
+ function keyBuilder$7(luvio, params) {
338
+ return keyPrefix + '::LightningTypeDetailRepresentation:(' + 'editorConfigTarget:' + params.queryParams.editorConfigTarget + ',' + 'expandConfigs:' + params.queryParams.expandConfigs + ',' + 'includeSubSchemaDefinitions:' + params.queryParams.includeSubSchemaDefinitions + ',' + 'language:' + params.queryParams.language + ',' + 'rendererConfigTarget:' + params.queryParams.rendererConfigTarget + ',' + 'fullyQualifiedName:' + params.urlParams.fullyQualifiedName + ')';
339
+ }
340
+ function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
341
+ getTypeCacheKeys$4(storeKeyMap, luvio, response, () => keyBuilder$7(luvio, resourceParams));
342
+ }
343
+ function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
344
+ const { body } = response;
345
+ const key = keyBuilder$7(luvio, resourceParams);
346
+ luvio.storeIngest(key, ingest$4, body);
347
+ const snapshot = luvio.storeLookup({
348
+ recordId: key,
349
+ node: select$7(),
350
+ variables: {},
351
+ }, snapshotRefresh);
352
+ if (process.env.NODE_ENV !== 'production') {
353
+ if (snapshot.state !== 'Fulfilled') {
354
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
355
+ }
356
+ }
357
+ deepFreeze(snapshot.data);
358
+ return snapshot;
359
+ }
360
+ function ingestError$3(luvio, params, error, snapshotRefresh) {
361
+ const key = keyBuilder$7(luvio, params);
362
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
363
+ const storeMetadataParams = {
364
+ ttl: TTL$4,
365
+ namespace: keyPrefix,
366
+ version: VERSION$4,
367
+ representationName: RepresentationType$4
368
+ };
369
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
370
+ return errorSnapshot;
371
+ }
372
+ function createResourceRequest$3(config) {
373
+ const headers = {};
374
+ return {
375
+ baseUri: '/services/data/v66.0',
376
+ basePath: '/connect/lightning-types/' + config.urlParams.fullyQualifiedName + '',
377
+ method: 'get',
378
+ body: null,
379
+ urlParams: config.urlParams,
380
+ queryParams: config.queryParams,
381
+ headers,
382
+ priority: 'normal',
383
+ };
384
+ }
385
+
386
+ const adapterName$3 = 'getLightningType';
387
+ const getLightningType_ConfigPropertyMetadata = [
388
+ generateParamConfigMetadata('fullyQualifiedName', true, 0 /* UrlParameter */, 0 /* String */),
389
+ generateParamConfigMetadata('editorConfigTarget', false, 1 /* QueryParameter */, 0 /* String */),
390
+ generateParamConfigMetadata('expandConfigs', false, 1 /* QueryParameter */, 1 /* Boolean */),
391
+ generateParamConfigMetadata('includeSubSchemaDefinitions', false, 1 /* QueryParameter */, 1 /* Boolean */),
392
+ generateParamConfigMetadata('language', false, 1 /* QueryParameter */, 0 /* String */),
393
+ generateParamConfigMetadata('rendererConfigTarget', false, 1 /* QueryParameter */, 0 /* String */),
394
+ ];
395
+ const getLightningType_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, getLightningType_ConfigPropertyMetadata);
396
+ const createResourceParams$3 = /*#__PURE__*/ createResourceParams$4(getLightningType_ConfigPropertyMetadata);
397
+ function keyBuilder$6(luvio, config) {
398
+ const resourceParams = createResourceParams$3(config);
399
+ return keyBuilder$7(luvio, resourceParams);
400
+ }
401
+ function typeCheckConfig$3(untrustedConfig) {
402
+ const config = {};
403
+ typeCheckConfig$4(untrustedConfig, config, getLightningType_ConfigPropertyMetadata);
404
+ return config;
405
+ }
406
+ function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
407
+ if (!untrustedIsObject(untrustedConfig)) {
408
+ return null;
409
+ }
410
+ if (process.env.NODE_ENV !== 'production') {
411
+ validateConfig(untrustedConfig, configPropertyNames);
412
+ }
413
+ const config = typeCheckConfig$3(untrustedConfig);
414
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
415
+ return null;
416
+ }
417
+ return config;
418
+ }
419
+ function adapterFragment$3(luvio, config) {
420
+ createResourceParams$3(config);
421
+ return select$7();
422
+ }
423
+ function onFetchResponseSuccess$3(luvio, config, resourceParams, response) {
424
+ const snapshot = ingestSuccess$3(luvio, resourceParams, response, {
425
+ config,
426
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
427
+ });
428
+ return luvio.storeBroadcast().then(() => snapshot);
429
+ }
430
+ function onFetchResponseError$3(luvio, config, resourceParams, response) {
431
+ const snapshot = ingestError$3(luvio, resourceParams, response, {
432
+ config,
433
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
434
+ });
435
+ return luvio.storeBroadcast().then(() => snapshot);
436
+ }
437
+ function buildNetworkSnapshot$3(luvio, config, options) {
438
+ const resourceParams = createResourceParams$3(config);
439
+ const request = createResourceRequest$3(resourceParams);
440
+ return luvio.dispatchResourceRequest(request, options)
441
+ .then((response) => {
442
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$3(luvio, config, resourceParams, response), () => {
443
+ const cache = new StoreKeyMap();
444
+ getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
445
+ return cache;
446
+ });
447
+ }, (response) => {
448
+ return luvio.handleErrorResponse(() => onFetchResponseError$3(luvio, config, resourceParams, response));
449
+ });
450
+ }
451
+ function buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext) {
452
+ return buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext, buildNetworkSnapshot$3, undefined, false);
453
+ }
454
+ function buildCachedSnapshotCachePolicy$3(context, storeLookup) {
455
+ const { luvio, config } = context;
456
+ const selector = {
457
+ recordId: keyBuilder$6(luvio, config),
458
+ node: adapterFragment$3(luvio, config),
459
+ variables: {},
460
+ };
461
+ const cacheSnapshot = storeLookup(selector, {
462
+ config,
463
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
464
+ });
465
+ return cacheSnapshot;
466
+ }
467
+ const getLightningTypeAdapterFactory = (luvio) => function lightningTypes__getLightningType(untrustedConfig, requestContext) {
468
+ const config = validateAdapterConfig$3(untrustedConfig, getLightningType_ConfigPropertyNames);
469
+ // Invalid or incomplete config
470
+ if (config === null) {
471
+ return null;
472
+ }
473
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
474
+ buildCachedSnapshotCachePolicy$3, buildNetworkSnapshotCachePolicy$3);
475
+ };
476
+
477
+ const TTL$3 = 100;
478
+ const VERSION$3 = "0041e3158f20c73cba96d196c285c20f";
479
+ function validate$d(obj, path = 'LightningTypeSummaryRepresentation') {
480
+ const v_error = (() => {
481
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
482
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
483
+ }
484
+ if (obj.description !== undefined) {
485
+ const obj_description = obj.description;
486
+ const path_description = path + '.description';
487
+ let obj_description_union0 = null;
488
+ const obj_description_union0_error = (() => {
489
+ if (typeof obj_description !== 'string') {
490
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
491
+ }
492
+ })();
493
+ if (obj_description_union0_error != null) {
494
+ obj_description_union0 = obj_description_union0_error.message;
495
+ }
496
+ let obj_description_union1 = null;
497
+ const obj_description_union1_error = (() => {
498
+ if (obj_description !== null) {
499
+ return new TypeError('Expected "null" but received "' + typeof obj_description + '" (at "' + path_description + '")');
500
+ }
501
+ })();
502
+ if (obj_description_union1_error != null) {
503
+ obj_description_union1 = obj_description_union1_error.message;
504
+ }
505
+ if (obj_description_union0 && obj_description_union1) {
506
+ let message = 'Object doesn\'t match union (at "' + path_description + '")';
507
+ message += '\n' + obj_description_union0.split('\n').map((line) => '\t' + line).join('\n');
508
+ message += '\n' + obj_description_union1.split('\n').map((line) => '\t' + line).join('\n');
509
+ return new TypeError(message);
510
+ }
511
+ }
512
+ if (obj.detailUrl !== undefined) {
513
+ const obj_detailUrl = obj.detailUrl;
514
+ const path_detailUrl = path + '.detailUrl';
515
+ let obj_detailUrl_union0 = null;
516
+ const obj_detailUrl_union0_error = (() => {
517
+ if (typeof obj_detailUrl !== 'string') {
518
+ return new TypeError('Expected "string" but received "' + typeof obj_detailUrl + '" (at "' + path_detailUrl + '")');
519
+ }
520
+ })();
521
+ if (obj_detailUrl_union0_error != null) {
522
+ obj_detailUrl_union0 = obj_detailUrl_union0_error.message;
523
+ }
524
+ let obj_detailUrl_union1 = null;
525
+ const obj_detailUrl_union1_error = (() => {
526
+ if (obj_detailUrl !== null) {
527
+ return new TypeError('Expected "null" but received "' + typeof obj_detailUrl + '" (at "' + path_detailUrl + '")');
528
+ }
529
+ })();
530
+ if (obj_detailUrl_union1_error != null) {
531
+ obj_detailUrl_union1 = obj_detailUrl_union1_error.message;
532
+ }
533
+ if (obj_detailUrl_union0 && obj_detailUrl_union1) {
534
+ let message = 'Object doesn\'t match union (at "' + path_detailUrl + '")';
535
+ message += '\n' + obj_detailUrl_union0.split('\n').map((line) => '\t' + line).join('\n');
536
+ message += '\n' + obj_detailUrl_union1.split('\n').map((line) => '\t' + line).join('\n');
537
+ return new TypeError(message);
538
+ }
539
+ }
540
+ const obj_developerName = obj.developerName;
541
+ const path_developerName = path + '.developerName';
542
+ let obj_developerName_union0 = null;
543
+ const obj_developerName_union0_error = (() => {
544
+ if (typeof obj_developerName !== 'string') {
545
+ return new TypeError('Expected "string" but received "' + typeof obj_developerName + '" (at "' + path_developerName + '")');
546
+ }
547
+ })();
548
+ if (obj_developerName_union0_error != null) {
549
+ obj_developerName_union0 = obj_developerName_union0_error.message;
550
+ }
551
+ let obj_developerName_union1 = null;
552
+ const obj_developerName_union1_error = (() => {
553
+ if (obj_developerName !== null) {
554
+ return new TypeError('Expected "null" but received "' + typeof obj_developerName + '" (at "' + path_developerName + '")');
555
+ }
556
+ })();
557
+ if (obj_developerName_union1_error != null) {
558
+ obj_developerName_union1 = obj_developerName_union1_error.message;
559
+ }
560
+ if (obj_developerName_union0 && obj_developerName_union1) {
561
+ let message = 'Object doesn\'t match union (at "' + path_developerName + '")';
562
+ message += '\n' + obj_developerName_union0.split('\n').map((line) => '\t' + line).join('\n');
563
+ message += '\n' + obj_developerName_union1.split('\n').map((line) => '\t' + line).join('\n');
564
+ return new TypeError(message);
565
+ }
566
+ if (obj.id !== undefined) {
567
+ const obj_id = obj.id;
568
+ const path_id = path + '.id';
569
+ let obj_id_union0 = null;
570
+ const obj_id_union0_error = (() => {
571
+ if (typeof obj_id !== 'string') {
572
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
573
+ }
574
+ })();
575
+ if (obj_id_union0_error != null) {
576
+ obj_id_union0 = obj_id_union0_error.message;
577
+ }
578
+ let obj_id_union1 = null;
579
+ const obj_id_union1_error = (() => {
580
+ if (obj_id !== null) {
581
+ return new TypeError('Expected "null" but received "' + typeof obj_id + '" (at "' + path_id + '")');
582
+ }
583
+ })();
584
+ if (obj_id_union1_error != null) {
585
+ obj_id_union1 = obj_id_union1_error.message;
586
+ }
587
+ if (obj_id_union0 && obj_id_union1) {
588
+ let message = 'Object doesn\'t match union (at "' + path_id + '")';
589
+ message += '\n' + obj_id_union0.split('\n').map((line) => '\t' + line).join('\n');
590
+ message += '\n' + obj_id_union1.split('\n').map((line) => '\t' + line).join('\n');
591
+ return new TypeError(message);
592
+ }
593
+ }
594
+ const obj_namespacePrefix = obj.namespacePrefix;
595
+ const path_namespacePrefix = path + '.namespacePrefix';
596
+ let obj_namespacePrefix_union0 = null;
597
+ const obj_namespacePrefix_union0_error = (() => {
598
+ if (typeof obj_namespacePrefix !== 'string') {
599
+ return new TypeError('Expected "string" but received "' + typeof obj_namespacePrefix + '" (at "' + path_namespacePrefix + '")');
600
+ }
601
+ })();
602
+ if (obj_namespacePrefix_union0_error != null) {
603
+ obj_namespacePrefix_union0 = obj_namespacePrefix_union0_error.message;
604
+ }
605
+ let obj_namespacePrefix_union1 = null;
606
+ const obj_namespacePrefix_union1_error = (() => {
607
+ if (obj_namespacePrefix !== null) {
608
+ return new TypeError('Expected "null" but received "' + typeof obj_namespacePrefix + '" (at "' + path_namespacePrefix + '")');
609
+ }
610
+ })();
611
+ if (obj_namespacePrefix_union1_error != null) {
612
+ obj_namespacePrefix_union1 = obj_namespacePrefix_union1_error.message;
613
+ }
614
+ if (obj_namespacePrefix_union0 && obj_namespacePrefix_union1) {
615
+ let message = 'Object doesn\'t match union (at "' + path_namespacePrefix + '")';
616
+ message += '\n' + obj_namespacePrefix_union0.split('\n').map((line) => '\t' + line).join('\n');
617
+ message += '\n' + obj_namespacePrefix_union1.split('\n').map((line) => '\t' + line).join('\n');
618
+ return new TypeError(message);
619
+ }
620
+ if (obj.title !== undefined) {
621
+ const obj_title = obj.title;
622
+ const path_title = path + '.title';
623
+ let obj_title_union0 = null;
624
+ const obj_title_union0_error = (() => {
625
+ if (typeof obj_title !== 'string') {
626
+ return new TypeError('Expected "string" but received "' + typeof obj_title + '" (at "' + path_title + '")');
627
+ }
628
+ })();
629
+ if (obj_title_union0_error != null) {
630
+ obj_title_union0 = obj_title_union0_error.message;
631
+ }
632
+ let obj_title_union1 = null;
633
+ const obj_title_union1_error = (() => {
634
+ if (obj_title !== null) {
635
+ return new TypeError('Expected "null" but received "' + typeof obj_title + '" (at "' + path_title + '")');
636
+ }
637
+ })();
638
+ if (obj_title_union1_error != null) {
639
+ obj_title_union1 = obj_title_union1_error.message;
640
+ }
641
+ if (obj_title_union0 && obj_title_union1) {
642
+ let message = 'Object doesn\'t match union (at "' + path_title + '")';
643
+ message += '\n' + obj_title_union0.split('\n').map((line) => '\t' + line).join('\n');
644
+ message += '\n' + obj_title_union1.split('\n').map((line) => '\t' + line).join('\n');
645
+ return new TypeError(message);
646
+ }
647
+ }
648
+ })();
649
+ return v_error === undefined ? null : v_error;
650
+ }
651
+ const RepresentationType$3 = 'LightningTypeSummaryRepresentation';
652
+ function normalize$3(input, existing, path, luvio, store, timestamp) {
653
+ return input;
654
+ }
655
+ const select$6 = function LightningTypeSummaryRepresentationSelect() {
656
+ return {
657
+ kind: 'Fragment',
658
+ version: VERSION$3,
659
+ private: [],
660
+ opaque: true
661
+ };
662
+ };
663
+ function equals$3(existing, incoming) {
664
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
665
+ return false;
666
+ }
667
+ return true;
668
+ }
669
+ const ingest$3 = function LightningTypeSummaryRepresentationIngest(input, path, luvio, store, timestamp) {
670
+ if (process.env.NODE_ENV !== 'production') {
671
+ const validateError = validate$d(input);
672
+ if (validateError !== null) {
673
+ throw validateError;
674
+ }
675
+ }
676
+ const key = path.fullPath;
677
+ const ttlToUse = TTL$3;
678
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "lightning-types", VERSION$3, RepresentationType$3, equals$3);
679
+ return createLink(key);
680
+ };
681
+ function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
682
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
683
+ const rootKey = fullPathFactory();
684
+ rootKeySet.set(rootKey, {
685
+ namespace: keyPrefix,
686
+ representationName: RepresentationType$3,
687
+ mergeable: false
688
+ });
689
+ }
690
+
691
+ const TTL$2 = 100;
692
+ const VERSION$2 = "c66a5dd98fb4b617c447b5ec059204fd";
693
+ function validate$c(obj, path = 'LightningTypeCollectionRepresentation') {
694
+ const v_error = (() => {
695
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
696
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
697
+ }
698
+ const obj_count = obj.count;
699
+ const path_count = path + '.count';
700
+ if (typeof obj_count !== 'number' || (typeof obj_count === 'number' && Math.floor(obj_count) !== obj_count)) {
701
+ return new TypeError('Expected "integer" but received "' + typeof obj_count + '" (at "' + path_count + '")');
702
+ }
703
+ const obj_currentPageUrl = obj.currentPageUrl;
704
+ const path_currentPageUrl = path + '.currentPageUrl';
705
+ let obj_currentPageUrl_union0 = null;
706
+ const obj_currentPageUrl_union0_error = (() => {
707
+ if (typeof obj_currentPageUrl !== 'string') {
708
+ return new TypeError('Expected "string" but received "' + typeof obj_currentPageUrl + '" (at "' + path_currentPageUrl + '")');
709
+ }
710
+ })();
711
+ if (obj_currentPageUrl_union0_error != null) {
712
+ obj_currentPageUrl_union0 = obj_currentPageUrl_union0_error.message;
713
+ }
714
+ let obj_currentPageUrl_union1 = null;
715
+ const obj_currentPageUrl_union1_error = (() => {
716
+ if (obj_currentPageUrl !== null) {
717
+ return new TypeError('Expected "null" but received "' + typeof obj_currentPageUrl + '" (at "' + path_currentPageUrl + '")');
718
+ }
719
+ })();
720
+ if (obj_currentPageUrl_union1_error != null) {
721
+ obj_currentPageUrl_union1 = obj_currentPageUrl_union1_error.message;
722
+ }
723
+ if (obj_currentPageUrl_union0 && obj_currentPageUrl_union1) {
724
+ let message = 'Object doesn\'t match union (at "' + path_currentPageUrl + '")';
725
+ message += '\n' + obj_currentPageUrl_union0.split('\n').map((line) => '\t' + line).join('\n');
726
+ message += '\n' + obj_currentPageUrl_union1.split('\n').map((line) => '\t' + line).join('\n');
727
+ return new TypeError(message);
728
+ }
729
+ const obj_lightningTypes = obj.lightningTypes;
730
+ const path_lightningTypes = path + '.lightningTypes';
731
+ if (!ArrayIsArray(obj_lightningTypes)) {
732
+ return new TypeError('Expected "array" but received "' + typeof obj_lightningTypes + '" (at "' + path_lightningTypes + '")');
733
+ }
734
+ for (let i = 0; i < obj_lightningTypes.length; i++) {
735
+ const obj_lightningTypes_item = obj_lightningTypes[i];
736
+ const path_lightningTypes_item = path_lightningTypes + '[' + i + ']';
737
+ if (typeof obj_lightningTypes_item !== 'object' || Array.isArray(obj_lightningTypes_item)) {
738
+ return new TypeError('Expected "object" but received "' + typeof obj_lightningTypes_item + '" (at "' + path_lightningTypes_item + '")');
739
+ }
740
+ }
741
+ if (obj.nextPageUrl !== undefined) {
742
+ const obj_nextPageUrl = obj.nextPageUrl;
743
+ const path_nextPageUrl = path + '.nextPageUrl';
744
+ let obj_nextPageUrl_union0 = null;
745
+ const obj_nextPageUrl_union0_error = (() => {
746
+ if (typeof obj_nextPageUrl !== 'string') {
747
+ return new TypeError('Expected "string" but received "' + typeof obj_nextPageUrl + '" (at "' + path_nextPageUrl + '")');
748
+ }
749
+ })();
750
+ if (obj_nextPageUrl_union0_error != null) {
751
+ obj_nextPageUrl_union0 = obj_nextPageUrl_union0_error.message;
752
+ }
753
+ let obj_nextPageUrl_union1 = null;
754
+ const obj_nextPageUrl_union1_error = (() => {
755
+ if (obj_nextPageUrl !== null) {
756
+ return new TypeError('Expected "null" but received "' + typeof obj_nextPageUrl + '" (at "' + path_nextPageUrl + '")');
757
+ }
758
+ })();
759
+ if (obj_nextPageUrl_union1_error != null) {
760
+ obj_nextPageUrl_union1 = obj_nextPageUrl_union1_error.message;
761
+ }
762
+ if (obj_nextPageUrl_union0 && obj_nextPageUrl_union1) {
763
+ let message = 'Object doesn\'t match union (at "' + path_nextPageUrl + '")';
764
+ message += '\n' + obj_nextPageUrl_union0.split('\n').map((line) => '\t' + line).join('\n');
765
+ message += '\n' + obj_nextPageUrl_union1.split('\n').map((line) => '\t' + line).join('\n');
766
+ return new TypeError(message);
767
+ }
768
+ }
769
+ if (obj.previousPageUrl !== undefined) {
770
+ const obj_previousPageUrl = obj.previousPageUrl;
771
+ const path_previousPageUrl = path + '.previousPageUrl';
772
+ let obj_previousPageUrl_union0 = null;
773
+ const obj_previousPageUrl_union0_error = (() => {
774
+ if (typeof obj_previousPageUrl !== 'string') {
775
+ return new TypeError('Expected "string" but received "' + typeof obj_previousPageUrl + '" (at "' + path_previousPageUrl + '")');
776
+ }
777
+ })();
778
+ if (obj_previousPageUrl_union0_error != null) {
779
+ obj_previousPageUrl_union0 = obj_previousPageUrl_union0_error.message;
780
+ }
781
+ let obj_previousPageUrl_union1 = null;
782
+ const obj_previousPageUrl_union1_error = (() => {
783
+ if (obj_previousPageUrl !== null) {
784
+ return new TypeError('Expected "null" but received "' + typeof obj_previousPageUrl + '" (at "' + path_previousPageUrl + '")');
785
+ }
786
+ })();
787
+ if (obj_previousPageUrl_union1_error != null) {
788
+ obj_previousPageUrl_union1 = obj_previousPageUrl_union1_error.message;
789
+ }
790
+ if (obj_previousPageUrl_union0 && obj_previousPageUrl_union1) {
791
+ let message = 'Object doesn\'t match union (at "' + path_previousPageUrl + '")';
792
+ message += '\n' + obj_previousPageUrl_union0.split('\n').map((line) => '\t' + line).join('\n');
793
+ message += '\n' + obj_previousPageUrl_union1.split('\n').map((line) => '\t' + line).join('\n');
794
+ return new TypeError(message);
795
+ }
796
+ }
797
+ })();
798
+ return v_error === undefined ? null : v_error;
799
+ }
800
+ const RepresentationType$2 = 'LightningTypeCollectionRepresentation';
801
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
802
+ const input_lightningTypes = input.lightningTypes;
803
+ const input_lightningTypes_id = path.fullPath + '__lightningTypes';
804
+ for (let i = 0; i < input_lightningTypes.length; i++) {
805
+ const input_lightningTypes_item = input_lightningTypes[i];
806
+ let input_lightningTypes_item_id = input_lightningTypes_id + '__' + i;
807
+ input_lightningTypes[i] = ingest$3(input_lightningTypes_item, {
808
+ fullPath: input_lightningTypes_item_id,
809
+ propertyName: i,
810
+ parent: {
811
+ data: input,
812
+ key: path.fullPath,
813
+ existing: existing,
814
+ },
815
+ ttl: path.ttl
816
+ }, luvio, store, timestamp);
817
+ }
818
+ return input;
819
+ }
820
+ const select$5 = function LightningTypeCollectionRepresentationSelect() {
821
+ return {
822
+ kind: 'Fragment',
823
+ version: VERSION$2,
824
+ private: [],
825
+ selections: [
826
+ {
827
+ name: 'count',
828
+ kind: 'Scalar'
829
+ },
830
+ {
831
+ name: 'currentPageUrl',
832
+ kind: 'Scalar'
833
+ },
834
+ {
835
+ name: 'lightningTypes',
836
+ kind: 'Link',
837
+ plural: true,
838
+ fragment: select$6()
839
+ },
840
+ {
841
+ name: 'nextPageUrl',
842
+ kind: 'Scalar',
843
+ required: false
844
+ },
845
+ {
846
+ name: 'previousPageUrl',
847
+ kind: 'Scalar',
848
+ required: false
849
+ }
850
+ ]
851
+ };
852
+ };
853
+ function equals$2(existing, incoming) {
854
+ const existing_count = existing.count;
855
+ const incoming_count = incoming.count;
856
+ if (!(existing_count === incoming_count)) {
857
+ return false;
858
+ }
859
+ const existing_currentPageUrl = existing.currentPageUrl;
860
+ const incoming_currentPageUrl = incoming.currentPageUrl;
861
+ if (!(existing_currentPageUrl === incoming_currentPageUrl)) {
862
+ return false;
863
+ }
864
+ const existing_lightningTypes = existing.lightningTypes;
865
+ const incoming_lightningTypes = incoming.lightningTypes;
866
+ const equals_lightningTypes_items = equalsArray(existing_lightningTypes, incoming_lightningTypes, (existing_lightningTypes_item, incoming_lightningTypes_item) => {
867
+ if (!(existing_lightningTypes_item.__ref === incoming_lightningTypes_item.__ref)) {
868
+ return false;
869
+ }
870
+ });
871
+ if (equals_lightningTypes_items === false) {
872
+ return false;
873
+ }
874
+ const existing_nextPageUrl = existing.nextPageUrl;
875
+ const incoming_nextPageUrl = incoming.nextPageUrl;
876
+ // if at least one of these optionals is defined
877
+ if (existing_nextPageUrl !== undefined || incoming_nextPageUrl !== undefined) {
878
+ // if one of these is not defined we know the other is defined and therefore
879
+ // not equal
880
+ if (existing_nextPageUrl === undefined || incoming_nextPageUrl === undefined) {
881
+ return false;
882
+ }
883
+ if (!(existing_nextPageUrl === incoming_nextPageUrl)) {
884
+ return false;
885
+ }
886
+ }
887
+ const existing_previousPageUrl = existing.previousPageUrl;
888
+ const incoming_previousPageUrl = incoming.previousPageUrl;
889
+ // if at least one of these optionals is defined
890
+ if (existing_previousPageUrl !== undefined || incoming_previousPageUrl !== undefined) {
891
+ // if one of these is not defined we know the other is defined and therefore
892
+ // not equal
893
+ if (existing_previousPageUrl === undefined || incoming_previousPageUrl === undefined) {
894
+ return false;
895
+ }
896
+ if (!(existing_previousPageUrl === incoming_previousPageUrl)) {
897
+ return false;
898
+ }
899
+ }
900
+ return true;
901
+ }
902
+ const ingest$2 = function LightningTypeCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
903
+ if (process.env.NODE_ENV !== 'production') {
904
+ const validateError = validate$c(input);
905
+ if (validateError !== null) {
906
+ throw validateError;
907
+ }
908
+ }
909
+ const key = path.fullPath;
910
+ const ttlToUse = TTL$2;
911
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "lightning-types", VERSION$2, RepresentationType$2, equals$2);
912
+ return createLink(key);
913
+ };
914
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
915
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
916
+ const rootKey = fullPathFactory();
917
+ rootKeySet.set(rootKey, {
918
+ namespace: keyPrefix,
919
+ representationName: RepresentationType$2,
920
+ mergeable: false
921
+ });
922
+ const input_lightningTypes_length = input.lightningTypes.length;
923
+ for (let i = 0; i < input_lightningTypes_length; i++) {
924
+ getTypeCacheKeys$3(rootKeySet, luvio, input.lightningTypes[i], () => '');
925
+ }
926
+ }
927
+
928
+ function select$4(luvio, params) {
929
+ return select$5();
930
+ }
931
+ function keyBuilder$5(luvio, params) {
932
+ return keyPrefix + '::LightningTypeCollectionRepresentation:(' + 'editorConfigTarget:' + params.queryParams.editorConfigTarget + ',' + 'excludeStandardTypes:' + params.queryParams.excludeStandardTypes + ',' + 'fullyQualifiedNames:' + params.queryParams.fullyQualifiedNames + ',' + 'language:' + params.queryParams.language + ',' + 'page:' + params.queryParams.page + ',' + 'pageSize:' + params.queryParams.pageSize + ',' + 'rendererConfigTarget:' + params.queryParams.rendererConfigTarget + ')';
933
+ }
934
+ function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
935
+ getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$5(luvio, resourceParams));
936
+ }
937
+ function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
938
+ const { body } = response;
939
+ const key = keyBuilder$5(luvio, resourceParams);
940
+ luvio.storeIngest(key, ingest$2, body);
941
+ const snapshot = luvio.storeLookup({
942
+ recordId: key,
943
+ node: select$4(),
944
+ variables: {},
945
+ }, snapshotRefresh);
946
+ if (process.env.NODE_ENV !== 'production') {
947
+ if (snapshot.state !== 'Fulfilled') {
948
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
949
+ }
950
+ }
951
+ deepFreeze(snapshot.data);
952
+ return snapshot;
953
+ }
954
+ function ingestError$2(luvio, params, error, snapshotRefresh) {
955
+ const key = keyBuilder$5(luvio, params);
956
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
957
+ const storeMetadataParams = {
958
+ ttl: TTL$2,
959
+ namespace: keyPrefix,
960
+ version: VERSION$2,
961
+ representationName: RepresentationType$2
962
+ };
963
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
964
+ return errorSnapshot;
965
+ }
966
+ function createResourceRequest$2(config) {
967
+ const headers = {};
968
+ return {
969
+ baseUri: '/services/data/v66.0',
970
+ basePath: '/connect/lightning-types',
971
+ method: 'get',
972
+ body: null,
973
+ urlParams: {},
974
+ queryParams: config.queryParams,
975
+ headers,
976
+ priority: 'normal',
977
+ };
978
+ }
979
+
980
+ const adapterName$2 = 'getLightningTypes';
981
+ const getLightningTypes_ConfigPropertyMetadata = [
982
+ generateParamConfigMetadata('editorConfigTarget', false, 1 /* QueryParameter */, 0 /* String */),
983
+ generateParamConfigMetadata('excludeStandardTypes', false, 1 /* QueryParameter */, 1 /* Boolean */),
984
+ generateParamConfigMetadata('fullyQualifiedNames', false, 1 /* QueryParameter */, 0 /* String */, true),
985
+ generateParamConfigMetadata('language', false, 1 /* QueryParameter */, 0 /* String */),
986
+ generateParamConfigMetadata('page', false, 1 /* QueryParameter */, 3 /* Integer */),
987
+ generateParamConfigMetadata('pageSize', false, 1 /* QueryParameter */, 3 /* Integer */),
988
+ generateParamConfigMetadata('rendererConfigTarget', false, 1 /* QueryParameter */, 0 /* String */),
989
+ ];
990
+ const getLightningTypes_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getLightningTypes_ConfigPropertyMetadata);
991
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$4(getLightningTypes_ConfigPropertyMetadata);
992
+ function keyBuilder$4(luvio, config) {
993
+ const resourceParams = createResourceParams$2(config);
994
+ return keyBuilder$5(luvio, resourceParams);
995
+ }
996
+ function typeCheckConfig$2(untrustedConfig) {
997
+ const config = {};
998
+ typeCheckConfig$4(untrustedConfig, config, getLightningTypes_ConfigPropertyMetadata);
999
+ return config;
1000
+ }
1001
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
1002
+ if (!untrustedIsObject(untrustedConfig)) {
1003
+ return null;
1004
+ }
1005
+ if (process.env.NODE_ENV !== 'production') {
1006
+ validateConfig(untrustedConfig, configPropertyNames);
1007
+ }
1008
+ const config = typeCheckConfig$2(untrustedConfig);
1009
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1010
+ return null;
1011
+ }
1012
+ return config;
1013
+ }
1014
+ function adapterFragment$2(luvio, config) {
1015
+ createResourceParams$2(config);
1016
+ return select$4();
1017
+ }
1018
+ function onFetchResponseSuccess$2(luvio, config, resourceParams, response) {
1019
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
1020
+ config,
1021
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
1022
+ });
1023
+ return luvio.storeBroadcast().then(() => snapshot);
1024
+ }
1025
+ function onFetchResponseError$2(luvio, config, resourceParams, response) {
1026
+ const snapshot = ingestError$2(luvio, resourceParams, response, {
1027
+ config,
1028
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
1029
+ });
1030
+ return luvio.storeBroadcast().then(() => snapshot);
1031
+ }
1032
+ function buildNetworkSnapshot$2(luvio, config, options) {
1033
+ const resourceParams = createResourceParams$2(config);
1034
+ const request = createResourceRequest$2(resourceParams);
1035
+ return luvio.dispatchResourceRequest(request, options)
1036
+ .then((response) => {
1037
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$2(luvio, config, resourceParams, response), () => {
1038
+ const cache = new StoreKeyMap();
1039
+ getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
1040
+ return cache;
1041
+ });
1042
+ }, (response) => {
1043
+ return luvio.handleErrorResponse(() => onFetchResponseError$2(luvio, config, resourceParams, response));
1044
+ });
1045
+ }
1046
+ function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
1047
+ return buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
1048
+ }
1049
+ function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
1050
+ const { luvio, config } = context;
1051
+ const selector = {
1052
+ recordId: keyBuilder$4(luvio, config),
1053
+ node: adapterFragment$2(luvio, config),
1054
+ variables: {},
1055
+ };
1056
+ const cacheSnapshot = storeLookup(selector, {
1057
+ config,
1058
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
1059
+ });
1060
+ return cacheSnapshot;
1061
+ }
1062
+ const getLightningTypesAdapterFactory = (luvio) => function lightningTypes__getLightningTypes(untrustedConfig, requestContext) {
1063
+ const config = validateAdapterConfig$2(untrustedConfig, getLightningTypes_ConfigPropertyNames);
1064
+ // Invalid or incomplete config
1065
+ if (config === null) {
1066
+ return null;
1067
+ }
1068
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1069
+ buildCachedSnapshotCachePolicy$2, buildNetworkSnapshotCachePolicy$2);
1070
+ };
1071
+
1072
+ function validate$b(obj, path = 'LightningModelEditorConfigInputRepresentation') {
1073
+ const v_error = (() => {
1074
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1075
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1076
+ }
1077
+ if (obj.actionConfig !== undefined) {
1078
+ const obj_actionConfig = obj.actionConfig;
1079
+ const path_actionConfig = path + '.actionConfig';
1080
+ if (typeof obj_actionConfig !== 'boolean') {
1081
+ return new TypeError('Expected "boolean" but received "' + typeof obj_actionConfig + '" (at "' + path_actionConfig + '")');
1082
+ }
1083
+ }
1084
+ if (obj.maxViewDepth !== undefined) {
1085
+ const obj_maxViewDepth = obj.maxViewDepth;
1086
+ const path_maxViewDepth = path + '.maxViewDepth';
1087
+ if (typeof obj_maxViewDepth !== 'number' || (typeof obj_maxViewDepth === 'number' && Math.floor(obj_maxViewDepth) !== obj_maxViewDepth)) {
1088
+ return new TypeError('Expected "integer" but received "' + typeof obj_maxViewDepth + '" (at "' + path_maxViewDepth + '")');
1089
+ }
1090
+ }
1091
+ if (obj.subViewDefinitions !== undefined) {
1092
+ const obj_subViewDefinitions = obj.subViewDefinitions;
1093
+ const path_subViewDefinitions = path + '.subViewDefinitions';
1094
+ if (typeof obj_subViewDefinitions !== 'boolean') {
1095
+ return new TypeError('Expected "boolean" but received "' + typeof obj_subViewDefinitions + '" (at "' + path_subViewDefinitions + '")');
1096
+ }
1097
+ }
1098
+ if (obj.target !== undefined) {
1099
+ const obj_target = obj.target;
1100
+ const path_target = path + '.target';
1101
+ if (typeof obj_target !== 'string') {
1102
+ return new TypeError('Expected "string" but received "' + typeof obj_target + '" (at "' + path_target + '")');
1103
+ }
1104
+ }
1105
+ })();
1106
+ return v_error === undefined ? null : v_error;
1107
+ }
1108
+
1109
+ function validate$a(obj, path = 'LightningModelRendererConfigInputRepresentation') {
1110
+ const v_error = (() => {
1111
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1112
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1113
+ }
1114
+ if (obj.actionConfig !== undefined) {
1115
+ const obj_actionConfig = obj.actionConfig;
1116
+ const path_actionConfig = path + '.actionConfig';
1117
+ if (typeof obj_actionConfig !== 'boolean') {
1118
+ return new TypeError('Expected "boolean" but received "' + typeof obj_actionConfig + '" (at "' + path_actionConfig + '")');
1119
+ }
1120
+ }
1121
+ if (obj.maxViewDepth !== undefined) {
1122
+ const obj_maxViewDepth = obj.maxViewDepth;
1123
+ const path_maxViewDepth = path + '.maxViewDepth';
1124
+ if (typeof obj_maxViewDepth !== 'number' || (typeof obj_maxViewDepth === 'number' && Math.floor(obj_maxViewDepth) !== obj_maxViewDepth)) {
1125
+ return new TypeError('Expected "integer" but received "' + typeof obj_maxViewDepth + '" (at "' + path_maxViewDepth + '")');
1126
+ }
1127
+ }
1128
+ if (obj.subViewDefinitions !== undefined) {
1129
+ const obj_subViewDefinitions = obj.subViewDefinitions;
1130
+ const path_subViewDefinitions = path + '.subViewDefinitions';
1131
+ if (typeof obj_subViewDefinitions !== 'boolean') {
1132
+ return new TypeError('Expected "boolean" but received "' + typeof obj_subViewDefinitions + '" (at "' + path_subViewDefinitions + '")');
1133
+ }
1134
+ }
1135
+ if (obj.target !== undefined) {
1136
+ const obj_target = obj.target;
1137
+ const path_target = path + '.target';
1138
+ if (typeof obj_target !== 'string') {
1139
+ return new TypeError('Expected "string" but received "' + typeof obj_target + '" (at "' + path_target + '")');
1140
+ }
1141
+ }
1142
+ })();
1143
+ return v_error === undefined ? null : v_error;
1144
+ }
1145
+
1146
+ function validate$9(obj, path = 'LightningModelFilterConfigInputRepresentation') {
1147
+ const v_error = (() => {
1148
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1149
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1150
+ }
1151
+ const obj_propertyNames = obj.propertyNames;
1152
+ const path_propertyNames = path + '.propertyNames';
1153
+ if (!ArrayIsArray(obj_propertyNames)) {
1154
+ return new TypeError('Expected "array" but received "' + typeof obj_propertyNames + '" (at "' + path_propertyNames + '")');
1155
+ }
1156
+ for (let i = 0; i < obj_propertyNames.length; i++) {
1157
+ const obj_propertyNames_item = obj_propertyNames[i];
1158
+ const path_propertyNames_item = path_propertyNames + '[' + i + ']';
1159
+ if (typeof obj_propertyNames_item !== 'string') {
1160
+ return new TypeError('Expected "string" but received "' + typeof obj_propertyNames_item + '" (at "' + path_propertyNames_item + '")');
1161
+ }
1162
+ }
1163
+ })();
1164
+ return v_error === undefined ? null : v_error;
1165
+ }
1166
+
1167
+ function validate$8(obj, path = 'LightningModelSchemaConfigInputRepresentation') {
1168
+ const v_error = (() => {
1169
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1170
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1171
+ }
1172
+ if (obj.filterConfig !== undefined) {
1173
+ const obj_filterConfig = obj.filterConfig;
1174
+ const path_filterConfig = path + '.filterConfig';
1175
+ const referencepath_filterConfigValidationError = validate$9(obj_filterConfig, path_filterConfig);
1176
+ if (referencepath_filterConfigValidationError !== null) {
1177
+ let message = 'Object doesn\'t match LightningModelFilterConfigInputRepresentation (at "' + path_filterConfig + '")\n';
1178
+ message += referencepath_filterConfigValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1179
+ return new TypeError(message);
1180
+ }
1181
+ }
1182
+ if (obj.subSchemaDefinitions !== undefined) {
1183
+ const obj_subSchemaDefinitions = obj.subSchemaDefinitions;
1184
+ const path_subSchemaDefinitions = path + '.subSchemaDefinitions';
1185
+ if (typeof obj_subSchemaDefinitions !== 'boolean') {
1186
+ return new TypeError('Expected "boolean" but received "' + typeof obj_subSchemaDefinitions + '" (at "' + path_subSchemaDefinitions + '")');
1187
+ }
1188
+ }
1189
+ })();
1190
+ return v_error === undefined ? null : v_error;
1191
+ }
1192
+
1193
+ function validate$7(obj, path = 'LightningModelSourceDescriptorInputRepresentation') {
1194
+ const v_error = (() => {
1195
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1196
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1197
+ }
1198
+ if (obj.descriptor !== undefined) {
1199
+ const obj_descriptor = obj.descriptor;
1200
+ const path_descriptor = path + '.descriptor';
1201
+ if (typeof obj_descriptor !== 'string') {
1202
+ return new TypeError('Expected "string" but received "' + typeof obj_descriptor + '" (at "' + path_descriptor + '")');
1203
+ }
1204
+ }
1205
+ if (obj.propertyName !== undefined) {
1206
+ const obj_propertyName = obj.propertyName;
1207
+ const path_propertyName = path + '.propertyName';
1208
+ if (typeof obj_propertyName !== 'string') {
1209
+ return new TypeError('Expected "string" but received "' + typeof obj_propertyName + '" (at "' + path_propertyName + '")');
1210
+ }
1211
+ }
1212
+ })();
1213
+ return v_error === undefined ? null : v_error;
1214
+ }
1215
+
1216
+ function validate$6(obj, path = 'LightningModelTypesConfigInputRepresentation') {
1217
+ const v_error = (() => {
1218
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1219
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1220
+ }
1221
+ const obj_descriptor = obj.descriptor;
1222
+ const path_descriptor = path + '.descriptor';
1223
+ if (typeof obj_descriptor !== 'string') {
1224
+ return new TypeError('Expected "string" but received "' + typeof obj_descriptor + '" (at "' + path_descriptor + '")');
1225
+ }
1226
+ if (obj.editorConfig !== undefined) {
1227
+ const obj_editorConfig = obj.editorConfig;
1228
+ const path_editorConfig = path + '.editorConfig';
1229
+ const referencepath_editorConfigValidationError = validate$b(obj_editorConfig, path_editorConfig);
1230
+ if (referencepath_editorConfigValidationError !== null) {
1231
+ let message = 'Object doesn\'t match LightningModelEditorConfigInputRepresentation (at "' + path_editorConfig + '")\n';
1232
+ message += referencepath_editorConfigValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1233
+ return new TypeError(message);
1234
+ }
1235
+ }
1236
+ if (obj.rendererConfig !== undefined) {
1237
+ const obj_rendererConfig = obj.rendererConfig;
1238
+ const path_rendererConfig = path + '.rendererConfig';
1239
+ const referencepath_rendererConfigValidationError = validate$a(obj_rendererConfig, path_rendererConfig);
1240
+ if (referencepath_rendererConfigValidationError !== null) {
1241
+ let message = 'Object doesn\'t match LightningModelRendererConfigInputRepresentation (at "' + path_rendererConfig + '")\n';
1242
+ message += referencepath_rendererConfigValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1243
+ return new TypeError(message);
1244
+ }
1245
+ }
1246
+ if (obj.schemaConfig !== undefined) {
1247
+ const obj_schemaConfig = obj.schemaConfig;
1248
+ const path_schemaConfig = path + '.schemaConfig';
1249
+ const referencepath_schemaConfigValidationError = validate$8(obj_schemaConfig, path_schemaConfig);
1250
+ if (referencepath_schemaConfigValidationError !== null) {
1251
+ let message = 'Object doesn\'t match LightningModelSchemaConfigInputRepresentation (at "' + path_schemaConfig + '")\n';
1252
+ message += referencepath_schemaConfigValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1253
+ return new TypeError(message);
1254
+ }
1255
+ }
1256
+ if (obj.sourceDescriptor !== undefined) {
1257
+ const obj_sourceDescriptor = obj.sourceDescriptor;
1258
+ const path_sourceDescriptor = path + '.sourceDescriptor';
1259
+ const referencepath_sourceDescriptorValidationError = validate$7(obj_sourceDescriptor, path_sourceDescriptor);
1260
+ if (referencepath_sourceDescriptorValidationError !== null) {
1261
+ let message = 'Object doesn\'t match LightningModelSourceDescriptorInputRepresentation (at "' + path_sourceDescriptor + '")\n';
1262
+ message += referencepath_sourceDescriptorValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1263
+ return new TypeError(message);
1264
+ }
1265
+ }
1266
+ })();
1267
+ return v_error === undefined ? null : v_error;
1268
+ }
1269
+
1270
+ function validate$5(obj, path = 'LightningModelTypesErrorRepresentation') {
1271
+ const v_error = (() => {
1272
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1273
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1274
+ }
1275
+ const obj_errorDescription = obj.errorDescription;
1276
+ const path_errorDescription = path + '.errorDescription';
1277
+ if (typeof obj_errorDescription !== 'string') {
1278
+ return new TypeError('Expected "string" but received "' + typeof obj_errorDescription + '" (at "' + path_errorDescription + '")');
1279
+ }
1280
+ const obj_errorTitle = obj.errorTitle;
1281
+ const path_errorTitle = path + '.errorTitle';
1282
+ if (typeof obj_errorTitle !== 'string') {
1283
+ return new TypeError('Expected "string" but received "' + typeof obj_errorTitle + '" (at "' + path_errorTitle + '")');
1284
+ }
1285
+ })();
1286
+ return v_error === undefined ? null : v_error;
1287
+ }
1288
+
1289
+ function validate$4(obj, path = 'LightningModelTypesRepresentation') {
1290
+ const v_error = (() => {
1291
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1292
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1293
+ }
1294
+ if (obj.description !== undefined) {
1295
+ const obj_description = obj.description;
1296
+ const path_description = path + '.description';
1297
+ if (typeof obj_description !== 'string') {
1298
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
1299
+ }
1300
+ }
1301
+ const obj_descriptor = obj.descriptor;
1302
+ const path_descriptor = path + '.descriptor';
1303
+ if (typeof obj_descriptor !== 'string') {
1304
+ return new TypeError('Expected "string" but received "' + typeof obj_descriptor + '" (at "' + path_descriptor + '")');
1305
+ }
1306
+ const obj_developerName = obj.developerName;
1307
+ const path_developerName = path + '.developerName';
1308
+ if (typeof obj_developerName !== 'string') {
1309
+ return new TypeError('Expected "string" but received "' + typeof obj_developerName + '" (at "' + path_developerName + '")');
1310
+ }
1311
+ if (obj.editorConfig !== undefined) {
1312
+ const obj_editorConfig = obj.editorConfig;
1313
+ const path_editorConfig = path + '.editorConfig';
1314
+ if (obj_editorConfig === undefined) {
1315
+ return new TypeError('Expected "defined" but received "' + typeof obj_editorConfig + '" (at "' + path_editorConfig + '")');
1316
+ }
1317
+ }
1318
+ if (obj.errorDetails !== undefined) {
1319
+ const obj_errorDetails = obj.errorDetails;
1320
+ const path_errorDetails = path + '.errorDetails';
1321
+ const referencepath_errorDetailsValidationError = validate$5(obj_errorDetails, path_errorDetails);
1322
+ if (referencepath_errorDetailsValidationError !== null) {
1323
+ let message = 'Object doesn\'t match LightningModelTypesErrorRepresentation (at "' + path_errorDetails + '")\n';
1324
+ message += referencepath_errorDetailsValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1325
+ return new TypeError(message);
1326
+ }
1327
+ }
1328
+ if (obj.id !== undefined) {
1329
+ const obj_id = obj.id;
1330
+ const path_id = path + '.id';
1331
+ if (typeof obj_id !== 'string') {
1332
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
1333
+ }
1334
+ }
1335
+ const obj_namespacePrefix = obj.namespacePrefix;
1336
+ const path_namespacePrefix = path + '.namespacePrefix';
1337
+ if (typeof obj_namespacePrefix !== 'string') {
1338
+ return new TypeError('Expected "string" but received "' + typeof obj_namespacePrefix + '" (at "' + path_namespacePrefix + '")');
1339
+ }
1340
+ if (obj.rendererConfig !== undefined) {
1341
+ const obj_rendererConfig = obj.rendererConfig;
1342
+ const path_rendererConfig = path + '.rendererConfig';
1343
+ if (obj_rendererConfig === undefined) {
1344
+ return new TypeError('Expected "defined" but received "' + typeof obj_rendererConfig + '" (at "' + path_rendererConfig + '")');
1345
+ }
1346
+ }
1347
+ if (obj.schema !== undefined) {
1348
+ const obj_schema = obj.schema;
1349
+ const path_schema = path + '.schema';
1350
+ if (obj_schema === undefined) {
1351
+ return new TypeError('Expected "defined" but received "' + typeof obj_schema + '" (at "' + path_schema + '")');
1352
+ }
1353
+ }
1354
+ if (obj.sourceDescriptor !== undefined) {
1355
+ const obj_sourceDescriptor = obj.sourceDescriptor;
1356
+ const path_sourceDescriptor = path + '.sourceDescriptor';
1357
+ if (obj_sourceDescriptor === undefined) {
1358
+ return new TypeError('Expected "defined" but received "' + typeof obj_sourceDescriptor + '" (at "' + path_sourceDescriptor + '")');
1359
+ }
1360
+ }
1361
+ if (obj.title !== undefined) {
1362
+ const obj_title = obj.title;
1363
+ const path_title = path + '.title';
1364
+ if (typeof obj_title !== 'string') {
1365
+ return new TypeError('Expected "string" but received "' + typeof obj_title + '" (at "' + path_title + '")');
1366
+ }
1367
+ }
1368
+ })();
1369
+ return v_error === undefined ? null : v_error;
1370
+ }
1371
+
1372
+ const TTL$1 = 3600000;
1373
+ const VERSION$1 = "51267fbdb7e8e374a286ee0bc35c6aee";
1374
+ function validate$3(obj, path = 'LightningModelTypesCollectionRepresentation') {
1375
+ const v_error = (() => {
1376
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1377
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1378
+ }
1379
+ const obj_types = obj.types;
1380
+ const path_types = path + '.types';
1381
+ if (!ArrayIsArray(obj_types)) {
1382
+ return new TypeError('Expected "array" but received "' + typeof obj_types + '" (at "' + path_types + '")');
1383
+ }
1384
+ for (let i = 0; i < obj_types.length; i++) {
1385
+ const obj_types_item = obj_types[i];
1386
+ const path_types_item = path_types + '[' + i + ']';
1387
+ const referencepath_types_itemValidationError = validate$4(obj_types_item, path_types_item);
1388
+ if (referencepath_types_itemValidationError !== null) {
1389
+ let message = 'Object doesn\'t match LightningModelTypesRepresentation (at "' + path_types_item + '")\n';
1390
+ message += referencepath_types_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1391
+ return new TypeError(message);
1392
+ }
1393
+ }
1394
+ })();
1395
+ return v_error === undefined ? null : v_error;
1396
+ }
1397
+ const RepresentationType$1 = 'LightningModelTypesCollectionRepresentation';
1398
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
1399
+ return input;
1400
+ }
1401
+ const select$3 = function LightningModelTypesCollectionRepresentationSelect() {
1402
+ return {
1403
+ kind: 'Fragment',
1404
+ version: VERSION$1,
1405
+ private: [],
1406
+ opaque: true
1407
+ };
1408
+ };
1409
+ function equals$1(existing, incoming) {
1410
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
1411
+ return false;
1412
+ }
1413
+ return true;
1414
+ }
1415
+ const ingest$1 = function LightningModelTypesCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
1416
+ if (process.env.NODE_ENV !== 'production') {
1417
+ const validateError = validate$3(input);
1418
+ if (validateError !== null) {
1419
+ throw validateError;
1420
+ }
1421
+ }
1422
+ const key = path.fullPath;
1423
+ const ttlToUse = TTL$1;
1424
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "lightning-types", VERSION$1, RepresentationType$1, equals$1);
1425
+ return createLink(key);
1426
+ };
1427
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
1428
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1429
+ const rootKey = fullPathFactory();
1430
+ rootKeySet.set(rootKey, {
1431
+ namespace: keyPrefix,
1432
+ representationName: RepresentationType$1,
1433
+ mergeable: false
1434
+ });
1435
+ }
1436
+
1437
+ function select$2(luvio, params) {
1438
+ return select$3();
1439
+ }
1440
+ function keyBuilder$3(luvio, params) {
1441
+ return keyPrefix + '::LightningModelTypesCollectionRepresentation:(' + 'language:' + params.body.language + '::' + '[' + params.body.typeConfigs.map(element => 'typeConfigs.descriptor:' + element.descriptor + '::' + (element.editorConfig?.target === undefined ? 'typeConfigs.editorConfig.target' : 'typeConfigs.editorConfig.target:' + element.editorConfig?.target) + '::' + (element.editorConfig?.subViewDefinitions === undefined ? 'typeConfigs.editorConfig.subViewDefinitions' : 'typeConfigs.editorConfig.subViewDefinitions:' + element.editorConfig?.subViewDefinitions) + '::' + (element.editorConfig?.maxViewDepth === undefined ? 'typeConfigs.editorConfig.maxViewDepth' : 'typeConfigs.editorConfig.maxViewDepth:' + element.editorConfig?.maxViewDepth) + '::' + (element.editorConfig?.actionConfig === undefined ? 'typeConfigs.editorConfig.actionConfig' : 'typeConfigs.editorConfig.actionConfig:' + element.editorConfig?.actionConfig) + '::' + (element.rendererConfig?.target === undefined ? 'typeConfigs.rendererConfig.target' : 'typeConfigs.rendererConfig.target:' + element.rendererConfig?.target) + '::' + (element.rendererConfig?.subViewDefinitions === undefined ? 'typeConfigs.rendererConfig.subViewDefinitions' : 'typeConfigs.rendererConfig.subViewDefinitions:' + element.rendererConfig?.subViewDefinitions) + '::' + (element.rendererConfig?.maxViewDepth === undefined ? 'typeConfigs.rendererConfig.maxViewDepth' : 'typeConfigs.rendererConfig.maxViewDepth:' + element.rendererConfig?.maxViewDepth) + '::' + (element.rendererConfig?.actionConfig === undefined ? 'typeConfigs.rendererConfig.actionConfig' : 'typeConfigs.rendererConfig.actionConfig:' + element.rendererConfig?.actionConfig) + '::' + (element.schemaConfig?.filterConfig?.propertyNames === undefined ? 'typeConfigs.schemaConfig.filterConfig.propertyNames' : 'typeConfigs.schemaConfig.filterConfig.propertyNames:' + element.schemaConfig?.filterConfig?.propertyNames) + '::' + (element.schemaConfig?.subSchemaDefinitions === undefined ? 'typeConfigs.schemaConfig.subSchemaDefinitions' : 'typeConfigs.schemaConfig.subSchemaDefinitions:' + element.schemaConfig?.subSchemaDefinitions) + '::' + (element.sourceDescriptor?.descriptor === undefined ? 'typeConfigs.sourceDescriptor.descriptor' : 'typeConfigs.sourceDescriptor.descriptor:' + element.sourceDescriptor?.descriptor) + '::' + (element.sourceDescriptor?.propertyName === undefined ? 'typeConfigs.sourceDescriptor.propertyName' : 'typeConfigs.sourceDescriptor.propertyName:' + element.sourceDescriptor?.propertyName)).join(',') + ']' + ')';
1442
+ }
1443
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
1444
+ getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$3(luvio, resourceParams));
1445
+ }
1446
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
1447
+ const { body } = response;
1448
+ const key = keyBuilder$3(luvio, resourceParams);
1449
+ luvio.storeIngest(key, ingest$1, body);
1450
+ const snapshot = luvio.storeLookup({
1451
+ recordId: key,
1452
+ node: select$2(),
1453
+ variables: {},
1454
+ }, snapshotRefresh);
1455
+ if (process.env.NODE_ENV !== 'production') {
1456
+ if (snapshot.state !== 'Fulfilled') {
1457
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1458
+ }
1459
+ }
1460
+ deepFreeze(snapshot.data);
1461
+ return snapshot;
1462
+ }
1463
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
1464
+ const key = keyBuilder$3(luvio, params);
1465
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1466
+ const storeMetadataParams = {
1467
+ ttl: TTL$1,
1468
+ namespace: keyPrefix,
1469
+ version: VERSION$1,
1470
+ representationName: RepresentationType$1
1471
+ };
1472
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
1473
+ return errorSnapshot;
1474
+ }
1475
+ function createResourceRequest$1(config) {
1476
+ const headers = {};
1477
+ return {
1478
+ baseUri: '/services/data/v66.0',
1479
+ basePath: '/connect/lightning-model/types',
1480
+ method: 'post',
1481
+ body: config.body,
1482
+ urlParams: {},
1483
+ queryParams: {},
1484
+ headers,
1485
+ priority: 'normal',
1486
+ };
1487
+ }
1488
+
1489
+ const adapterName$1 = 'getTypes';
1490
+ const getTypes_ConfigPropertyMetadata = [
1491
+ generateParamConfigMetadata('language', true, 2 /* Body */, 0 /* String */),
1492
+ generateParamConfigMetadata('typeConfigs', true, 2 /* Body */, 4 /* Unsupported */, true),
1493
+ ];
1494
+ const getTypes_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getTypes_ConfigPropertyMetadata);
1495
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$4(getTypes_ConfigPropertyMetadata);
1496
+ function keyBuilder$2(luvio, config) {
1497
+ const resourceParams = createResourceParams$1(config);
1498
+ return keyBuilder$3(luvio, resourceParams);
1499
+ }
1500
+ function typeCheckConfig$1(untrustedConfig) {
1501
+ const config = {};
1502
+ typeCheckConfig$4(untrustedConfig, config, getTypes_ConfigPropertyMetadata);
1503
+ const untrustedConfig_typeConfigs = untrustedConfig.typeConfigs;
1504
+ if (ArrayIsArray$1(untrustedConfig_typeConfigs)) {
1505
+ const untrustedConfig_typeConfigs_array = [];
1506
+ for (let i = 0, arrayLength = untrustedConfig_typeConfigs.length; i < arrayLength; i++) {
1507
+ const untrustedConfig_typeConfigs_item = untrustedConfig_typeConfigs[i];
1508
+ const referenceLightningModelTypesConfigInputRepresentationValidationError = validate$6(untrustedConfig_typeConfigs_item);
1509
+ if (referenceLightningModelTypesConfigInputRepresentationValidationError === null) {
1510
+ untrustedConfig_typeConfigs_array.push(untrustedConfig_typeConfigs_item);
1511
+ }
1512
+ }
1513
+ config.typeConfigs = untrustedConfig_typeConfigs_array;
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$1(luvio, config) {
1531
+ createResourceParams$1(config);
1532
+ return select$2();
1533
+ }
1534
+ function onFetchResponseSuccess$1(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$1(luvio, config, resourceParams, response) {
1542
+ const snapshot = ingestError$1(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$1(luvio, config, resourceParams, response), () => {
1554
+ const cache = new StoreKeyMap();
1555
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
1556
+ return cache;
1557
+ });
1558
+ }, (response) => {
1559
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
1560
+ });
1561
+ }
1562
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
1563
+ return buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, 'get', false);
1564
+ }
1565
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
1566
+ const { luvio, config } = context;
1567
+ const selector = {
1568
+ recordId: keyBuilder$2(luvio, config),
1569
+ node: adapterFragment$1(luvio, config),
1570
+ variables: {},
1571
+ };
1572
+ const cacheSnapshot = storeLookup(selector, {
1573
+ config,
1574
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1575
+ });
1576
+ return cacheSnapshot;
1577
+ }
1578
+ const getTypesAdapterFactory = (luvio) => function lightningTypes__getTypes(untrustedConfig, requestContext) {
1579
+ const config = validateAdapterConfig$1(untrustedConfig, getTypes_ConfigPropertyNames);
1580
+ // Invalid or incomplete config
1581
+ if (config === null) {
1582
+ return null;
1583
+ }
1584
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1585
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
1586
+ };
1587
+
1588
+ function validate$2(obj, path = 'LightningModelValidateFilterConfigInputRepresentation') {
1589
+ const v_error = (() => {
1590
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1591
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1592
+ }
1593
+ if (obj.localization !== undefined) {
1594
+ const obj_localization = obj.localization;
1595
+ const path_localization = path + '.localization';
1596
+ if (typeof obj_localization !== 'boolean') {
1597
+ return new TypeError('Expected "boolean" but received "' + typeof obj_localization + '" (at "' + path_localization + '")');
1598
+ }
1599
+ }
1600
+ if (obj.readOnly !== undefined) {
1601
+ const obj_readOnly = obj.readOnly;
1602
+ const path_readOnly = path + '.readOnly';
1603
+ if (typeof obj_readOnly !== 'boolean') {
1604
+ return new TypeError('Expected "boolean" but received "' + typeof obj_readOnly + '" (at "' + path_readOnly + '")');
1605
+ }
1606
+ }
1607
+ })();
1608
+ return v_error === undefined ? null : v_error;
1609
+ }
1610
+
1611
+ function validate$1(obj, path = 'LightningModelValidationErrorRepresentation') {
1612
+ const v_error = (() => {
1613
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1614
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1615
+ }
1616
+ const obj_arguments = obj.arguments;
1617
+ const path_arguments = path + '.arguments';
1618
+ if (!ArrayIsArray(obj_arguments)) {
1619
+ return new TypeError('Expected "array" but received "' + typeof obj_arguments + '" (at "' + path_arguments + '")');
1620
+ }
1621
+ for (let i = 0; i < obj_arguments.length; i++) {
1622
+ const obj_arguments_item = obj_arguments[i];
1623
+ const path_arguments_item = path_arguments + '[' + i + ']';
1624
+ if (obj_arguments_item === undefined) {
1625
+ return new TypeError('Expected "defined" but received "' + typeof obj_arguments_item + '" (at "' + path_arguments_item + '")');
1626
+ }
1627
+ }
1628
+ const obj_code = obj.code;
1629
+ const path_code = path + '.code';
1630
+ if (typeof obj_code !== 'string') {
1631
+ return new TypeError('Expected "string" but received "' + typeof obj_code + '" (at "' + path_code + '")');
1632
+ }
1633
+ const obj_details = obj.details;
1634
+ const path_details = path + '.details';
1635
+ if (typeof obj_details !== 'object' || ArrayIsArray(obj_details) || obj_details === null) {
1636
+ return new TypeError('Expected "object" but received "' + typeof obj_details + '" (at "' + path_details + '")');
1637
+ }
1638
+ const obj_details_keys = ObjectKeys(obj_details);
1639
+ for (let i = 0; i < obj_details_keys.length; i++) {
1640
+ const key = obj_details_keys[i];
1641
+ const obj_details_prop = obj_details[key];
1642
+ const path_details_prop = path_details + '["' + key + '"]';
1643
+ if (typeof obj_details_prop !== 'object' || ArrayIsArray(obj_details_prop) || obj_details_prop === null) {
1644
+ return new TypeError('Expected "object" but received "' + typeof obj_details_prop + '" (at "' + path_details_prop + '")');
1645
+ }
1646
+ }
1647
+ const obj_message = obj.message;
1648
+ const path_message = path + '.message';
1649
+ if (typeof obj_message !== 'string') {
1650
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
1651
+ }
1652
+ const obj_path = obj.path;
1653
+ const path_path = path + '.path';
1654
+ if (typeof obj_path !== 'string') {
1655
+ return new TypeError('Expected "string" but received "' + typeof obj_path + '" (at "' + path_path + '")');
1656
+ }
1657
+ const obj_type = obj.type;
1658
+ const path_type = path + '.type';
1659
+ if (typeof obj_type !== 'string') {
1660
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
1661
+ }
1662
+ })();
1663
+ return v_error === undefined ? null : v_error;
1664
+ }
1665
+
1666
+ const TTL = 1000;
1667
+ const VERSION = "f5f69ac25a1ed5895dbdb2d040fee2ba";
1668
+ function validate(obj, path = 'LightningModelValidationResultRepresentation') {
1669
+ const v_error = (() => {
1670
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1671
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1672
+ }
1673
+ const obj_errors = obj.errors;
1674
+ const path_errors = path + '.errors';
1675
+ if (!ArrayIsArray(obj_errors)) {
1676
+ return new TypeError('Expected "array" but received "' + typeof obj_errors + '" (at "' + path_errors + '")');
1677
+ }
1678
+ for (let i = 0; i < obj_errors.length; i++) {
1679
+ const obj_errors_item = obj_errors[i];
1680
+ const path_errors_item = path_errors + '[' + i + ']';
1681
+ const referencepath_errors_itemValidationError = validate$1(obj_errors_item, path_errors_item);
1682
+ if (referencepath_errors_itemValidationError !== null) {
1683
+ let message = 'Object doesn\'t match LightningModelValidationErrorRepresentation (at "' + path_errors_item + '")\n';
1684
+ message += referencepath_errors_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1685
+ return new TypeError(message);
1686
+ }
1687
+ }
1688
+ const obj_success = obj.success;
1689
+ const path_success = path + '.success';
1690
+ if (typeof obj_success !== 'boolean') {
1691
+ return new TypeError('Expected "boolean" but received "' + typeof obj_success + '" (at "' + path_success + '")');
1692
+ }
1693
+ })();
1694
+ return v_error === undefined ? null : v_error;
1695
+ }
1696
+ const RepresentationType = 'LightningModelValidationResultRepresentation';
1697
+ function normalize(input, existing, path, luvio, store, timestamp) {
1698
+ return input;
1699
+ }
1700
+ const select$1 = function LightningModelValidationResultRepresentationSelect() {
1701
+ return {
1702
+ kind: 'Fragment',
1703
+ version: VERSION,
1704
+ private: [],
1705
+ opaque: true
1706
+ };
1707
+ };
1708
+ function equals(existing, incoming) {
1709
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
1710
+ return false;
1711
+ }
1712
+ return true;
1713
+ }
1714
+ const ingest = function LightningModelValidationResultRepresentationIngest(input, path, luvio, store, timestamp) {
1715
+ if (process.env.NODE_ENV !== 'production') {
1716
+ const validateError = validate(input);
1717
+ if (validateError !== null) {
1718
+ throw validateError;
1719
+ }
1720
+ }
1721
+ const key = path.fullPath;
1722
+ const ttlToUse = TTL;
1723
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "lightning-types", VERSION, RepresentationType, equals);
1724
+ return createLink(key);
1725
+ };
1726
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
1727
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1728
+ const rootKey = fullPathFactory();
1729
+ rootKeySet.set(rootKey, {
1730
+ namespace: keyPrefix,
1731
+ representationName: RepresentationType,
1732
+ mergeable: false
1733
+ });
1734
+ }
1735
+
1736
+ function select(luvio, params) {
1737
+ return select$1();
1738
+ }
1739
+ function keyBuilder$1(luvio, params) {
1740
+ return keyPrefix + '::LightningModelValidationResultRepresentation:(' + 'descriptor:' + params.body.descriptor + '::' + (params.body.filterConfig?.localization === undefined ? 'filterConfig.localization' : 'filterConfig.localization:' + params.body.filterConfig?.localization) + '::' + (params.body.filterConfig?.readOnly === undefined ? 'filterConfig.readOnly' : 'filterConfig.readOnly:' + params.body.filterConfig?.readOnly) + '::' + stableJSONStringify(params.body.payload) + ')';
1741
+ }
1742
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
1743
+ getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
1744
+ }
1745
+ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
1746
+ const { body } = response;
1747
+ const key = keyBuilder$1(luvio, resourceParams);
1748
+ luvio.storeIngest(key, ingest, body);
1749
+ const snapshot = luvio.storeLookup({
1750
+ recordId: key,
1751
+ node: select(),
1752
+ variables: {},
1753
+ }, snapshotRefresh);
1754
+ if (process.env.NODE_ENV !== 'production') {
1755
+ if (snapshot.state !== 'Fulfilled') {
1756
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1757
+ }
1758
+ }
1759
+ deepFreeze(snapshot.data);
1760
+ return snapshot;
1761
+ }
1762
+ function ingestError(luvio, params, error, snapshotRefresh) {
1763
+ const key = keyBuilder$1(luvio, params);
1764
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1765
+ const storeMetadataParams = {
1766
+ ttl: TTL,
1767
+ namespace: keyPrefix,
1768
+ version: VERSION,
1769
+ representationName: RepresentationType
1770
+ };
1771
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
1772
+ return errorSnapshot;
1773
+ }
1774
+ function createResourceRequest(config) {
1775
+ const headers = {};
1776
+ return {
1777
+ baseUri: '/services/data/v66.0',
1778
+ basePath: '/connect/lightning-model/validate',
1779
+ method: 'post',
1780
+ body: config.body,
1781
+ urlParams: {},
1782
+ queryParams: {},
1783
+ headers,
1784
+ priority: 'normal',
1785
+ };
1786
+ }
1787
+
1788
+ const adapterName = 'validateLightningModel';
1789
+ const validateLightningModel_ConfigPropertyMetadata = [
1790
+ generateParamConfigMetadata('descriptor', true, 2 /* Body */, 0 /* String */),
1791
+ generateParamConfigMetadata('filterConfig', false, 2 /* Body */, 4 /* Unsupported */),
1792
+ generateParamConfigMetadata('payload', true, 2 /* Body */, 4 /* Unsupported */),
1793
+ ];
1794
+ const validateLightningModel_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, validateLightningModel_ConfigPropertyMetadata);
1795
+ const createResourceParams = /*#__PURE__*/ createResourceParams$4(validateLightningModel_ConfigPropertyMetadata);
1796
+ function keyBuilder(luvio, config) {
1797
+ const resourceParams = createResourceParams(config);
1798
+ return keyBuilder$1(luvio, resourceParams);
1799
+ }
1800
+ function typeCheckConfig(untrustedConfig) {
1801
+ const config = {};
1802
+ typeCheckConfig$4(untrustedConfig, config, validateLightningModel_ConfigPropertyMetadata);
1803
+ const untrustedConfig_filterConfig = untrustedConfig.filterConfig;
1804
+ const referenceLightningModelValidateFilterConfigInputRepresentationValidationError = validate$2(untrustedConfig_filterConfig);
1805
+ if (referenceLightningModelValidateFilterConfigInputRepresentationValidationError === null) {
1806
+ config.filterConfig = untrustedConfig_filterConfig;
1807
+ }
1808
+ const untrustedConfig_payload = untrustedConfig.payload;
1809
+ if (untrustedIsObject(untrustedConfig_payload)) {
1810
+ const untrustedConfig_payload_object = {};
1811
+ const untrustedConfig_payload_keys = Object.keys(untrustedConfig_payload);
1812
+ for (let i = 0, arrayLength = untrustedConfig_payload_keys.length; i < arrayLength; i++) {
1813
+ const key = untrustedConfig_payload_keys[i];
1814
+ const untrustedConfig_payload_prop = untrustedConfig_payload[key];
1815
+ if (untrustedConfig_payload_object !== undefined) {
1816
+ untrustedConfig_payload_object[key] = untrustedConfig_payload_prop;
1817
+ }
1818
+ }
1819
+ if (untrustedConfig_payload_object !== undefined && Object.keys(untrustedConfig_payload_object).length >= 0) {
1820
+ config.payload = untrustedConfig_payload_object;
1821
+ }
1822
+ }
1823
+ return config;
1824
+ }
1825
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
1826
+ if (!untrustedIsObject(untrustedConfig)) {
1827
+ return null;
1828
+ }
1829
+ if (process.env.NODE_ENV !== 'production') {
1830
+ validateConfig(untrustedConfig, configPropertyNames);
1831
+ }
1832
+ const config = typeCheckConfig(untrustedConfig);
1833
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1834
+ return null;
1835
+ }
1836
+ return config;
1837
+ }
1838
+ function adapterFragment(luvio, config) {
1839
+ createResourceParams(config);
1840
+ return select();
1841
+ }
1842
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
1843
+ const snapshot = ingestSuccess(luvio, resourceParams, response, {
1844
+ config,
1845
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1846
+ });
1847
+ return luvio.storeBroadcast().then(() => snapshot);
1848
+ }
1849
+ function onFetchResponseError(luvio, config, resourceParams, response) {
1850
+ const snapshot = ingestError(luvio, resourceParams, response, {
1851
+ config,
1852
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1853
+ });
1854
+ return luvio.storeBroadcast().then(() => snapshot);
1855
+ }
1856
+ function buildNetworkSnapshot(luvio, config, options) {
1857
+ const resourceParams = createResourceParams(config);
1858
+ const request = createResourceRequest(resourceParams);
1859
+ return luvio.dispatchResourceRequest(request, options)
1860
+ .then((response) => {
1861
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
1862
+ const cache = new StoreKeyMap();
1863
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
1864
+ return cache;
1865
+ });
1866
+ }, (response) => {
1867
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
1868
+ });
1869
+ }
1870
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
1871
+ return buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext, buildNetworkSnapshot, 'get', false);
1872
+ }
1873
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
1874
+ const { luvio, config } = context;
1875
+ const selector = {
1876
+ recordId: keyBuilder(luvio, config),
1877
+ node: adapterFragment(luvio, config),
1878
+ variables: {},
1879
+ };
1880
+ const cacheSnapshot = storeLookup(selector, {
1881
+ config,
1882
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1883
+ });
1884
+ return cacheSnapshot;
1885
+ }
1886
+ const validateLightningModelAdapterFactory = (luvio) => function lightningTypes__validateLightningModel(untrustedConfig, requestContext) {
1887
+ const config = validateAdapterConfig(untrustedConfig, validateLightningModel_ConfigPropertyNames);
1888
+ // Invalid or incomplete config
1889
+ if (config === null) {
1890
+ return null;
1891
+ }
1892
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1893
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
1894
+ };
1895
+
1896
+ let getLightningType;
1897
+ let getLightningTypes;
1898
+ let getTypes;
1899
+ let validateLightningModel;
1900
+ // Imperative GET Adapters
1901
+ let getLightningType_imperative;
1902
+ let getLightningTypes_imperative;
1903
+ let getTypes_imperative;
1904
+ let validateLightningModel_imperative;
1905
+ // Adapter Metadata
1906
+ const getLightningTypeMetadata = {
1907
+ apiFamily: 'lightningtypes',
1908
+ name: 'getLightningType',
1909
+ ttl: 100,
1910
+ };
1911
+ const getLightningTypesMetadata = {
1912
+ apiFamily: 'lightningtypes',
1913
+ name: 'getLightningTypes',
1914
+ ttl: 100,
1915
+ };
1916
+ const getTypesMetadata = { apiFamily: 'lightningtypes', name: 'getTypes', ttl: 3600000 };
1917
+ const validateLightningModelMetadata = {
1918
+ apiFamily: 'lightningtypes',
1919
+ name: 'validateLightningModel',
1920
+ ttl: 1000,
1921
+ };
1922
+ // Notify Update Available
1923
+ function bindExportsTo(luvio) {
1924
+ // LDS Adapters
1925
+ const getLightningType_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getLightningType', getLightningTypeAdapterFactory), getLightningTypeMetadata);
1926
+ const getLightningTypes_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getLightningTypes', getLightningTypesAdapterFactory), getLightningTypesMetadata);
1927
+ const getTypes_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getTypes', getTypesAdapterFactory), getTypesMetadata);
1928
+ const validateLightningModel_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'validateLightningModel', validateLightningModelAdapterFactory), validateLightningModelMetadata);
1929
+ return {
1930
+ getLightningType: createWireAdapterConstructor(luvio, getLightningType_ldsAdapter, getLightningTypeMetadata),
1931
+ getLightningTypes: createWireAdapterConstructor(luvio, getLightningTypes_ldsAdapter, getLightningTypesMetadata),
1932
+ getTypes: createWireAdapterConstructor(luvio, getTypes_ldsAdapter, getTypesMetadata),
1933
+ validateLightningModel: createWireAdapterConstructor(luvio, validateLightningModel_ldsAdapter, validateLightningModelMetadata),
1934
+ // Imperative GET Adapters
1935
+ getLightningType_imperative: createImperativeAdapter(luvio, getLightningType_ldsAdapter, getLightningTypeMetadata),
1936
+ getLightningTypes_imperative: createImperativeAdapter(luvio, getLightningTypes_ldsAdapter, getLightningTypesMetadata),
1937
+ getTypes_imperative: createImperativeAdapter(luvio, getTypes_ldsAdapter, getTypesMetadata),
1938
+ validateLightningModel_imperative: createImperativeAdapter(luvio, validateLightningModel_ldsAdapter, validateLightningModelMetadata),
1939
+ // Notify Update Availables
1940
+ };
1941
+ }
1942
+ withDefaultLuvio((luvio) => {
1943
+ ({
1944
+ getLightningType,
1945
+ getLightningTypes,
1946
+ getTypes,
1947
+ validateLightningModel,
1948
+ getLightningType_imperative,
1949
+ getLightningTypes_imperative,
1950
+ getTypes_imperative,
1951
+ validateLightningModel_imperative,
1952
+ } = bindExportsTo(luvio));
1953
+ });
1954
+
1955
+ export { getLightningType, getLightningType_imperative, getLightningTypes, getLightningTypes_imperative, getTypes, getTypes_imperative, validateLightningModel, validateLightningModel_imperative };
1956
+ // version: 0.1.0-dev1-c978a7b010