@salesforce/lds-adapters-platform-lightning-types 1.321.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/platform-lightning-types.js +698 -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/getLightningTypes.d.ts +32 -0
  5. package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +1 -0
  6. package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +3 -0
  7. package/dist/es/es2018/types/src/generated/resources/getConnectLightningTypes.d.ts +20 -0
  8. package/dist/es/es2018/types/src/generated/types/ExperienceModelDesignConfigInputRepresentation.d.ts +34 -0
  9. package/dist/es/es2018/types/src/generated/types/ExperienceModelFilterConfigInputRepresentation.d.ts +28 -0
  10. package/dist/es/es2018/types/src/generated/types/ExperienceModelFilterPropertyNamesListWrapper.d.ts +28 -0
  11. package/dist/es/es2018/types/src/generated/types/ExperienceModelRenditionConfigInputRepresentation.d.ts +34 -0
  12. package/dist/es/es2018/types/src/generated/types/ExperienceModelSchemaConfigInputRepresentation.d.ts +35 -0
  13. package/dist/es/es2018/types/src/generated/types/ExperienceModelSourceDescriptorInputRepresentation.d.ts +31 -0
  14. package/dist/es/es2018/types/src/generated/types/ExperienceModelTypesCollectionRepresentation.d.ts +29 -0
  15. package/dist/es/es2018/types/src/generated/types/ExperienceModelTypesConfigInputListWrapper.d.ts +32 -0
  16. package/dist/es/es2018/types/src/generated/types/ExperienceModelTypesConfigInputRepresentation.d.ts +56 -0
  17. package/dist/es/es2018/types/src/generated/types/ExperienceModelTypesErrorRepresentation.d.ts +31 -0
  18. package/dist/es/es2018/types/src/generated/types/ExperienceModelTypesInputRepresentation.d.ts +35 -0
  19. package/dist/es/es2018/types/src/generated/types/ExperienceModelTypesRepresentation.d.ts +78 -0
  20. package/dist/es/es2018/types/src/generated/types/LightningTypeCollectionRepresentation.d.ts +51 -0
  21. package/dist/es/es2018/types/src/generated/types/LightningTypeSummaryRepresentation.d.ts +53 -0
  22. package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
  23. package/package.json +66 -0
  24. package/sfdc/index.d.ts +1 -0
  25. package/sfdc/index.js +733 -0
  26. package/src/raml/api.raml +393 -0
  27. package/src/raml/luvio.raml +21 -0
