@salesforce/lds-adapters-community-navigation-menu 0.131.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.
- package/LICENSE.txt +82 -0
- package/dist/es/es2018/community-navigation-menu.js +447 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +66 -0
- package/dist/es/es2018/types/src/generated/adapters/getCommunityNavigationMenu.d.ts +33 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +1 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +3 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectCommunitiesNavigationMenuNavigationMenuItemsByCommunityId.d.ts +24 -0
- package/dist/es/es2018/types/src/generated/types/NavigationMenuItemCollectionRepresentation.d.ts +30 -0
- package/dist/es/es2018/types/src/generated/types/NavigationMenuItemRepresentation.d.ts +44 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +39 -0
- package/package.json +53 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +479 -0
- package/src/raml/api.raml +114 -0
- package/src/raml/luvio.raml +17 -0
package/sfdc/index.js
ADDED
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/* *******************************************************************************************
|
|
8
|
+
* ATTENTION!
|
|
9
|
+
* THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
|
|
10
|
+
* If you would like to contribute to LDS, please follow the steps outlined in the git repo.
|
|
11
|
+
* Any changes made to this file in p4 will be automatically overwritten.
|
|
12
|
+
* *******************************************************************************************
|
|
13
|
+
*/
|
|
14
|
+
/* proxy-compat-disable */
|
|
15
|
+
import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
|
|
16
|
+
import { withDefaultLuvio } from 'force/ldsEngine';
|
|
17
|
+
import { serializeStructuredKey, StoreKeyMap } from 'force/luvioEngine';
|
|
18
|
+
|
|
19
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
20
|
+
const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = Object;
|
|
21
|
+
const { isArray: ArrayIsArray$1 } = Array;
|
|
22
|
+
/**
|
|
23
|
+
* Validates an adapter config is well-formed.
|
|
24
|
+
* @param config The config to validate.
|
|
25
|
+
* @param adapter The adapter validation configuration.
|
|
26
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
27
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
28
|
+
*/
|
|
29
|
+
function validateConfig(config, adapter, oneOf) {
|
|
30
|
+
const { displayName } = adapter;
|
|
31
|
+
const { required, optional, unsupported } = adapter.parameters;
|
|
32
|
+
if (config === undefined ||
|
|
33
|
+
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
34
|
+
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
35
|
+
}
|
|
36
|
+
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
37
|
+
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
38
|
+
}
|
|
39
|
+
if (unsupported !== undefined &&
|
|
40
|
+
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
41
|
+
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
42
|
+
}
|
|
43
|
+
const supported = required.concat(optional);
|
|
44
|
+
if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
|
|
45
|
+
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function untrustedIsObject(untrusted) {
|
|
49
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
50
|
+
}
|
|
51
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
52
|
+
return configPropertyNames.parameters.required.every(req => req in config);
|
|
53
|
+
}
|
|
54
|
+
const snapshotRefreshOptions = {
|
|
55
|
+
overrides: {
|
|
56
|
+
headers: {
|
|
57
|
+
'Cache-Control': 'no-cache',
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const keyPrefix = 'CommunityNavigation';
|
|
62
|
+
|
|
63
|
+
const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
64
|
+
const { isArray: ArrayIsArray } = Array;
|
|
65
|
+
const { stringify: JSONStringify } = JSON;
|
|
66
|
+
function createLink(ref) {
|
|
67
|
+
return {
|
|
68
|
+
__ref: serializeStructuredKey(ref),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function validate$1(obj, path = 'NavigationMenuItemRepresentation') {
|
|
73
|
+
const v_error = (() => {
|
|
74
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
75
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
76
|
+
}
|
|
77
|
+
const obj_actionType = obj.actionType;
|
|
78
|
+
const path_actionType = path + '.actionType';
|
|
79
|
+
if (typeof obj_actionType !== 'string') {
|
|
80
|
+
return new TypeError('Expected "string" but received "' + typeof obj_actionType + '" (at "' + path_actionType + '")');
|
|
81
|
+
}
|
|
82
|
+
const obj_actionValue = obj.actionValue;
|
|
83
|
+
const path_actionValue = path + '.actionValue';
|
|
84
|
+
let obj_actionValue_union0 = null;
|
|
85
|
+
const obj_actionValue_union0_error = (() => {
|
|
86
|
+
if (typeof obj_actionValue !== 'string') {
|
|
87
|
+
return new TypeError('Expected "string" but received "' + typeof obj_actionValue + '" (at "' + path_actionValue + '")');
|
|
88
|
+
}
|
|
89
|
+
})();
|
|
90
|
+
if (obj_actionValue_union0_error != null) {
|
|
91
|
+
obj_actionValue_union0 = obj_actionValue_union0_error.message;
|
|
92
|
+
}
|
|
93
|
+
let obj_actionValue_union1 = null;
|
|
94
|
+
const obj_actionValue_union1_error = (() => {
|
|
95
|
+
if (obj_actionValue !== null) {
|
|
96
|
+
return new TypeError('Expected "null" but received "' + typeof obj_actionValue + '" (at "' + path_actionValue + '")');
|
|
97
|
+
}
|
|
98
|
+
})();
|
|
99
|
+
if (obj_actionValue_union1_error != null) {
|
|
100
|
+
obj_actionValue_union1 = obj_actionValue_union1_error.message;
|
|
101
|
+
}
|
|
102
|
+
if (obj_actionValue_union0 && obj_actionValue_union1) {
|
|
103
|
+
let message = 'Object doesn\'t match union (at "' + path_actionValue + '")';
|
|
104
|
+
message += '\n' + obj_actionValue_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
105
|
+
message += '\n' + obj_actionValue_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
106
|
+
return new TypeError(message);
|
|
107
|
+
}
|
|
108
|
+
const obj_imageUrl = obj.imageUrl;
|
|
109
|
+
const path_imageUrl = path + '.imageUrl';
|
|
110
|
+
let obj_imageUrl_union0 = null;
|
|
111
|
+
const obj_imageUrl_union0_error = (() => {
|
|
112
|
+
if (typeof obj_imageUrl !== 'string') {
|
|
113
|
+
return new TypeError('Expected "string" but received "' + typeof obj_imageUrl + '" (at "' + path_imageUrl + '")');
|
|
114
|
+
}
|
|
115
|
+
})();
|
|
116
|
+
if (obj_imageUrl_union0_error != null) {
|
|
117
|
+
obj_imageUrl_union0 = obj_imageUrl_union0_error.message;
|
|
118
|
+
}
|
|
119
|
+
let obj_imageUrl_union1 = null;
|
|
120
|
+
const obj_imageUrl_union1_error = (() => {
|
|
121
|
+
if (obj_imageUrl !== null) {
|
|
122
|
+
return new TypeError('Expected "null" but received "' + typeof obj_imageUrl + '" (at "' + path_imageUrl + '")');
|
|
123
|
+
}
|
|
124
|
+
})();
|
|
125
|
+
if (obj_imageUrl_union1_error != null) {
|
|
126
|
+
obj_imageUrl_union1 = obj_imageUrl_union1_error.message;
|
|
127
|
+
}
|
|
128
|
+
if (obj_imageUrl_union0 && obj_imageUrl_union1) {
|
|
129
|
+
let message = 'Object doesn\'t match union (at "' + path_imageUrl + '")';
|
|
130
|
+
message += '\n' + obj_imageUrl_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
131
|
+
message += '\n' + obj_imageUrl_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
132
|
+
return new TypeError(message);
|
|
133
|
+
}
|
|
134
|
+
const obj_label = obj.label;
|
|
135
|
+
const path_label = path + '.label';
|
|
136
|
+
if (typeof obj_label !== 'string') {
|
|
137
|
+
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
138
|
+
}
|
|
139
|
+
const obj_subMenu = obj.subMenu;
|
|
140
|
+
const path_subMenu = path + '.subMenu';
|
|
141
|
+
if (!ArrayIsArray(obj_subMenu)) {
|
|
142
|
+
return new TypeError('Expected "array" but received "' + typeof obj_subMenu + '" (at "' + path_subMenu + '")');
|
|
143
|
+
}
|
|
144
|
+
for (let i = 0; i < obj_subMenu.length; i++) {
|
|
145
|
+
const obj_subMenu_item = obj_subMenu[i];
|
|
146
|
+
const path_subMenu_item = path_subMenu + '[' + i + ']';
|
|
147
|
+
const referencepath_subMenu_itemValidationError = validate$1(obj_subMenu_item, path_subMenu_item);
|
|
148
|
+
if (referencepath_subMenu_itemValidationError !== null) {
|
|
149
|
+
let message = 'Object doesn\'t match NavigationMenuItemRepresentation (at "' + path_subMenu_item + '")\n';
|
|
150
|
+
message += referencepath_subMenu_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
151
|
+
return new TypeError(message);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const obj_target = obj.target;
|
|
155
|
+
const path_target = path + '.target';
|
|
156
|
+
if (typeof obj_target !== 'string') {
|
|
157
|
+
return new TypeError('Expected "string" but received "' + typeof obj_target + '" (at "' + path_target + '")');
|
|
158
|
+
}
|
|
159
|
+
})();
|
|
160
|
+
return v_error === undefined ? null : v_error;
|
|
161
|
+
}
|
|
162
|
+
function deepFreeze$1(input) {
|
|
163
|
+
const input_subMenu = input.subMenu;
|
|
164
|
+
for (let i = 0; i < input_subMenu.length; i++) {
|
|
165
|
+
const input_subMenu_item = input_subMenu[i];
|
|
166
|
+
deepFreeze$1(input_subMenu_item);
|
|
167
|
+
}
|
|
168
|
+
ObjectFreeze(input_subMenu);
|
|
169
|
+
ObjectFreeze(input);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const VERSION = "2c44fa1cf5686d4e00960baa7b9e6a1f";
|
|
173
|
+
function validate(obj, path = 'NavigationMenuItemCollectionRepresentation') {
|
|
174
|
+
const v_error = (() => {
|
|
175
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
176
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
177
|
+
}
|
|
178
|
+
const obj_menuItems = obj.menuItems;
|
|
179
|
+
const path_menuItems = path + '.menuItems';
|
|
180
|
+
if (!ArrayIsArray(obj_menuItems)) {
|
|
181
|
+
return new TypeError('Expected "array" but received "' + typeof obj_menuItems + '" (at "' + path_menuItems + '")');
|
|
182
|
+
}
|
|
183
|
+
for (let i = 0; i < obj_menuItems.length; i++) {
|
|
184
|
+
const obj_menuItems_item = obj_menuItems[i];
|
|
185
|
+
const path_menuItems_item = path_menuItems + '[' + i + ']';
|
|
186
|
+
const referencepath_menuItems_itemValidationError = validate$1(obj_menuItems_item, path_menuItems_item);
|
|
187
|
+
if (referencepath_menuItems_itemValidationError !== null) {
|
|
188
|
+
let message = 'Object doesn\'t match NavigationMenuItemRepresentation (at "' + path_menuItems_item + '")\n';
|
|
189
|
+
message += referencepath_menuItems_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
190
|
+
return new TypeError(message);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
})();
|
|
194
|
+
return v_error === undefined ? null : v_error;
|
|
195
|
+
}
|
|
196
|
+
const RepresentationType = 'NavigationMenuItemCollectionRepresentation';
|
|
197
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
198
|
+
return input;
|
|
199
|
+
}
|
|
200
|
+
const select$1 = function NavigationMenuItemCollectionRepresentationSelect() {
|
|
201
|
+
return {
|
|
202
|
+
kind: 'Fragment',
|
|
203
|
+
version: VERSION,
|
|
204
|
+
private: [],
|
|
205
|
+
opaque: true
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
function equals(existing, incoming) {
|
|
209
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
function deepFreeze(input) {
|
|
215
|
+
const input_menuItems = input.menuItems;
|
|
216
|
+
for (let i = 0; i < input_menuItems.length; i++) {
|
|
217
|
+
const input_menuItems_item = input_menuItems[i];
|
|
218
|
+
deepFreeze$1(input_menuItems_item);
|
|
219
|
+
}
|
|
220
|
+
ObjectFreeze(input_menuItems);
|
|
221
|
+
ObjectFreeze(input);
|
|
222
|
+
}
|
|
223
|
+
const ingest = function NavigationMenuItemCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
224
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
225
|
+
const validateError = validate(input);
|
|
226
|
+
if (validateError !== null) {
|
|
227
|
+
throw validateError;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const key = path.fullPath;
|
|
231
|
+
const existingRecord = store.readEntry(key);
|
|
232
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
|
|
233
|
+
let incomingRecord = normalize(input, store.readEntry(key), {
|
|
234
|
+
fullPath: key,
|
|
235
|
+
parent: path.parent,
|
|
236
|
+
propertyName: path.propertyName,
|
|
237
|
+
ttl: ttlToUse
|
|
238
|
+
});
|
|
239
|
+
deepFreeze(input);
|
|
240
|
+
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
241
|
+
luvio.storePublish(key, incomingRecord);
|
|
242
|
+
}
|
|
243
|
+
if (ttlToUse !== undefined) {
|
|
244
|
+
const storeMetadataParams = {
|
|
245
|
+
ttl: ttlToUse,
|
|
246
|
+
namespace: "CommunityNavigation",
|
|
247
|
+
version: VERSION,
|
|
248
|
+
representationName: RepresentationType,
|
|
249
|
+
};
|
|
250
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
251
|
+
}
|
|
252
|
+
return createLink(key);
|
|
253
|
+
};
|
|
254
|
+
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
255
|
+
const rootKeySet = new StoreKeyMap();
|
|
256
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
257
|
+
const rootKey = fullPathFactory();
|
|
258
|
+
rootKeySet.set(rootKey, {
|
|
259
|
+
namespace: keyPrefix,
|
|
260
|
+
representationName: RepresentationType,
|
|
261
|
+
mergeable: false
|
|
262
|
+
});
|
|
263
|
+
return rootKeySet;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function select(luvio, params) {
|
|
267
|
+
return select$1();
|
|
268
|
+
}
|
|
269
|
+
function keyBuilder$1(luvio, params) {
|
|
270
|
+
return keyPrefix + '::NavigationMenuItemCollectionRepresentation:(' + 'addHomeMenuItem:' + params.queryParams.addHomeMenuItem + ',' + 'effectiveAccountId:' + params.queryParams.effectiveAccountId + ',' + 'includeImageUrl:' + params.queryParams.includeImageUrl + ',' + 'menuItemTypesToSkip:' + params.queryParams.menuItemTypesToSkip + ',' + 'navigationLinkSetDeveloperName:' + params.queryParams.navigationLinkSetDeveloperName + ',' + 'navigationLinkSetId:' + params.queryParams.navigationLinkSetId + ',' + 'publishStatus:' + params.queryParams.publishStatus + ',' + 'communityId:' + params.urlParams.communityId + ')';
|
|
271
|
+
}
|
|
272
|
+
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
273
|
+
return getTypeCacheKeys(luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
274
|
+
}
|
|
275
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
276
|
+
const { body } = response;
|
|
277
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
278
|
+
luvio.storeIngest(key, ingest, body);
|
|
279
|
+
const snapshot = luvio.storeLookup({
|
|
280
|
+
recordId: key,
|
|
281
|
+
node: select(),
|
|
282
|
+
variables: {},
|
|
283
|
+
}, snapshotRefresh);
|
|
284
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
285
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
286
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return snapshot;
|
|
290
|
+
}
|
|
291
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
292
|
+
const key = keyBuilder$1(luvio, params);
|
|
293
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
294
|
+
luvio.storeIngestError(key, errorSnapshot);
|
|
295
|
+
return errorSnapshot;
|
|
296
|
+
}
|
|
297
|
+
function createResourceRequest(config) {
|
|
298
|
+
const headers = {};
|
|
299
|
+
return {
|
|
300
|
+
baseUri: '/services/data/v58.0',
|
|
301
|
+
basePath: '/connect/communities/' + config.urlParams.communityId + '/navigation-menu/navigation-menu-items',
|
|
302
|
+
method: 'get',
|
|
303
|
+
body: null,
|
|
304
|
+
urlParams: config.urlParams,
|
|
305
|
+
queryParams: config.queryParams,
|
|
306
|
+
headers,
|
|
307
|
+
priority: 'normal',
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
const getCommunityNavigationMenu_ConfigPropertyNames = {
|
|
312
|
+
displayName: 'getCommunityNavigationMenu',
|
|
313
|
+
parameters: {
|
|
314
|
+
required: ['communityId'],
|
|
315
|
+
optional: ['addHomeMenuItem', 'effectiveAccountId', 'includeImageUrl', 'menuItemTypesToSkip', 'navigationLinkSetDeveloperName', 'navigationLinkSetId', 'publishStatus']
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
function createResourceParams(config) {
|
|
319
|
+
const resourceParams = {
|
|
320
|
+
urlParams: {
|
|
321
|
+
communityId: config.communityId
|
|
322
|
+
},
|
|
323
|
+
queryParams: {
|
|
324
|
+
addHomeMenuItem: config.addHomeMenuItem, effectiveAccountId: config.effectiveAccountId, includeImageUrl: config.includeImageUrl, menuItemTypesToSkip: config.menuItemTypesToSkip, navigationLinkSetDeveloperName: config.navigationLinkSetDeveloperName, navigationLinkSetId: config.navigationLinkSetId, publishStatus: config.publishStatus
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
return resourceParams;
|
|
328
|
+
}
|
|
329
|
+
function keyBuilder(luvio, config) {
|
|
330
|
+
const resourceParams = createResourceParams(config);
|
|
331
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
332
|
+
}
|
|
333
|
+
function typeCheckConfig(untrustedConfig) {
|
|
334
|
+
const config = {};
|
|
335
|
+
const untrustedConfig_communityId = untrustedConfig.communityId;
|
|
336
|
+
if (typeof untrustedConfig_communityId === 'string') {
|
|
337
|
+
config.communityId = untrustedConfig_communityId;
|
|
338
|
+
}
|
|
339
|
+
const untrustedConfig_addHomeMenuItem = untrustedConfig.addHomeMenuItem;
|
|
340
|
+
if (typeof untrustedConfig_addHomeMenuItem === 'boolean') {
|
|
341
|
+
config.addHomeMenuItem = untrustedConfig_addHomeMenuItem;
|
|
342
|
+
}
|
|
343
|
+
const untrustedConfig_effectiveAccountId = untrustedConfig.effectiveAccountId;
|
|
344
|
+
if (typeof untrustedConfig_effectiveAccountId === 'string') {
|
|
345
|
+
config.effectiveAccountId = untrustedConfig_effectiveAccountId;
|
|
346
|
+
}
|
|
347
|
+
const untrustedConfig_includeImageUrl = untrustedConfig.includeImageUrl;
|
|
348
|
+
if (typeof untrustedConfig_includeImageUrl === 'boolean') {
|
|
349
|
+
config.includeImageUrl = untrustedConfig_includeImageUrl;
|
|
350
|
+
}
|
|
351
|
+
const untrustedConfig_menuItemTypesToSkip = untrustedConfig.menuItemTypesToSkip;
|
|
352
|
+
if (ArrayIsArray$1(untrustedConfig_menuItemTypesToSkip)) {
|
|
353
|
+
const untrustedConfig_menuItemTypesToSkip_array = [];
|
|
354
|
+
for (let i = 0, arrayLength = untrustedConfig_menuItemTypesToSkip.length; i < arrayLength; i++) {
|
|
355
|
+
const untrustedConfig_menuItemTypesToSkip_item = untrustedConfig_menuItemTypesToSkip[i];
|
|
356
|
+
if (typeof untrustedConfig_menuItemTypesToSkip_item === 'string') {
|
|
357
|
+
untrustedConfig_menuItemTypesToSkip_array.push(untrustedConfig_menuItemTypesToSkip_item);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
config.menuItemTypesToSkip = untrustedConfig_menuItemTypesToSkip_array;
|
|
361
|
+
}
|
|
362
|
+
const untrustedConfig_navigationLinkSetDeveloperName = untrustedConfig.navigationLinkSetDeveloperName;
|
|
363
|
+
if (typeof untrustedConfig_navigationLinkSetDeveloperName === 'string') {
|
|
364
|
+
config.navigationLinkSetDeveloperName = untrustedConfig_navigationLinkSetDeveloperName;
|
|
365
|
+
}
|
|
366
|
+
const untrustedConfig_navigationLinkSetId = untrustedConfig.navigationLinkSetId;
|
|
367
|
+
if (typeof untrustedConfig_navigationLinkSetId === 'string') {
|
|
368
|
+
config.navigationLinkSetId = untrustedConfig_navigationLinkSetId;
|
|
369
|
+
}
|
|
370
|
+
const untrustedConfig_publishStatus = untrustedConfig.publishStatus;
|
|
371
|
+
if (typeof untrustedConfig_publishStatus === 'string') {
|
|
372
|
+
config.publishStatus = untrustedConfig_publishStatus;
|
|
373
|
+
}
|
|
374
|
+
return config;
|
|
375
|
+
}
|
|
376
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
377
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
378
|
+
return null;
|
|
379
|
+
}
|
|
380
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
381
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
382
|
+
}
|
|
383
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
384
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
385
|
+
return null;
|
|
386
|
+
}
|
|
387
|
+
return config;
|
|
388
|
+
}
|
|
389
|
+
function adapterFragment(luvio, config) {
|
|
390
|
+
createResourceParams(config);
|
|
391
|
+
return select();
|
|
392
|
+
}
|
|
393
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
394
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
395
|
+
config,
|
|
396
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
397
|
+
});
|
|
398
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
399
|
+
}
|
|
400
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
401
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
402
|
+
config,
|
|
403
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
404
|
+
});
|
|
405
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
406
|
+
}
|
|
407
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
408
|
+
const resourceParams = createResourceParams(config);
|
|
409
|
+
const request = createResourceRequest(resourceParams);
|
|
410
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
411
|
+
.then((response) => {
|
|
412
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys(luvio, resourceParams, response.body));
|
|
413
|
+
}, (response) => {
|
|
414
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
418
|
+
const { luvio, config } = context;
|
|
419
|
+
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
420
|
+
const dispatchOptions = {
|
|
421
|
+
resourceRequestContext: {
|
|
422
|
+
requestCorrelator,
|
|
423
|
+
luvioRequestMethod: undefined,
|
|
424
|
+
},
|
|
425
|
+
eventObservers
|
|
426
|
+
};
|
|
427
|
+
if (networkPriority !== 'normal') {
|
|
428
|
+
dispatchOptions.overrides = {
|
|
429
|
+
priority: networkPriority
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
return buildNetworkSnapshot(luvio, config, dispatchOptions);
|
|
433
|
+
}
|
|
434
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
435
|
+
const { luvio, config } = context;
|
|
436
|
+
const selector = {
|
|
437
|
+
recordId: keyBuilder(luvio, config),
|
|
438
|
+
node: adapterFragment(luvio, config),
|
|
439
|
+
variables: {},
|
|
440
|
+
};
|
|
441
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
442
|
+
config,
|
|
443
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
444
|
+
});
|
|
445
|
+
return cacheSnapshot;
|
|
446
|
+
}
|
|
447
|
+
const getCommunityNavigationMenuAdapterFactory = (luvio) => function CommunityNavigation__getCommunityNavigationMenu(untrustedConfig, requestContext) {
|
|
448
|
+
const config = validateAdapterConfig(untrustedConfig, getCommunityNavigationMenu_ConfigPropertyNames);
|
|
449
|
+
// Invalid or incomplete config
|
|
450
|
+
if (config === null) {
|
|
451
|
+
return null;
|
|
452
|
+
}
|
|
453
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
454
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
let getCommunityNavigationMenu;
|
|
458
|
+
// Imperative GET Adapters
|
|
459
|
+
let getCommunityNavigationMenu_imperative;
|
|
460
|
+
// Adapter Metadata
|
|
461
|
+
const getCommunityNavigationMenuMetadata = { apiFamily: 'CommunityNavigation', name: 'getCommunityNavigationMenu' };
|
|
462
|
+
function bindExportsTo(luvio) {
|
|
463
|
+
// LDS Adapters
|
|
464
|
+
const getCommunityNavigationMenu_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getCommunityNavigationMenu', getCommunityNavigationMenuAdapterFactory), getCommunityNavigationMenuMetadata);
|
|
465
|
+
return {
|
|
466
|
+
getCommunityNavigationMenu: createWireAdapterConstructor(luvio, getCommunityNavigationMenu_ldsAdapter, getCommunityNavigationMenuMetadata),
|
|
467
|
+
// Imperative GET Adapters
|
|
468
|
+
getCommunityNavigationMenu_imperative: createImperativeAdapter(luvio, getCommunityNavigationMenu_ldsAdapter, getCommunityNavigationMenuMetadata)
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
withDefaultLuvio((luvio) => {
|
|
472
|
+
({
|
|
473
|
+
getCommunityNavigationMenu,
|
|
474
|
+
getCommunityNavigationMenu_imperative
|
|
475
|
+
} = bindExportsTo(luvio));
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
export { getCommunityNavigationMenu, getCommunityNavigationMenu_imperative };
|
|
479
|
+
// version: 0.131.0-c1ec5b7de
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
#%RAML 1.0
|
|
2
|
+
securedBy:
|
|
3
|
+
- OAuth2
|
|
4
|
+
title: Salesforce Connect API
|
|
5
|
+
version: '54.0'
|
|
6
|
+
mediaType: application/json
|
|
7
|
+
protocols:
|
|
8
|
+
- https
|
|
9
|
+
baseUri: /services/data/v58.0
|
|
10
|
+
securitySchemes:
|
|
11
|
+
OAuth2:
|
|
12
|
+
type: OAuth 2.0
|
|
13
|
+
settings:
|
|
14
|
+
authorizationUri: https://example.com/oauth/authorize
|
|
15
|
+
accessTokenUri: ''
|
|
16
|
+
authorizationGrants:
|
|
17
|
+
- implicit
|
|
18
|
+
annotationTypes:
|
|
19
|
+
oas-readOnly:
|
|
20
|
+
type: boolean
|
|
21
|
+
allowedTargets: TypeDeclaration
|
|
22
|
+
oas-collectionFormat:
|
|
23
|
+
type: string
|
|
24
|
+
oas-body-name:
|
|
25
|
+
type: string
|
|
26
|
+
allowedTargets: TypeDeclaration
|
|
27
|
+
types:
|
|
28
|
+
NavigationMenuItemCollectionRepresentation:
|
|
29
|
+
description: Navigation Menu Item Collection
|
|
30
|
+
type: object
|
|
31
|
+
properties:
|
|
32
|
+
menuItems:
|
|
33
|
+
description: Returns list of Navigation menu Items
|
|
34
|
+
type: array
|
|
35
|
+
items:
|
|
36
|
+
type: NavigationMenuItemRepresentation
|
|
37
|
+
NavigationMenuItemRepresentation:
|
|
38
|
+
description: Navigation Menu Item Representation
|
|
39
|
+
type: object
|
|
40
|
+
properties:
|
|
41
|
+
actionType:
|
|
42
|
+
description: Returns the url type or Event of Navigation Menu Item
|
|
43
|
+
type: string
|
|
44
|
+
enum:
|
|
45
|
+
- Event
|
|
46
|
+
- ExternalLink
|
|
47
|
+
- InternalLink
|
|
48
|
+
actionValue:
|
|
49
|
+
description: Returns the route url or event fqn for Navigation Menu item
|
|
50
|
+
type: string | nil
|
|
51
|
+
imageUrl:
|
|
52
|
+
description: Returns the image url for Navigation Menu item
|
|
53
|
+
type: string | nil
|
|
54
|
+
label:
|
|
55
|
+
description: Returns the label for Navigation Menu item
|
|
56
|
+
type: string
|
|
57
|
+
subMenu:
|
|
58
|
+
description: Returns the sub-menu for Navigation Menu Item
|
|
59
|
+
type: array
|
|
60
|
+
items:
|
|
61
|
+
type: NavigationMenuItemRepresentation
|
|
62
|
+
target:
|
|
63
|
+
description: Returns the target SameWindow/NewWindow for Navigation Menu item
|
|
64
|
+
type: string
|
|
65
|
+
enum:
|
|
66
|
+
- CurrentWindow
|
|
67
|
+
- NewWindow
|
|
68
|
+
/connect/communities/{communityId}/navigation-menu/navigation-menu-items:
|
|
69
|
+
get:
|
|
70
|
+
description: Get all the navigation menu items
|
|
71
|
+
responses:
|
|
72
|
+
'200':
|
|
73
|
+
description: Success
|
|
74
|
+
body:
|
|
75
|
+
application/json:
|
|
76
|
+
type: NavigationMenuItemCollectionRepresentation
|
|
77
|
+
queryParameters:
|
|
78
|
+
addHomeMenuItem:
|
|
79
|
+
type: boolean
|
|
80
|
+
required: false
|
|
81
|
+
effectiveAccountId:
|
|
82
|
+
type: string
|
|
83
|
+
required: false
|
|
84
|
+
includeImageUrl:
|
|
85
|
+
type: boolean
|
|
86
|
+
required: false
|
|
87
|
+
menuItemTypesToSkip:
|
|
88
|
+
type: array
|
|
89
|
+
required: false
|
|
90
|
+
items:
|
|
91
|
+
type: string
|
|
92
|
+
enum:
|
|
93
|
+
- Event
|
|
94
|
+
- ExternalLink
|
|
95
|
+
- GlobalAction
|
|
96
|
+
- InternalLink
|
|
97
|
+
- MenuLabel
|
|
98
|
+
- NavigationalTopic
|
|
99
|
+
- SalesforceObject
|
|
100
|
+
- SystemLink
|
|
101
|
+
(oas-collectionFormat): csv
|
|
102
|
+
navigationLinkSetDeveloperName:
|
|
103
|
+
type: string
|
|
104
|
+
required: false
|
|
105
|
+
navigationLinkSetId:
|
|
106
|
+
type: string
|
|
107
|
+
required: false
|
|
108
|
+
publishStatus:
|
|
109
|
+
type: string
|
|
110
|
+
required: false
|
|
111
|
+
uriParameters:
|
|
112
|
+
communityId:
|
|
113
|
+
type: string
|
|
114
|
+
required: true
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#%RAML 1.0 Overlay
|
|
2
|
+
extends: ./api.raml
|
|
3
|
+
|
|
4
|
+
uses:
|
|
5
|
+
luvio: luvio://annotations.raml
|
|
6
|
+
|
|
7
|
+
(luvio.keyPrefix): 'CommunityNavigation'
|
|
8
|
+
(luvio.ttl): 2592000000
|
|
9
|
+
|
|
10
|
+
types:
|
|
11
|
+
NavigationMenuItemCollectionRepresentation:
|
|
12
|
+
(luvio.opaque): true
|
|
13
|
+
|
|
14
|
+
/connect/communities/{communityId}/navigation-menu/navigation-menu-items:
|
|
15
|
+
get:
|
|
16
|
+
(luvio.adapter):
|
|
17
|
+
name: getCommunityNavigationMenu
|