@salesforce/lds-adapters-cms-managedcontentspaces 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 (21) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/cms-managedcontentspaces.js +749 -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/getManagedContentSpaceChannels.d.ts +29 -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/getConnectCmsSpacesChannelsByContentSpaceId.d.ts +19 -0
  8. package/dist/es/es2018/types/src/generated/resources/patchConnectCmsSpacesChannelsByContentSpaceId.d.ts +13 -0
  9. package/dist/es/es2018/types/src/generated/types/ManagedContentChannelSummaryRepresentation.d.ts +47 -0
  10. package/dist/es/es2018/types/src/generated/types/ManagedContentSpaceChannelInputRepresentation.d.ts +31 -0
  11. package/dist/es/es2018/types/src/generated/types/ManagedContentSpaceChannelRepresentation.d.ts +47 -0
  12. package/dist/es/es2018/types/src/generated/types/ManagedContentSpaceChannelsInputList.d.ts +29 -0
  13. package/dist/es/es2018/types/src/generated/types/ManagedContentSpaceChannelsInputRepresentation.d.ts +29 -0
  14. package/dist/es/es2018/types/src/generated/types/ManagedContentSpaceChannelsRepresentation.d.ts +51 -0
  15. package/dist/es/es2018/types/src/generated/types/ManagedContentUserSummaryRepresentation.d.ts +34 -0
  16. package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
  17. package/package.json +66 -0
  18. package/sfdc/index.d.ts +1 -0
  19. package/sfdc/index.js +785 -0
  20. package/src/raml/api.raml +182 -0
  21. package/src/raml/luvio.raml +27 -0