package/sfdc/index.js ADDED
@@ -0,0 +1,733 @@
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$1, typeCheckConfig as typeCheckConfig$1, StoreKeyMap, createResourceParams as createResourceParams$1 } from 'force/luvioEngine';
18
+
19
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
20
+ const { keys: ObjectKeys, create: ObjectCreate } = Object;
21
+ const { isArray: ArrayIsArray$1 } = Array;
22
+ /**
23
+ * Validates an adapter config is well-formed.
24
+ * @param config The config to validate.
25
+ * @param adapter The adapter validation configuration.
26
+ * @param oneOf The keys the config must contain at least one of.
27
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
28
+ */
29
+ function validateConfig(config, adapter, oneOf) {
30
+ const { displayName } = adapter;
31
+ const { required, optional, unsupported } = adapter.parameters;
32
+ if (config === undefined ||
33
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
34
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
35
+ }
36
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
37
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
38
+ }
39
+ if (unsupported !== undefined &&
40
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
41
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
42
+ }
43
+ const supported = required.concat(optional);
44
+ if (ObjectKeys(config).some(key => !supported.includes(key))) {
45
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
46
+ }
47
+ }
48
+ function untrustedIsObject(untrusted) {
49
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
50
+ }
51
+ function areRequiredParametersPresent(config, configPropertyNames) {
52
+ return configPropertyNames.parameters.required.every(req => req in config);
53
+ }
54
+ const snapshotRefreshOptions = {
55
+ overrides: {
56
+ headers: {
57
+ 'Cache-Control': 'no-cache',
58
+ },
59
+ }
60
+ };
61
+ function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
62
+ return {
63
+ name,
64
+ required,
65
+ resourceType,
66
+ typeCheckShape,
67
+ isArrayShape,
68
+ coerceFn,
69
+ };
70
+ }
71
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
72
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
73
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
74
+ return {
75
+ displayName,
76
+ parameters: {
77
+ required,
78
+ optional,
79
+ }
80
+ };
81
+ }
82
+ const keyPrefix = 'lightning-types';
83
+
84
+ const { isArray: ArrayIsArray } = Array;
85
+ const { stringify: JSONStringify } = JSON;
86
+ function equalsArray(a, b, equalsItem) {
87
+ const aLength = a.length;
88
+ const bLength = b.length;
89
+ if (aLength !== bLength) {
90
+ return false;
91
+ }
92
+ for (let i = 0; i < aLength; i++) {
93
+ if (equalsItem(a[i], b[i]) === false) {
94
+ return false;
95
+ }
96
+ }
97
+ return true;
98
+ }
99
+ function createLink(ref) {
100
+ return {
101
+ __ref: serializeStructuredKey(ref),
102
+ };
103
+ }
104
+
105
+ const TTL$1 = 100;
106
+ const VERSION$1 = "4895529fcf8796413981df590ff3c2e9";
107
+ function validate$1(obj, path = 'LightningTypeSummaryRepresentation') {
108
+ const v_error = (() => {
109
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
110
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
111
+ }
112
+ if (obj.description !== undefined) {
113
+ const obj_description = obj.description;
114
+ const path_description = path + '.description';
115
+ let obj_description_union0 = null;
116
+ const obj_description_union0_error = (() => {
117
+ if (typeof obj_description !== 'string') {
118
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
119
+ }
120
+ })();
121
+ if (obj_description_union0_error != null) {
122
+ obj_description_union0 = obj_description_union0_error.message;
123
+ }
124
+ let obj_description_union1 = null;
125
+ const obj_description_union1_error = (() => {
126
+ if (obj_description !== null) {
127
+ return new TypeError('Expected "null" but received "' + typeof obj_description + '" (at "' + path_description + '")');
128
+ }
129
+ })();
130
+ if (obj_description_union1_error != null) {
131
+ obj_description_union1 = obj_description_union1_error.message;
132
+ }
133
+ if (obj_description_union0 && obj_description_union1) {
134
+ let message = 'Object doesn\'t match union (at "' + path_description + '")';
135
+ message += '\n' + obj_description_union0.split('\n').map((line) => '\t' + line).join('\n');
136
+ message += '\n' + obj_description_union1.split('\n').map((line) => '\t' + line).join('\n');
137
+ return new TypeError(message);
138
+ }
139
+ }
140
+ if (obj.detailUrl !== undefined) {
141
+ const obj_detailUrl = obj.detailUrl;
142
+ const path_detailUrl = path + '.detailUrl';
143
+ let obj_detailUrl_union0 = null;
144
+ const obj_detailUrl_union0_error = (() => {
145
+ if (typeof obj_detailUrl !== 'string') {
146
+ return new TypeError('Expected "string" but received "' + typeof obj_detailUrl + '" (at "' + path_detailUrl + '")');
147
+ }
148
+ })();
149
+ if (obj_detailUrl_union0_error != null) {
150
+ obj_detailUrl_union0 = obj_detailUrl_union0_error.message;
151
+ }
152
+ let obj_detailUrl_union1 = null;
153
+ const obj_detailUrl_union1_error = (() => {
154
+ if (obj_detailUrl !== null) {
155
+ return new TypeError('Expected "null" but received "' + typeof obj_detailUrl + '" (at "' + path_detailUrl + '")');
156
+ }
157
+ })();
158
+ if (obj_detailUrl_union1_error != null) {
159
+ obj_detailUrl_union1 = obj_detailUrl_union1_error.message;
160
+ }
161
+ if (obj_detailUrl_union0 && obj_detailUrl_union1) {
162
+ let message = 'Object doesn\'t match union (at "' + path_detailUrl + '")';
163
+ message += '\n' + obj_detailUrl_union0.split('\n').map((line) => '\t' + line).join('\n');
164
+ message += '\n' + obj_detailUrl_union1.split('\n').map((line) => '\t' + line).join('\n');
165
+ return new TypeError(message);
166
+ }
167
+ }
168
+ const obj_developerName = obj.developerName;
169
+ const path_developerName = path + '.developerName';
170
+ let obj_developerName_union0 = null;
171
+ const obj_developerName_union0_error = (() => {
172
+ if (typeof obj_developerName !== 'string') {
173
+ return new TypeError('Expected "string" but received "' + typeof obj_developerName + '" (at "' + path_developerName + '")');
174
+ }
175
+ })();
176
+ if (obj_developerName_union0_error != null) {
177
+ obj_developerName_union0 = obj_developerName_union0_error.message;
178
+ }
179
+ let obj_developerName_union1 = null;
180
+ const obj_developerName_union1_error = (() => {
181
+ if (obj_developerName !== null) {
182
+ return new TypeError('Expected "null" but received "' + typeof obj_developerName + '" (at "' + path_developerName + '")');
183
+ }
184
+ })();
185
+ if (obj_developerName_union1_error != null) {
186
+ obj_developerName_union1 = obj_developerName_union1_error.message;
187
+ }
188
+ if (obj_developerName_union0 && obj_developerName_union1) {
189
+ let message = 'Object doesn\'t match union (at "' + path_developerName + '")';
190
+ message += '\n' + obj_developerName_union0.split('\n').map((line) => '\t' + line).join('\n');
191
+ message += '\n' + obj_developerName_union1.split('\n').map((line) => '\t' + line).join('\n');
192
+ return new TypeError(message);
193
+ }
194
+ if (obj.id !== undefined) {
195
+ const obj_id = obj.id;
196
+ const path_id = path + '.id';
197
+ let obj_id_union0 = null;
198
+ const obj_id_union0_error = (() => {
199
+ if (typeof obj_id !== 'string') {
200
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
201
+ }
202
+ })();
203
+ if (obj_id_union0_error != null) {
204
+ obj_id_union0 = obj_id_union0_error.message;
205
+ }
206
+ let obj_id_union1 = null;
207
+ const obj_id_union1_error = (() => {
208
+ if (obj_id !== null) {
209
+ return new TypeError('Expected "null" but received "' + typeof obj_id + '" (at "' + path_id + '")');
210
+ }
211
+ })();
212
+ if (obj_id_union1_error != null) {
213
+ obj_id_union1 = obj_id_union1_error.message;
214
+ }
215
+ if (obj_id_union0 && obj_id_union1) {
216
+ let message = 'Object doesn\'t match union (at "' + path_id + '")';
217
+ message += '\n' + obj_id_union0.split('\n').map((line) => '\t' + line).join('\n');
218
+ message += '\n' + obj_id_union1.split('\n').map((line) => '\t' + line).join('\n');
219
+ return new TypeError(message);
220
+ }
221
+ }
222
+ const obj_namespacePrefix = obj.namespacePrefix;
223
+ const path_namespacePrefix = path + '.namespacePrefix';
224
+ let obj_namespacePrefix_union0 = null;
225
+ const obj_namespacePrefix_union0_error = (() => {
226
+ if (typeof obj_namespacePrefix !== 'string') {
227
+ return new TypeError('Expected "string" but received "' + typeof obj_namespacePrefix + '" (at "' + path_namespacePrefix + '")');
228
+ }
229
+ })();
230
+ if (obj_namespacePrefix_union0_error != null) {
231
+ obj_namespacePrefix_union0 = obj_namespacePrefix_union0_error.message;
232
+ }
233
+ let obj_namespacePrefix_union1 = null;
234
+ const obj_namespacePrefix_union1_error = (() => {
235
+ if (obj_namespacePrefix !== null) {
236
+ return new TypeError('Expected "null" but received "' + typeof obj_namespacePrefix + '" (at "' + path_namespacePrefix + '")');
237
+ }
238
+ })();
239
+ if (obj_namespacePrefix_union1_error != null) {
240
+ obj_namespacePrefix_union1 = obj_namespacePrefix_union1_error.message;
241
+ }
242
+ if (obj_namespacePrefix_union0 && obj_namespacePrefix_union1) {
243
+ let message = 'Object doesn\'t match union (at "' + path_namespacePrefix + '")';
244
+ message += '\n' + obj_namespacePrefix_union0.split('\n').map((line) => '\t' + line).join('\n');
245
+ message += '\n' + obj_namespacePrefix_union1.split('\n').map((line) => '\t' + line).join('\n');
246
+ return new TypeError(message);
247
+ }
248
+ if (obj.title !== undefined) {
249
+ const obj_title = obj.title;
250
+ const path_title = path + '.title';
251
+ let obj_title_union0 = null;
252
+ const obj_title_union0_error = (() => {
253
+ if (typeof obj_title !== 'string') {
254
+ return new TypeError('Expected "string" but received "' + typeof obj_title + '" (at "' + path_title + '")');
255
+ }
256
+ })();
257
+ if (obj_title_union0_error != null) {
258
+ obj_title_union0 = obj_title_union0_error.message;
259
+ }
260
+ let obj_title_union1 = null;
261
+ const obj_title_union1_error = (() => {
262
+ if (obj_title !== null) {
263
+ return new TypeError('Expected "null" but received "' + typeof obj_title + '" (at "' + path_title + '")');
264
+ }
265
+ })();
266
+ if (obj_title_union1_error != null) {
267
+ obj_title_union1 = obj_title_union1_error.message;
268
+ }
269
+ if (obj_title_union0 && obj_title_union1) {
270
+ let message = 'Object doesn\'t match union (at "' + path_title + '")';
271
+ message += '\n' + obj_title_union0.split('\n').map((line) => '\t' + line).join('\n');
272
+ message += '\n' + obj_title_union1.split('\n').map((line) => '\t' + line).join('\n');
273
+ return new TypeError(message);
274
+ }
275
+ }
276
+ })();
277
+ return v_error === undefined ? null : v_error;
278
+ }
279
+ const RepresentationType$1 = 'LightningTypeSummaryRepresentation';
280
+ function keyBuilder$2(luvio, config) {
281
+ return keyPrefix + '::' + RepresentationType$1 + ':' + (config.id === null ? '' : config.id);
282
+ }
283
+ function keyBuilderFromType(luvio, object) {
284
+ const keyParams = {
285
+ id: object.developerName
286
+ };
287
+ return keyBuilder$2(luvio, keyParams);
288
+ }
289
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
290
+ return input;
291
+ }
292
+ const select$2 = function LightningTypeSummaryRepresentationSelect() {
293
+ return {
294
+ kind: 'Fragment',
295
+ version: VERSION$1,
296
+ private: [],
297
+ opaque: true
298
+ };
299
+ };
300
+ function equals$1(existing, incoming) {
301
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
302
+ return false;
303
+ }
304
+ return true;
305
+ }
306
+ const ingest$1 = function LightningTypeSummaryRepresentationIngest(input, path, luvio, store, timestamp) {
307
+ if (process.env.NODE_ENV !== 'production') {
308
+ const validateError = validate$1(input);
309
+ if (validateError !== null) {
310
+ throw validateError;
311
+ }
312
+ }
313
+ const key = keyBuilderFromType(luvio, input);
314
+ const ttlToUse = TTL$1;
315
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "lightning-types", VERSION$1, RepresentationType$1, equals$1);
316
+ return createLink(key);
317
+ };
318
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
319
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
320
+ const rootKey = keyBuilderFromType(luvio, input);
321
+ rootKeySet.set(rootKey, {
322
+ namespace: keyPrefix,
323
+ representationName: RepresentationType$1,
324
+ mergeable: false
325
+ });
326
+ }
327
+
328
+ const TTL = 100;
329
+ const VERSION = "c66a5dd98fb4b617c447b5ec059204fd";
330
+ function validate(obj, path = 'LightningTypeCollectionRepresentation') {
331
+ const v_error = (() => {
332
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
333
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
334
+ }
335
+ const obj_count = obj.count;
336
+ const path_count = path + '.count';
337
+ if (typeof obj_count !== 'number' || (typeof obj_count === 'number' && Math.floor(obj_count) !== obj_count)) {
338
+ return new TypeError('Expected "integer" but received "' + typeof obj_count + '" (at "' + path_count + '")');
339
+ }
340
+ const obj_currentPageUrl = obj.currentPageUrl;
341
+ const path_currentPageUrl = path + '.currentPageUrl';
342
+ let obj_currentPageUrl_union0 = null;
343
+ const obj_currentPageUrl_union0_error = (() => {
344
+ if (typeof obj_currentPageUrl !== 'string') {
345
+ return new TypeError('Expected "string" but received "' + typeof obj_currentPageUrl + '" (at "' + path_currentPageUrl + '")');
346
+ }
347
+ })();
348
+ if (obj_currentPageUrl_union0_error != null) {
349
+ obj_currentPageUrl_union0 = obj_currentPageUrl_union0_error.message;
350
+ }
351
+ let obj_currentPageUrl_union1 = null;
352
+ const obj_currentPageUrl_union1_error = (() => {
353
+ if (obj_currentPageUrl !== null) {
354
+ return new TypeError('Expected "null" but received "' + typeof obj_currentPageUrl + '" (at "' + path_currentPageUrl + '")');
355
+ }
356
+ })();
357
+ if (obj_currentPageUrl_union1_error != null) {
358
+ obj_currentPageUrl_union1 = obj_currentPageUrl_union1_error.message;
359
+ }
360
+ if (obj_currentPageUrl_union0 && obj_currentPageUrl_union1) {
361
+ let message = 'Object doesn\'t match union (at "' + path_currentPageUrl + '")';
362
+ message += '\n' + obj_currentPageUrl_union0.split('\n').map((line) => '\t' + line).join('\n');
363
+ message += '\n' + obj_currentPageUrl_union1.split('\n').map((line) => '\t' + line).join('\n');
364
+ return new TypeError(message);
365
+ }
366
+ const obj_lightningTypes = obj.lightningTypes;
367
+ const path_lightningTypes = path + '.lightningTypes';
368
+ if (!ArrayIsArray(obj_lightningTypes)) {
369
+ return new TypeError('Expected "array" but received "' + typeof obj_lightningTypes + '" (at "' + path_lightningTypes + '")');
370
+ }
371
+ for (let i = 0; i < obj_lightningTypes.length; i++) {
372
+ const obj_lightningTypes_item = obj_lightningTypes[i];
373
+ const path_lightningTypes_item = path_lightningTypes + '[' + i + ']';
374
+ if (typeof obj_lightningTypes_item !== 'object') {
375
+ return new TypeError('Expected "object" but received "' + typeof obj_lightningTypes_item + '" (at "' + path_lightningTypes_item + '")');
376
+ }
377
+ }
378
+ if (obj.nextPageUrl !== undefined) {
379
+ const obj_nextPageUrl = obj.nextPageUrl;
380
+ const path_nextPageUrl = path + '.nextPageUrl';
381
+ let obj_nextPageUrl_union0 = null;
382
+ const obj_nextPageUrl_union0_error = (() => {
383
+ if (typeof obj_nextPageUrl !== 'string') {
384
+ return new TypeError('Expected "string" but received "' + typeof obj_nextPageUrl + '" (at "' + path_nextPageUrl + '")');
385
+ }
386
+ })();
387
+ if (obj_nextPageUrl_union0_error != null) {
388
+ obj_nextPageUrl_union0 = obj_nextPageUrl_union0_error.message;
389
+ }
390
+ let obj_nextPageUrl_union1 = null;
391
+ const obj_nextPageUrl_union1_error = (() => {
392
+ if (obj_nextPageUrl !== null) {
393
+ return new TypeError('Expected "null" but received "' + typeof obj_nextPageUrl + '" (at "' + path_nextPageUrl + '")');
394
+ }
395
+ })();
396
+ if (obj_nextPageUrl_union1_error != null) {
397
+ obj_nextPageUrl_union1 = obj_nextPageUrl_union1_error.message;
398
+ }
399
+ if (obj_nextPageUrl_union0 && obj_nextPageUrl_union1) {
400
+ let message = 'Object doesn\'t match union (at "' + path_nextPageUrl + '")';
401
+ message += '\n' + obj_nextPageUrl_union0.split('\n').map((line) => '\t' + line).join('\n');
402
+ message += '\n' + obj_nextPageUrl_union1.split('\n').map((line) => '\t' + line).join('\n');
403
+ return new TypeError(message);
404
+ }
405
+ }
406
+ if (obj.previousPageUrl !== undefined) {
407
+ const obj_previousPageUrl = obj.previousPageUrl;
408
+ const path_previousPageUrl = path + '.previousPageUrl';
409
+ let obj_previousPageUrl_union0 = null;
410
+ const obj_previousPageUrl_union0_error = (() => {
411
+ if (typeof obj_previousPageUrl !== 'string') {
412
+ return new TypeError('Expected "string" but received "' + typeof obj_previousPageUrl + '" (at "' + path_previousPageUrl + '")');
413
+ }
414
+ })();
415
+ if (obj_previousPageUrl_union0_error != null) {
416
+ obj_previousPageUrl_union0 = obj_previousPageUrl_union0_error.message;
417
+ }
418
+ let obj_previousPageUrl_union1 = null;
419
+ const obj_previousPageUrl_union1_error = (() => {
420
+ if (obj_previousPageUrl !== null) {
421
+ return new TypeError('Expected "null" but received "' + typeof obj_previousPageUrl + '" (at "' + path_previousPageUrl + '")');
422
+ }
423
+ })();
424
+ if (obj_previousPageUrl_union1_error != null) {
425
+ obj_previousPageUrl_union1 = obj_previousPageUrl_union1_error.message;
426
+ }
427
+ if (obj_previousPageUrl_union0 && obj_previousPageUrl_union1) {
428
+ let message = 'Object doesn\'t match union (at "' + path_previousPageUrl + '")';
429
+ message += '\n' + obj_previousPageUrl_union0.split('\n').map((line) => '\t' + line).join('\n');
430
+ message += '\n' + obj_previousPageUrl_union1.split('\n').map((line) => '\t' + line).join('\n');
431
+ return new TypeError(message);
432
+ }
433
+ }
434
+ })();
435
+ return v_error === undefined ? null : v_error;
436
+ }
437
+ const RepresentationType = 'LightningTypeCollectionRepresentation';
438
+ function normalize(input, existing, path, luvio, store, timestamp) {
439
+ const input_lightningTypes = input.lightningTypes;
440
+ const input_lightningTypes_id = path.fullPath + '__lightningTypes';
441
+ for (let i = 0; i < input_lightningTypes.length; i++) {
442
+ const input_lightningTypes_item = input_lightningTypes[i];
443
+ let input_lightningTypes_item_id = input_lightningTypes_id + '__' + i;
444
+ input_lightningTypes[i] = ingest$1(input_lightningTypes_item, {
445
+ fullPath: input_lightningTypes_item_id,
446
+ propertyName: i,
447
+ parent: {
448
+ data: input,
449
+ key: path.fullPath,
450
+ existing: existing,
451
+ },
452
+ ttl: path.ttl
453
+ }, luvio, store, timestamp);
454
+ }
455
+ return input;
456
+ }
457
+ const select$1 = function LightningTypeCollectionRepresentationSelect() {
458
+ return {
459
+ kind: 'Fragment',
460
+ version: VERSION,
461
+ private: [],
462
+ selections: [
463
+ {
464
+ name: 'count',
465
+ kind: 'Scalar'
466
+ },
467
+ {
468
+ name: 'currentPageUrl',
469
+ kind: 'Scalar'
470
+ },
471
+ {
472
+ name: 'lightningTypes',
473
+ kind: 'Link',
474
+ plural: true,
475
+ fragment: select$2()
476
+ },
477
+ {
478
+ name: 'nextPageUrl',
479
+ kind: 'Scalar',
480
+ required: false
481
+ },
482
+ {
483
+ name: 'previousPageUrl',
484
+ kind: 'Scalar',
485
+ required: false
486
+ }
487
+ ]
488
+ };
489
+ };
490
+ function equals(existing, incoming) {
491
+ const existing_count = existing.count;
492
+ const incoming_count = incoming.count;
493
+ if (!(existing_count === incoming_count)) {
494
+ return false;
495
+ }
496
+ const existing_currentPageUrl = existing.currentPageUrl;
497
+ const incoming_currentPageUrl = incoming.currentPageUrl;
498
+ if (!(existing_currentPageUrl === incoming_currentPageUrl)) {
499
+ return false;
500
+ }
501
+ const existing_lightningTypes = existing.lightningTypes;
502
+ const incoming_lightningTypes = incoming.lightningTypes;
503
+ const equals_lightningTypes_items = equalsArray(existing_lightningTypes, incoming_lightningTypes, (existing_lightningTypes_item, incoming_lightningTypes_item) => {
504
+ if (!(existing_lightningTypes_item.__ref === incoming_lightningTypes_item.__ref)) {
505
+ return false;
506
+ }
507
+ });
508
+ if (equals_lightningTypes_items === false) {
509
+ return false;
510
+ }
511
+ const existing_nextPageUrl = existing.nextPageUrl;
512
+ const incoming_nextPageUrl = incoming.nextPageUrl;
513
+ // if at least one of these optionals is defined
514
+ if (existing_nextPageUrl !== undefined || incoming_nextPageUrl !== undefined) {
515
+ // if one of these is not defined we know the other is defined and therefore
516
+ // not equal
517
+ if (existing_nextPageUrl === undefined || incoming_nextPageUrl === undefined) {
518
+ return false;
519
+ }
520
+ if (!(existing_nextPageUrl === incoming_nextPageUrl)) {
521
+ return false;
522
+ }
523
+ }
524
+ const existing_previousPageUrl = existing.previousPageUrl;
525
+ const incoming_previousPageUrl = incoming.previousPageUrl;
526
+ // if at least one of these optionals is defined
527
+ if (existing_previousPageUrl !== undefined || incoming_previousPageUrl !== undefined) {
528
+ // if one of these is not defined we know the other is defined and therefore
529
+ // not equal
530
+ if (existing_previousPageUrl === undefined || incoming_previousPageUrl === undefined) {
531
+ return false;
532
+ }
533
+ if (!(existing_previousPageUrl === incoming_previousPageUrl)) {
534
+ return false;
535
+ }
536
+ }
537
+ return true;
538
+ }
539
+ const ingest = function LightningTypeCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
540
+ if (process.env.NODE_ENV !== 'production') {
541
+ const validateError = validate(input);
542
+ if (validateError !== null) {
543
+ throw validateError;
544
+ }
545
+ }
546
+ const key = path.fullPath;
547
+ const ttlToUse = TTL;
548
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "lightning-types", VERSION, RepresentationType, equals);
549
+ return createLink(key);
550
+ };
551
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
552
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
553
+ const rootKey = fullPathFactory();
554
+ rootKeySet.set(rootKey, {
555
+ namespace: keyPrefix,
556
+ representationName: RepresentationType,
557
+ mergeable: false
558
+ });
559
+ const input_lightningTypes_length = input.lightningTypes.length;
560
+ for (let i = 0; i < input_lightningTypes_length; i++) {
561
+ getTypeCacheKeys$1(rootKeySet, luvio, input.lightningTypes[i]);
562
+ }
563
+ }
564
+
565
+ function select(luvio, params) {
566
+ return select$1();
567
+ }
568
+ function keyBuilder$1(luvio, params) {
569
+ return keyPrefix + '::LightningTypeCollectionRepresentation:(' + 'editorConfigTarget:' + params.queryParams.editorConfigTarget + ',' + 'fullyQualifiedNames:' + params.queryParams.fullyQualifiedNames + ',' + 'language:' + params.queryParams.language + ',' + 'page:' + params.queryParams.page + ',' + 'pageSize:' + params.queryParams.pageSize + ',' + 'rendererConfigTarget:' + params.queryParams.rendererConfigTarget + ')';
570
+ }
571
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
572
+ getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
573
+ }
574
+ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
575
+ const { body } = response;
576
+ const key = keyBuilder$1(luvio, resourceParams);
577
+ luvio.storeIngest(key, ingest, body);
578
+ const snapshot = luvio.storeLookup({
579
+ recordId: key,
580
+ node: select(),
581
+ variables: {},
582
+ }, snapshotRefresh);
583
+ if (process.env.NODE_ENV !== 'production') {
584
+ if (snapshot.state !== 'Fulfilled') {
585
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
586
+ }
587
+ }
588
+ deepFreeze(snapshot.data);
589
+ return snapshot;
590
+ }
591
+ function ingestError(luvio, params, error, snapshotRefresh) {
592
+ const key = keyBuilder$1(luvio, params);
593
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
594
+ const storeMetadataParams = {
595
+ ttl: TTL,
596
+ namespace: keyPrefix,
597
+ version: VERSION,
598
+ representationName: RepresentationType
599
+ };
600
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
601
+ return errorSnapshot;
602
+ }
603
+ function createResourceRequest(config) {
604
+ const headers = {};
605
+ return {
606
+ baseUri: '/services/data/v63.0',
607
+ basePath: '/connect/lightning-types',
608
+ method: 'get',
609
+ body: null,
610
+ urlParams: {},
611
+ queryParams: config.queryParams,
612
+ headers,
613
+ priority: 'normal',
614
+ };
615
+ }
616
+
617
+ const adapterName = 'getLightningTypes';
618
+ const getLightningTypes_ConfigPropertyMetadata = [
619
+ generateParamConfigMetadata('editorConfigTarget', false, 1 /* QueryParameter */, 0 /* String */),
620
+ generateParamConfigMetadata('fullyQualifiedNames', false, 1 /* QueryParameter */, 0 /* String */, true),
621
+ generateParamConfigMetadata('language', false, 1 /* QueryParameter */, 0 /* String */),
622
+ generateParamConfigMetadata('page', false, 1 /* QueryParameter */, 3 /* Integer */),
623
+ generateParamConfigMetadata('pageSize', false, 1 /* QueryParameter */, 3 /* Integer */),
624
+ generateParamConfigMetadata('rendererConfigTarget', false, 1 /* QueryParameter */, 0 /* String */),
625
+ ];
626
+ const getLightningTypes_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getLightningTypes_ConfigPropertyMetadata);
627
+ const createResourceParams = /*#__PURE__*/ createResourceParams$1(getLightningTypes_ConfigPropertyMetadata);
628
+ function keyBuilder(luvio, config) {
629
+ const resourceParams = createResourceParams(config);
630
+ return keyBuilder$1(luvio, resourceParams);
631
+ }
632
+ function typeCheckConfig(untrustedConfig) {
633
+ const config = {};
634
+ typeCheckConfig$1(untrustedConfig, config, getLightningTypes_ConfigPropertyMetadata);
635
+ return config;
636
+ }
637
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
638
+ if (!untrustedIsObject(untrustedConfig)) {
639
+ return null;
640
+ }
641
+ if (process.env.NODE_ENV !== 'production') {
642
+ validateConfig(untrustedConfig, configPropertyNames);
643
+ }
644
+ const config = typeCheckConfig(untrustedConfig);
645
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
646
+ return null;
647
+ }
648
+ return config;
649
+ }
650
+ function adapterFragment(luvio, config) {
651
+ createResourceParams(config);
652
+ return select();
653
+ }
654
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
655
+ const snapshot = ingestSuccess(luvio, resourceParams, response, {
656
+ config,
657
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
658
+ });
659
+ return luvio.storeBroadcast().then(() => snapshot);
660
+ }
661
+ function onFetchResponseError(luvio, config, resourceParams, response) {
662
+ const snapshot = ingestError(luvio, resourceParams, response, {
663
+ config,
664
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
665
+ });
666
+ return luvio.storeBroadcast().then(() => snapshot);
667
+ }
668
+ function buildNetworkSnapshot(luvio, config, options) {
669
+ const resourceParams = createResourceParams(config);
670
+ const request = createResourceRequest(resourceParams);
671
+ return luvio.dispatchResourceRequest(request, options)
672
+ .then((response) => {
673
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
674
+ const cache = new StoreKeyMap();
675
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
676
+ return cache;
677
+ });
678
+ }, (response) => {
679
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
680
+ });
681
+ }
682
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
683
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
684
+ }
685
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
686
+ const { luvio, config } = context;
687
+ const selector = {
688
+ recordId: keyBuilder(luvio, config),
689
+ node: adapterFragment(luvio, config),
690
+ variables: {},
691
+ };
692
+ const cacheSnapshot = storeLookup(selector, {
693
+ config,
694
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
695
+ });
696
+ return cacheSnapshot;
697
+ }
698
+ const getLightningTypesAdapterFactory = (luvio) => function lightningTypes__getLightningTypes(untrustedConfig, requestContext) {
699
+ const config = validateAdapterConfig(untrustedConfig, getLightningTypes_ConfigPropertyNames);
700
+ // Invalid or incomplete config
701
+ if (config === null) {
702
+ return null;
703
+ }
704
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
705
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
706
+ };
707
+
708
+ let getLightningTypes;
709
+ // Imperative GET Adapters
710
+ let getLightningTypes_imperative;
711
+ // Adapter Metadata
712
+ const getLightningTypesMetadata = {
713
+ apiFamily: 'lightningtypes',
714
+ name: 'getLightningTypes',
715
+ ttl: 100,
716
+ };
717
+ // Notify Update Available
718
+ function bindExportsTo(luvio) {
719
+ // LDS Adapters
720
+ const getLightningTypes_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getLightningTypes', getLightningTypesAdapterFactory), getLightningTypesMetadata);
721
+ return {
722
+ getLightningTypes: createWireAdapterConstructor(luvio, getLightningTypes_ldsAdapter, getLightningTypesMetadata),
723
+ // Imperative GET Adapters
724
+ getLightningTypes_imperative: createImperativeAdapter(luvio, getLightningTypes_ldsAdapter, getLightningTypesMetadata),
725
+ // Notify Update Availables
726
+ };
727
+ }
728
+ withDefaultLuvio((luvio) => {
729
+ ({ getLightningTypes, getLightningTypes_imperative } = bindExportsTo(luvio));
730
+ });
731
+
732
+ export { getLightningTypes, getLightningTypes_imperative };
733
+ // version: 1.321.0-40847d67a8