package/sfdc/index.js ADDED
@@ -0,0 +1,785 @@
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 = 'CmsManagement';
83
+
84
+ const { isArray: ArrayIsArray } = Array;
85
+ function equalsArray(a, b, equalsItem) {
86
+ const aLength = a.length;
87
+ const bLength = b.length;
88
+ if (aLength !== bLength) {
89
+ return false;
90
+ }
91
+ for (let i = 0; i < aLength; i++) {
92
+ if (equalsItem(a[i], b[i]) === false) {
93
+ return false;
94
+ }
95
+ }
96
+ return true;
97
+ }
98
+ function createLink(ref) {
99
+ return {
100
+ __ref: serializeStructuredKey(ref),
101
+ };
102
+ }
103
+
104
+ const VERSION$3 = "0442df24d91a0d085c1002f69dd25754";
105
+ function validate$3(obj, path = 'ManagedContentUserSummaryRepresentation') {
106
+ const v_error = (() => {
107
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
108
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
109
+ }
110
+ const obj_id = obj.id;
111
+ const path_id = path + '.id';
112
+ if (typeof obj_id !== 'string') {
113
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
114
+ }
115
+ const obj_name = obj.name;
116
+ const path_name = path + '.name';
117
+ if (typeof obj_name !== 'string') {
118
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
119
+ }
120
+ const obj_resourceUrl = obj.resourceUrl;
121
+ const path_resourceUrl = path + '.resourceUrl';
122
+ if (typeof obj_resourceUrl !== 'string') {
123
+ return new TypeError('Expected "string" but received "' + typeof obj_resourceUrl + '" (at "' + path_resourceUrl + '")');
124
+ }
125
+ })();
126
+ return v_error === undefined ? null : v_error;
127
+ }
128
+ const select$4 = function ManagedContentUserSummaryRepresentationSelect() {
129
+ return {
130
+ kind: 'Fragment',
131
+ version: VERSION$3,
132
+ private: [],
133
+ selections: [
134
+ {
135
+ name: 'id',
136
+ kind: 'Scalar'
137
+ },
138
+ {
139
+ name: 'name',
140
+ kind: 'Scalar'
141
+ },
142
+ {
143
+ name: 'resourceUrl',
144
+ kind: 'Scalar'
145
+ }
146
+ ]
147
+ };
148
+ };
149
+ function equals$3(existing, incoming) {
150
+ const existing_id = existing.id;
151
+ const incoming_id = incoming.id;
152
+ if (!(existing_id === incoming_id)) {
153
+ return false;
154
+ }
155
+ const existing_name = existing.name;
156
+ const incoming_name = incoming.name;
157
+ if (!(existing_name === incoming_name)) {
158
+ return false;
159
+ }
160
+ const existing_resourceUrl = existing.resourceUrl;
161
+ const incoming_resourceUrl = incoming.resourceUrl;
162
+ if (!(existing_resourceUrl === incoming_resourceUrl)) {
163
+ return false;
164
+ }
165
+ return true;
166
+ }
167
+
168
+ const TTL$2 = 30000;
169
+ const VERSION$2 = "2259491768d10f813e45abec36a864c8";
170
+ function validate$2(obj, path = 'ManagedContentChannelSummaryRepresentation') {
171
+ const v_error = (() => {
172
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
173
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
174
+ }
175
+ const obj_id = obj.id;
176
+ const path_id = path + '.id';
177
+ if (typeof obj_id !== 'string') {
178
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
179
+ }
180
+ const obj_name = obj.name;
181
+ const path_name = path + '.name';
182
+ if (typeof obj_name !== 'string') {
183
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
184
+ }
185
+ const obj_type = obj.type;
186
+ const path_type = path + '.type';
187
+ if (typeof obj_type !== 'string') {
188
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
189
+ }
190
+ const obj_url = obj.url;
191
+ const path_url = path + '.url';
192
+ if (typeof obj_url !== 'string') {
193
+ return new TypeError('Expected "string" but received "' + typeof obj_url + '" (at "' + path_url + '")');
194
+ }
195
+ })();
196
+ return v_error === undefined ? null : v_error;
197
+ }
198
+ const RepresentationType$2 = 'ManagedContentChannelSummaryRepresentation';
199
+ function keyBuilder$2(luvio, config) {
200
+ return keyPrefix + '::' + RepresentationType$2 + ':' + config.channelId;
201
+ }
202
+ function keyBuilderFromType(luvio, object) {
203
+ const keyParams = {
204
+ channelId: object.id
205
+ };
206
+ return keyBuilder$2(luvio, keyParams);
207
+ }
208
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
209
+ return input;
210
+ }
211
+ const select$3 = function ManagedContentChannelSummaryRepresentationSelect() {
212
+ return {
213
+ kind: 'Fragment',
214
+ version: VERSION$2,
215
+ private: [],
216
+ selections: [
217
+ {
218
+ name: 'id',
219
+ kind: 'Scalar'
220
+ },
221
+ {
222
+ name: 'name',
223
+ kind: 'Scalar'
224
+ },
225
+ {
226
+ name: 'type',
227
+ kind: 'Scalar'
228
+ },
229
+ {
230
+ name: 'url',
231
+ kind: 'Scalar'
232
+ }
233
+ ]
234
+ };
235
+ };
236
+ function equals$2(existing, incoming) {
237
+ const existing_id = existing.id;
238
+ const incoming_id = incoming.id;
239
+ if (!(existing_id === incoming_id)) {
240
+ return false;
241
+ }
242
+ const existing_name = existing.name;
243
+ const incoming_name = incoming.name;
244
+ if (!(existing_name === incoming_name)) {
245
+ return false;
246
+ }
247
+ const existing_type = existing.type;
248
+ const incoming_type = incoming.type;
249
+ if (!(existing_type === incoming_type)) {
250
+ return false;
251
+ }
252
+ const existing_url = existing.url;
253
+ const incoming_url = incoming.url;
254
+ if (!(existing_url === incoming_url)) {
255
+ return false;
256
+ }
257
+ return true;
258
+ }
259
+ const ingest$2 = function ManagedContentChannelSummaryRepresentationIngest(input, path, luvio, store, timestamp) {
260
+ if (process.env.NODE_ENV !== 'production') {
261
+ const validateError = validate$2(input);
262
+ if (validateError !== null) {
263
+ throw validateError;
264
+ }
265
+ }
266
+ const key = keyBuilderFromType(luvio, input);
267
+ const ttlToUse = TTL$2;
268
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "CmsManagement", VERSION$2, RepresentationType$2, equals$2);
269
+ return createLink(key);
270
+ };
271
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
272
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
273
+ const rootKey = keyBuilderFromType(luvio, input);
274
+ rootKeySet.set(rootKey, {
275
+ namespace: keyPrefix,
276
+ representationName: RepresentationType$2,
277
+ mergeable: false
278
+ });
279
+ }
280
+
281
+ const TTL$1 = 30000;
282
+ const VERSION$1 = "1511cb412ac3862b59548167ba28cdde";
283
+ function validate$1(obj, path = 'ManagedContentSpaceChannelRepresentation') {
284
+ const v_error = (() => {
285
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
286
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
287
+ }
288
+ const obj_channelSummary = obj.channelSummary;
289
+ const path_channelSummary = path + '.channelSummary';
290
+ if (typeof obj_channelSummary !== 'object' || Array.isArray(obj_channelSummary)) {
291
+ return new TypeError('Expected "object" but received "' + typeof obj_channelSummary + '" (at "' + path_channelSummary + '")');
292
+ }
293
+ const obj_createdBy = obj.createdBy;
294
+ const path_createdBy = path + '.createdBy';
295
+ const referencepath_createdByValidationError = validate$3(obj_createdBy, path_createdBy);
296
+ if (referencepath_createdByValidationError !== null) {
297
+ let message = 'Object doesn\'t match ManagedContentUserSummaryRepresentation (at "' + path_createdBy + '")\n';
298
+ message += referencepath_createdByValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
299
+ return new TypeError(message);
300
+ }
301
+ const obj_createdDate = obj.createdDate;
302
+ const path_createdDate = path + '.createdDate';
303
+ if (typeof obj_createdDate !== 'string') {
304
+ return new TypeError('Expected "string" but received "' + typeof obj_createdDate + '" (at "' + path_createdDate + '")');
305
+ }
306
+ const obj_status = obj.status;
307
+ const path_status = path + '.status';
308
+ if (typeof obj_status !== 'string') {
309
+ return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
310
+ }
311
+ })();
312
+ return v_error === undefined ? null : v_error;
313
+ }
314
+ const RepresentationType$1 = 'ManagedContentSpaceChannelRepresentation';
315
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
316
+ const input_channelSummary = input.channelSummary;
317
+ const input_channelSummary_id = path.fullPath + '__channelSummary';
318
+ input.channelSummary = ingest$2(input_channelSummary, {
319
+ fullPath: input_channelSummary_id,
320
+ propertyName: 'channelSummary',
321
+ parent: {
322
+ data: input,
323
+ key: path.fullPath,
324
+ existing: existing,
325
+ },
326
+ ttl: path.ttl
327
+ }, luvio, store, timestamp);
328
+ return input;
329
+ }
330
+ const select$2 = function ManagedContentSpaceChannelRepresentationSelect() {
331
+ const { selections: ManagedContentUserSummaryRepresentation__selections, opaque: ManagedContentUserSummaryRepresentation__opaque, } = select$4();
332
+ return {
333
+ kind: 'Fragment',
334
+ version: VERSION$1,
335
+ private: [],
336
+ selections: [
337
+ {
338
+ name: 'channelSummary',
339
+ kind: 'Link',
340
+ fragment: select$3()
341
+ },
342
+ {
343
+ name: 'createdBy',
344
+ kind: 'Object',
345
+ selections: ManagedContentUserSummaryRepresentation__selections
346
+ },
347
+ {
348
+ name: 'createdDate',
349
+ kind: 'Scalar'
350
+ },
351
+ {
352
+ name: 'status',
353
+ kind: 'Scalar'
354
+ }
355
+ ]
356
+ };
357
+ };
358
+ function equals$1(existing, incoming) {
359
+ const existing_createdDate = existing.createdDate;
360
+ const incoming_createdDate = incoming.createdDate;
361
+ if (!(existing_createdDate === incoming_createdDate)) {
362
+ return false;
363
+ }
364
+ const existing_status = existing.status;
365
+ const incoming_status = incoming.status;
366
+ if (!(existing_status === incoming_status)) {
367
+ return false;
368
+ }
369
+ const existing_channelSummary = existing.channelSummary;
370
+ const incoming_channelSummary = incoming.channelSummary;
371
+ if (!(existing_channelSummary.__ref === incoming_channelSummary.__ref)) {
372
+ return false;
373
+ }
374
+ const existing_createdBy = existing.createdBy;
375
+ const incoming_createdBy = incoming.createdBy;
376
+ if (!(equals$3(existing_createdBy, incoming_createdBy))) {
377
+ return false;
378
+ }
379
+ return true;
380
+ }
381
+ const ingest$1 = function ManagedContentSpaceChannelRepresentationIngest(input, path, luvio, store, timestamp) {
382
+ if (process.env.NODE_ENV !== 'production') {
383
+ const validateError = validate$1(input);
384
+ if (validateError !== null) {
385
+ throw validateError;
386
+ }
387
+ }
388
+ const key = path.fullPath;
389
+ const ttlToUse = TTL$1;
390
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "CmsManagement", VERSION$1, RepresentationType$1, equals$1);
391
+ return createLink(key);
392
+ };
393
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
394
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
395
+ const rootKey = fullPathFactory();
396
+ rootKeySet.set(rootKey, {
397
+ namespace: keyPrefix,
398
+ representationName: RepresentationType$1,
399
+ mergeable: false
400
+ });
401
+ getTypeCacheKeys$2(rootKeySet, luvio, input.channelSummary);
402
+ }
403
+
404
+ const TTL = 30000;
405
+ const VERSION = "79158e6cb18aabd47ef4cd8c47aa2d45";
406
+ function validate(obj, path = 'ManagedContentSpaceChannelsRepresentation') {
407
+ const v_error = (() => {
408
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
409
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
410
+ }
411
+ const obj_currentPageUrl = obj.currentPageUrl;
412
+ const path_currentPageUrl = path + '.currentPageUrl';
413
+ let obj_currentPageUrl_union0 = null;
414
+ const obj_currentPageUrl_union0_error = (() => {
415
+ if (typeof obj_currentPageUrl !== 'string') {
416
+ return new TypeError('Expected "string" but received "' + typeof obj_currentPageUrl + '" (at "' + path_currentPageUrl + '")');
417
+ }
418
+ })();
419
+ if (obj_currentPageUrl_union0_error != null) {
420
+ obj_currentPageUrl_union0 = obj_currentPageUrl_union0_error.message;
421
+ }
422
+ let obj_currentPageUrl_union1 = null;
423
+ const obj_currentPageUrl_union1_error = (() => {
424
+ if (obj_currentPageUrl !== null) {
425
+ return new TypeError('Expected "null" but received "' + typeof obj_currentPageUrl + '" (at "' + path_currentPageUrl + '")');
426
+ }
427
+ })();
428
+ if (obj_currentPageUrl_union1_error != null) {
429
+ obj_currentPageUrl_union1 = obj_currentPageUrl_union1_error.message;
430
+ }
431
+ if (obj_currentPageUrl_union0 && obj_currentPageUrl_union1) {
432
+ let message = 'Object doesn\'t match union (at "' + path_currentPageUrl + '")';
433
+ message += '\n' + obj_currentPageUrl_union0.split('\n').map((line) => '\t' + line).join('\n');
434
+ message += '\n' + obj_currentPageUrl_union1.split('\n').map((line) => '\t' + line).join('\n');
435
+ return new TypeError(message);
436
+ }
437
+ const obj_nextPageUrl = obj.nextPageUrl;
438
+ const path_nextPageUrl = path + '.nextPageUrl';
439
+ let obj_nextPageUrl_union0 = null;
440
+ const obj_nextPageUrl_union0_error = (() => {
441
+ if (typeof obj_nextPageUrl !== 'string') {
442
+ return new TypeError('Expected "string" but received "' + typeof obj_nextPageUrl + '" (at "' + path_nextPageUrl + '")');
443
+ }
444
+ })();
445
+ if (obj_nextPageUrl_union0_error != null) {
446
+ obj_nextPageUrl_union0 = obj_nextPageUrl_union0_error.message;
447
+ }
448
+ let obj_nextPageUrl_union1 = null;
449
+ const obj_nextPageUrl_union1_error = (() => {
450
+ if (obj_nextPageUrl !== null) {
451
+ return new TypeError('Expected "null" but received "' + typeof obj_nextPageUrl + '" (at "' + path_nextPageUrl + '")');
452
+ }
453
+ })();
454
+ if (obj_nextPageUrl_union1_error != null) {
455
+ obj_nextPageUrl_union1 = obj_nextPageUrl_union1_error.message;
456
+ }
457
+ if (obj_nextPageUrl_union0 && obj_nextPageUrl_union1) {
458
+ let message = 'Object doesn\'t match union (at "' + path_nextPageUrl + '")';
459
+ message += '\n' + obj_nextPageUrl_union0.split('\n').map((line) => '\t' + line).join('\n');
460
+ message += '\n' + obj_nextPageUrl_union1.split('\n').map((line) => '\t' + line).join('\n');
461
+ return new TypeError(message);
462
+ }
463
+ const obj_previousPageUrl = obj.previousPageUrl;
464
+ const path_previousPageUrl = path + '.previousPageUrl';
465
+ let obj_previousPageUrl_union0 = null;
466
+ const obj_previousPageUrl_union0_error = (() => {
467
+ if (typeof obj_previousPageUrl !== 'string') {
468
+ return new TypeError('Expected "string" but received "' + typeof obj_previousPageUrl + '" (at "' + path_previousPageUrl + '")');
469
+ }
470
+ })();
471
+ if (obj_previousPageUrl_union0_error != null) {
472
+ obj_previousPageUrl_union0 = obj_previousPageUrl_union0_error.message;
473
+ }
474
+ let obj_previousPageUrl_union1 = null;
475
+ const obj_previousPageUrl_union1_error = (() => {
476
+ if (obj_previousPageUrl !== null) {
477
+ return new TypeError('Expected "null" but received "' + typeof obj_previousPageUrl + '" (at "' + path_previousPageUrl + '")');
478
+ }
479
+ })();
480
+ if (obj_previousPageUrl_union1_error != null) {
481
+ obj_previousPageUrl_union1 = obj_previousPageUrl_union1_error.message;
482
+ }
483
+ if (obj_previousPageUrl_union0 && obj_previousPageUrl_union1) {
484
+ let message = 'Object doesn\'t match union (at "' + path_previousPageUrl + '")';
485
+ message += '\n' + obj_previousPageUrl_union0.split('\n').map((line) => '\t' + line).join('\n');
486
+ message += '\n' + obj_previousPageUrl_union1.split('\n').map((line) => '\t' + line).join('\n');
487
+ return new TypeError(message);
488
+ }
489
+ const obj_spaceChannels = obj.spaceChannels;
490
+ const path_spaceChannels = path + '.spaceChannels';
491
+ if (!ArrayIsArray(obj_spaceChannels)) {
492
+ return new TypeError('Expected "array" but received "' + typeof obj_spaceChannels + '" (at "' + path_spaceChannels + '")');
493
+ }
494
+ for (let i = 0; i < obj_spaceChannels.length; i++) {
495
+ const obj_spaceChannels_item = obj_spaceChannels[i];
496
+ const path_spaceChannels_item = path_spaceChannels + '[' + i + ']';
497
+ if (typeof obj_spaceChannels_item !== 'object' || Array.isArray(obj_spaceChannels_item)) {
498
+ return new TypeError('Expected "object" but received "' + typeof obj_spaceChannels_item + '" (at "' + path_spaceChannels_item + '")');
499
+ }
500
+ }
501
+ const obj_totalSpaceChannels = obj.totalSpaceChannels;
502
+ const path_totalSpaceChannels = path + '.totalSpaceChannels';
503
+ if (typeof obj_totalSpaceChannels !== 'number' || (typeof obj_totalSpaceChannels === 'number' && Math.floor(obj_totalSpaceChannels) !== obj_totalSpaceChannels)) {
504
+ return new TypeError('Expected "integer" but received "' + typeof obj_totalSpaceChannels + '" (at "' + path_totalSpaceChannels + '")');
505
+ }
506
+ })();
507
+ return v_error === undefined ? null : v_error;
508
+ }
509
+ const RepresentationType = 'ManagedContentSpaceChannelsRepresentation';
510
+ function normalize(input, existing, path, luvio, store, timestamp) {
511
+ const input_spaceChannels = input.spaceChannels;
512
+ const input_spaceChannels_id = path.fullPath + '__spaceChannels';
513
+ for (let i = 0; i < input_spaceChannels.length; i++) {
514
+ const input_spaceChannels_item = input_spaceChannels[i];
515
+ let input_spaceChannels_item_id = input_spaceChannels_id + '__' + i;
516
+ input_spaceChannels[i] = ingest$1(input_spaceChannels_item, {
517
+ fullPath: input_spaceChannels_item_id,
518
+ propertyName: i,
519
+ parent: {
520
+ data: input,
521
+ key: path.fullPath,
522
+ existing: existing,
523
+ },
524
+ ttl: path.ttl
525
+ }, luvio, store, timestamp);
526
+ }
527
+ return input;
528
+ }
529
+ const select$1 = function ManagedContentSpaceChannelsRepresentationSelect() {
530
+ return {
531
+ kind: 'Fragment',
532
+ version: VERSION,
533
+ private: [],
534
+ selections: [
535
+ {
536
+ name: 'currentPageUrl',
537
+ kind: 'Scalar'
538
+ },
539
+ {
540
+ name: 'nextPageUrl',
541
+ kind: 'Scalar'
542
+ },
543
+ {
544
+ name: 'previousPageUrl',
545
+ kind: 'Scalar'
546
+ },
547
+ {
548
+ name: 'spaceChannels',
549
+ kind: 'Link',
550
+ plural: true,
551
+ fragment: select$2()
552
+ },
553
+ {
554
+ name: 'totalSpaceChannels',
555
+ kind: 'Scalar'
556
+ }
557
+ ]
558
+ };
559
+ };
560
+ function equals(existing, incoming) {
561
+ const existing_totalSpaceChannels = existing.totalSpaceChannels;
562
+ const incoming_totalSpaceChannels = incoming.totalSpaceChannels;
563
+ if (!(existing_totalSpaceChannels === incoming_totalSpaceChannels)) {
564
+ return false;
565
+ }
566
+ const existing_currentPageUrl = existing.currentPageUrl;
567
+ const incoming_currentPageUrl = incoming.currentPageUrl;
568
+ if (!(existing_currentPageUrl === incoming_currentPageUrl)) {
569
+ return false;
570
+ }
571
+ const existing_nextPageUrl = existing.nextPageUrl;
572
+ const incoming_nextPageUrl = incoming.nextPageUrl;
573
+ if (!(existing_nextPageUrl === incoming_nextPageUrl)) {
574
+ return false;
575
+ }
576
+ const existing_previousPageUrl = existing.previousPageUrl;
577
+ const incoming_previousPageUrl = incoming.previousPageUrl;
578
+ if (!(existing_previousPageUrl === incoming_previousPageUrl)) {
579
+ return false;
580
+ }
581
+ const existing_spaceChannels = existing.spaceChannels;
582
+ const incoming_spaceChannels = incoming.spaceChannels;
583
+ const equals_spaceChannels_items = equalsArray(existing_spaceChannels, incoming_spaceChannels, (existing_spaceChannels_item, incoming_spaceChannels_item) => {
584
+ if (!(existing_spaceChannels_item.__ref === incoming_spaceChannels_item.__ref)) {
585
+ return false;
586
+ }
587
+ });
588
+ if (equals_spaceChannels_items === false) {
589
+ return false;
590
+ }
591
+ return true;
592
+ }
593
+ const ingest = function ManagedContentSpaceChannelsRepresentationIngest(input, path, luvio, store, timestamp) {
594
+ if (process.env.NODE_ENV !== 'production') {
595
+ const validateError = validate(input);
596
+ if (validateError !== null) {
597
+ throw validateError;
598
+ }
599
+ }
600
+ const key = path.fullPath;
601
+ const ttlToUse = TTL;
602
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "CmsManagement", VERSION, RepresentationType, equals);
603
+ return createLink(key);
604
+ };
605
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
606
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
607
+ const rootKey = fullPathFactory();
608
+ rootKeySet.set(rootKey, {
609
+ namespace: keyPrefix,
610
+ representationName: RepresentationType,
611
+ mergeable: false
612
+ });
613
+ const input_spaceChannels_length = input.spaceChannels.length;
614
+ for (let i = 0; i < input_spaceChannels_length; i++) {
615
+ getTypeCacheKeys$1(rootKeySet, luvio, input.spaceChannels[i], () => '');
616
+ }
617
+ }
618
+
619
+ function select(luvio, params) {
620
+ return select$1();
621
+ }
622
+ function keyBuilder$1(luvio, params) {
623
+ return keyPrefix + '::ManagedContentSpaceChannelsRepresentation:(' + 'page:' + params.queryParams.page + ',' + 'pageSize:' + params.queryParams.pageSize + ',' + 'contentSpaceId:' + params.urlParams.contentSpaceId + ')';
624
+ }
625
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
626
+ getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
627
+ }
628
+ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
629
+ const { body } = response;
630
+ const key = keyBuilder$1(luvio, resourceParams);
631
+ luvio.storeIngest(key, ingest, body);
632
+ const snapshot = luvio.storeLookup({
633
+ recordId: key,
634
+ node: select(),
635
+ variables: {},
636
+ }, snapshotRefresh);
637
+ if (process.env.NODE_ENV !== 'production') {
638
+ if (snapshot.state !== 'Fulfilled') {
639
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
640
+ }
641
+ }
642
+ deepFreeze(snapshot.data);
643
+ return snapshot;
644
+ }
645
+ function ingestError(luvio, params, error, snapshotRefresh) {
646
+ const key = keyBuilder$1(luvio, params);
647
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
648
+ const storeMetadataParams = {
649
+ ttl: TTL,
650
+ namespace: keyPrefix,
651
+ version: VERSION,
652
+ representationName: RepresentationType
653
+ };
654
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
655
+ return errorSnapshot;
656
+ }
657
+ function createResourceRequest(config) {
658
+ const headers = {};
659
+ return {
660
+ baseUri: '/services/data/v66.0',
661
+ basePath: '/connect/cms/spaces/' + config.urlParams.contentSpaceId + '/channels',
662
+ method: 'get',
663
+ body: null,
664
+ urlParams: config.urlParams,
665
+ queryParams: config.queryParams,
666
+ headers,
667
+ priority: 'normal',
668
+ };
669
+ }
670
+
671
+ const adapterName = 'getManagedContentSpaceChannels';
672
+ const getManagedContentSpaceChannels_ConfigPropertyMetadata = [
673
+ generateParamConfigMetadata('contentSpaceId', true, 0 /* UrlParameter */, 0 /* String */),
674
+ generateParamConfigMetadata('page', false, 1 /* QueryParameter */, 3 /* Integer */),
675
+ generateParamConfigMetadata('pageSize', false, 1 /* QueryParameter */, 3 /* Integer */),
676
+ ];
677
+ const getManagedContentSpaceChannels_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getManagedContentSpaceChannels_ConfigPropertyMetadata);
678
+ const createResourceParams = /*#__PURE__*/ createResourceParams$1(getManagedContentSpaceChannels_ConfigPropertyMetadata);
679
+ function keyBuilder(luvio, config) {
680
+ const resourceParams = createResourceParams(config);
681
+ return keyBuilder$1(luvio, resourceParams);
682
+ }
683
+ function typeCheckConfig(untrustedConfig) {
684
+ const config = {};
685
+ typeCheckConfig$1(untrustedConfig, config, getManagedContentSpaceChannels_ConfigPropertyMetadata);
686
+ return config;
687
+ }
688
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
689
+ if (!untrustedIsObject(untrustedConfig)) {
690
+ return null;
691
+ }
692
+ if (process.env.NODE_ENV !== 'production') {
693
+ validateConfig(untrustedConfig, configPropertyNames);
694
+ }
695
+ const config = typeCheckConfig(untrustedConfig);
696
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
697
+ return null;
698
+ }
699
+ return config;
700
+ }
701
+ function adapterFragment(luvio, config) {
702
+ createResourceParams(config);
703
+ return select();
704
+ }
705
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
706
+ const snapshot = ingestSuccess(luvio, resourceParams, response, {
707
+ config,
708
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
709
+ });
710
+ return luvio.storeBroadcast().then(() => snapshot);
711
+ }
712
+ function onFetchResponseError(luvio, config, resourceParams, response) {
713
+ const snapshot = ingestError(luvio, resourceParams, response, {
714
+ config,
715
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
716
+ });
717
+ return luvio.storeBroadcast().then(() => snapshot);
718
+ }
719
+ function buildNetworkSnapshot(luvio, config, options) {
720
+ const resourceParams = createResourceParams(config);
721
+ const request = createResourceRequest(resourceParams);
722
+ return luvio.dispatchResourceRequest(request, options)
723
+ .then((response) => {
724
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
725
+ const cache = new StoreKeyMap();
726
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
727
+ return cache;
728
+ });
729
+ }, (response) => {
730
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
731
+ });
732
+ }
733
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
734
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
735
+ }
736
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
737
+ const { luvio, config } = context;
738
+ const selector = {
739
+ recordId: keyBuilder(luvio, config),
740
+ node: adapterFragment(luvio, config),
741
+ variables: {},
742
+ };
743
+ const cacheSnapshot = storeLookup(selector, {
744
+ config,
745
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
746
+ });
747
+ return cacheSnapshot;
748
+ }
749
+ const getManagedContentSpaceChannelsAdapterFactory = (luvio) => function CmsManagement__getManagedContentSpaceChannels(untrustedConfig, requestContext) {
750
+ const config = validateAdapterConfig(untrustedConfig, getManagedContentSpaceChannels_ConfigPropertyNames);
751
+ // Invalid or incomplete config
752
+ if (config === null) {
753
+ return null;
754
+ }
755
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
756
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
757
+ };
758
+
759
+ let getManagedContentSpaceChannels;
760
+ // Imperative GET Adapters
761
+ let getManagedContentSpaceChannels_imperative;
762
+ // Adapter Metadata
763
+ const getManagedContentSpaceChannelsMetadata = {
764
+ apiFamily: 'CmsManagement',
765
+ name: 'getManagedContentSpaceChannels',
766
+ ttl: 30000,
767
+ };
768
+ // Notify Update Available
769
+ function bindExportsTo(luvio) {
770
+ // LDS Adapters
771
+ const getManagedContentSpaceChannels_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getManagedContentSpaceChannels', getManagedContentSpaceChannelsAdapterFactory), getManagedContentSpaceChannelsMetadata);
772
+ return {
773
+ getManagedContentSpaceChannels: createWireAdapterConstructor(luvio, getManagedContentSpaceChannels_ldsAdapter, getManagedContentSpaceChannelsMetadata),
774
+ // Imperative GET Adapters
775
+ getManagedContentSpaceChannels_imperative: createImperativeAdapter(luvio, getManagedContentSpaceChannels_ldsAdapter, getManagedContentSpaceChannelsMetadata),
776
+ // Notify Update Availables
777
+ };
778
+ }
779
+ withDefaultLuvio((luvio) => {
780
+ ({ getManagedContentSpaceChannels, getManagedContentSpaceChannels_imperative } =
781
+ bindExportsTo(luvio));
782
+ });
783
+
784
+ export { getManagedContentSpaceChannels, getManagedContentSpaceChannels_imperative };
785
+ // version: 0.1.0-dev1-c978a7b010