@salesforce/lds-adapters-community-navigation-menu 1.100.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +82 -0
- package/dist/es/es2018/community-navigation-menu.js +447 -0
- package/dist/types/src/generated/adapters/adapter-utils.d.ts +66 -0
- package/dist/types/src/generated/adapters/getCommunityNavigationMenu.d.ts +33 -0
- package/dist/types/src/generated/artifacts/main.d.ts +1 -0
- package/dist/types/src/generated/artifacts/sfdc.d.ts +3 -0
- package/dist/types/src/generated/resources/getConnectCommunitiesNavigationMenuNavigationMenuItemsByCommunityId.d.ts +24 -0
- package/dist/types/src/generated/types/NavigationMenuItemCollectionRepresentation.d.ts +30 -0
- package/dist/types/src/generated/types/NavigationMenuItemRepresentation.d.ts +44 -0
- package/dist/types/src/generated/types/type-utils.d.ts +39 -0
- package/dist/umd/es2018/community-navigation-menu.js +455 -0
- package/dist/umd/es5/community-navigation-menu.js +457 -0
- package/package.json +52 -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
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
(function (global, factory) {
|
|
8
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@luvio/engine')) :
|
|
9
|
+
typeof define === 'function' && define.amd ? define(['exports', '@luvio/engine'], factory) :
|
|
10
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.communityNavigationService = {}, global.engine));
|
|
11
|
+
})(this, (function (exports, engine) { 'use strict';
|
|
12
|
+
|
|
13
|
+
var ObjectPrototypeHasOwnProperty = Object.prototype.hasOwnProperty;
|
|
14
|
+
var ObjectKeys = Object.keys;
|
|
15
|
+
var ArrayIsArray$1 = Array.isArray;
|
|
16
|
+
/**
|
|
17
|
+
* Validates an adapter config is well-formed.
|
|
18
|
+
* @param config The config to validate.
|
|
19
|
+
* @param adapter The adapter validation configuration.
|
|
20
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
21
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
22
|
+
*/
|
|
23
|
+
function validateConfig(config, adapter, oneOf) {
|
|
24
|
+
var displayName = adapter.displayName;
|
|
25
|
+
var _a = adapter.parameters, required = _a.required, optional = _a.optional, unsupported = _a.unsupported;
|
|
26
|
+
if (config === undefined ||
|
|
27
|
+
required.every(function (req) { return ObjectPrototypeHasOwnProperty.call(config, req); }) === false) {
|
|
28
|
+
throw new TypeError("adapter ".concat(displayName, " configuration must specify ").concat(required.sort().join(', ')));
|
|
29
|
+
}
|
|
30
|
+
if (oneOf && oneOf.some(function (req) { return ObjectPrototypeHasOwnProperty.call(config, req); }) === false) {
|
|
31
|
+
throw new TypeError("adapter ".concat(displayName, " configuration must specify one of ").concat(oneOf.sort().join(', ')));
|
|
32
|
+
}
|
|
33
|
+
if (unsupported !== undefined &&
|
|
34
|
+
unsupported.some(function (req) { return ObjectPrototypeHasOwnProperty.call(config, req); })) {
|
|
35
|
+
throw new TypeError("adapter ".concat(displayName, " does not yet support ").concat(unsupported.sort().join(', ')));
|
|
36
|
+
}
|
|
37
|
+
var supported = required.concat(optional);
|
|
38
|
+
if (ObjectKeys(config).some(function (key) { return !supported.includes(key); })) {
|
|
39
|
+
throw new TypeError("adapter ".concat(displayName, " configuration supports only ").concat(supported.sort().join(', ')));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function untrustedIsObject(untrusted) {
|
|
43
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
44
|
+
}
|
|
45
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
46
|
+
return configPropertyNames.parameters.required.every(function (req) { return req in config; });
|
|
47
|
+
}
|
|
48
|
+
var snapshotRefreshOptions = {
|
|
49
|
+
overrides: {
|
|
50
|
+
headers: {
|
|
51
|
+
'Cache-Control': 'no-cache',
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
var keyPrefix = 'CommunityNavigation';
|
|
56
|
+
|
|
57
|
+
var ObjectFreeze = Object.freeze;
|
|
58
|
+
var ArrayIsArray = Array.isArray;
|
|
59
|
+
var JSONStringify = JSON.stringify;
|
|
60
|
+
function createLink(ref) {
|
|
61
|
+
return {
|
|
62
|
+
__ref: engine.serializeStructuredKey(ref),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function validate$1(obj, path) {
|
|
67
|
+
if (path === void 0) { path = 'NavigationMenuItemRepresentation'; }
|
|
68
|
+
var v_error = (function () {
|
|
69
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
70
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
71
|
+
}
|
|
72
|
+
var obj_actionType = obj.actionType;
|
|
73
|
+
var path_actionType = path + '.actionType';
|
|
74
|
+
if (typeof obj_actionType !== 'string') {
|
|
75
|
+
return new TypeError('Expected "string" but received "' + typeof obj_actionType + '" (at "' + path_actionType + '")');
|
|
76
|
+
}
|
|
77
|
+
var obj_actionValue = obj.actionValue;
|
|
78
|
+
var path_actionValue = path + '.actionValue';
|
|
79
|
+
var obj_actionValue_union0 = null;
|
|
80
|
+
var obj_actionValue_union0_error = (function () {
|
|
81
|
+
if (typeof obj_actionValue !== 'string') {
|
|
82
|
+
return new TypeError('Expected "string" but received "' + typeof obj_actionValue + '" (at "' + path_actionValue + '")');
|
|
83
|
+
}
|
|
84
|
+
})();
|
|
85
|
+
if (obj_actionValue_union0_error != null) {
|
|
86
|
+
obj_actionValue_union0 = obj_actionValue_union0_error.message;
|
|
87
|
+
}
|
|
88
|
+
var obj_actionValue_union1 = null;
|
|
89
|
+
var obj_actionValue_union1_error = (function () {
|
|
90
|
+
if (obj_actionValue !== null) {
|
|
91
|
+
return new TypeError('Expected "null" but received "' + typeof obj_actionValue + '" (at "' + path_actionValue + '")');
|
|
92
|
+
}
|
|
93
|
+
})();
|
|
94
|
+
if (obj_actionValue_union1_error != null) {
|
|
95
|
+
obj_actionValue_union1 = obj_actionValue_union1_error.message;
|
|
96
|
+
}
|
|
97
|
+
if (obj_actionValue_union0 && obj_actionValue_union1) {
|
|
98
|
+
var message = 'Object doesn\'t match union (at "' + path_actionValue + '")';
|
|
99
|
+
message += '\n' + obj_actionValue_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
100
|
+
message += '\n' + obj_actionValue_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
101
|
+
return new TypeError(message);
|
|
102
|
+
}
|
|
103
|
+
var obj_imageUrl = obj.imageUrl;
|
|
104
|
+
var path_imageUrl = path + '.imageUrl';
|
|
105
|
+
var obj_imageUrl_union0 = null;
|
|
106
|
+
var obj_imageUrl_union0_error = (function () {
|
|
107
|
+
if (typeof obj_imageUrl !== 'string') {
|
|
108
|
+
return new TypeError('Expected "string" but received "' + typeof obj_imageUrl + '" (at "' + path_imageUrl + '")');
|
|
109
|
+
}
|
|
110
|
+
})();
|
|
111
|
+
if (obj_imageUrl_union0_error != null) {
|
|
112
|
+
obj_imageUrl_union0 = obj_imageUrl_union0_error.message;
|
|
113
|
+
}
|
|
114
|
+
var obj_imageUrl_union1 = null;
|
|
115
|
+
var obj_imageUrl_union1_error = (function () {
|
|
116
|
+
if (obj_imageUrl !== null) {
|
|
117
|
+
return new TypeError('Expected "null" but received "' + typeof obj_imageUrl + '" (at "' + path_imageUrl + '")');
|
|
118
|
+
}
|
|
119
|
+
})();
|
|
120
|
+
if (obj_imageUrl_union1_error != null) {
|
|
121
|
+
obj_imageUrl_union1 = obj_imageUrl_union1_error.message;
|
|
122
|
+
}
|
|
123
|
+
if (obj_imageUrl_union0 && obj_imageUrl_union1) {
|
|
124
|
+
var message = 'Object doesn\'t match union (at "' + path_imageUrl + '")';
|
|
125
|
+
message += '\n' + obj_imageUrl_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
126
|
+
message += '\n' + obj_imageUrl_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
127
|
+
return new TypeError(message);
|
|
128
|
+
}
|
|
129
|
+
var obj_label = obj.label;
|
|
130
|
+
var path_label = path + '.label';
|
|
131
|
+
if (typeof obj_label !== 'string') {
|
|
132
|
+
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
133
|
+
}
|
|
134
|
+
var obj_subMenu = obj.subMenu;
|
|
135
|
+
var path_subMenu = path + '.subMenu';
|
|
136
|
+
if (!ArrayIsArray(obj_subMenu)) {
|
|
137
|
+
return new TypeError('Expected "array" but received "' + typeof obj_subMenu + '" (at "' + path_subMenu + '")');
|
|
138
|
+
}
|
|
139
|
+
for (var i = 0; i < obj_subMenu.length; i++) {
|
|
140
|
+
var obj_subMenu_item = obj_subMenu[i];
|
|
141
|
+
var path_subMenu_item = path_subMenu + '[' + i + ']';
|
|
142
|
+
var referencepath_subMenu_itemValidationError = validate$1(obj_subMenu_item, path_subMenu_item);
|
|
143
|
+
if (referencepath_subMenu_itemValidationError !== null) {
|
|
144
|
+
var message = 'Object doesn\'t match NavigationMenuItemRepresentation (at "' + path_subMenu_item + '")\n';
|
|
145
|
+
message += referencepath_subMenu_itemValidationError.message.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
146
|
+
return new TypeError(message);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
var obj_target = obj.target;
|
|
150
|
+
var path_target = path + '.target';
|
|
151
|
+
if (typeof obj_target !== 'string') {
|
|
152
|
+
return new TypeError('Expected "string" but received "' + typeof obj_target + '" (at "' + path_target + '")');
|
|
153
|
+
}
|
|
154
|
+
})();
|
|
155
|
+
return v_error === undefined ? null : v_error;
|
|
156
|
+
}
|
|
157
|
+
function deepFreeze$1(input) {
|
|
158
|
+
var input_subMenu = input.subMenu;
|
|
159
|
+
for (var i = 0; i < input_subMenu.length; i++) {
|
|
160
|
+
var input_subMenu_item = input_subMenu[i];
|
|
161
|
+
deepFreeze$1(input_subMenu_item);
|
|
162
|
+
}
|
|
163
|
+
ObjectFreeze(input_subMenu);
|
|
164
|
+
ObjectFreeze(input);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
var VERSION = "2c44fa1cf5686d4e00960baa7b9e6a1f";
|
|
168
|
+
function validate(obj, path) {
|
|
169
|
+
if (path === void 0) { path = 'NavigationMenuItemCollectionRepresentation'; }
|
|
170
|
+
var v_error = (function () {
|
|
171
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
172
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
173
|
+
}
|
|
174
|
+
var obj_menuItems = obj.menuItems;
|
|
175
|
+
var path_menuItems = path + '.menuItems';
|
|
176
|
+
if (!ArrayIsArray(obj_menuItems)) {
|
|
177
|
+
return new TypeError('Expected "array" but received "' + typeof obj_menuItems + '" (at "' + path_menuItems + '")');
|
|
178
|
+
}
|
|
179
|
+
for (var i = 0; i < obj_menuItems.length; i++) {
|
|
180
|
+
var obj_menuItems_item = obj_menuItems[i];
|
|
181
|
+
var path_menuItems_item = path_menuItems + '[' + i + ']';
|
|
182
|
+
var referencepath_menuItems_itemValidationError = validate$1(obj_menuItems_item, path_menuItems_item);
|
|
183
|
+
if (referencepath_menuItems_itemValidationError !== null) {
|
|
184
|
+
var message = 'Object doesn\'t match NavigationMenuItemRepresentation (at "' + path_menuItems_item + '")\n';
|
|
185
|
+
message += referencepath_menuItems_itemValidationError.message.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
186
|
+
return new TypeError(message);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
})();
|
|
190
|
+
return v_error === undefined ? null : v_error;
|
|
191
|
+
}
|
|
192
|
+
var RepresentationType = 'NavigationMenuItemCollectionRepresentation';
|
|
193
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
194
|
+
return input;
|
|
195
|
+
}
|
|
196
|
+
var select$1 = function NavigationMenuItemCollectionRepresentationSelect() {
|
|
197
|
+
return {
|
|
198
|
+
kind: 'Fragment',
|
|
199
|
+
version: VERSION,
|
|
200
|
+
private: [],
|
|
201
|
+
opaque: true
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
function equals(existing, incoming) {
|
|
205
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
210
|
+
function deepFreeze(input) {
|
|
211
|
+
var input_menuItems = input.menuItems;
|
|
212
|
+
for (var i = 0; i < input_menuItems.length; i++) {
|
|
213
|
+
var input_menuItems_item = input_menuItems[i];
|
|
214
|
+
deepFreeze$1(input_menuItems_item);
|
|
215
|
+
}
|
|
216
|
+
ObjectFreeze(input_menuItems);
|
|
217
|
+
ObjectFreeze(input);
|
|
218
|
+
}
|
|
219
|
+
var ingest = function NavigationMenuItemCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
220
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
221
|
+
var validateError = validate(input);
|
|
222
|
+
if (validateError !== null) {
|
|
223
|
+
throw validateError;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
var key = path.fullPath;
|
|
227
|
+
var existingRecord = store.readEntry(key);
|
|
228
|
+
var ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
|
|
229
|
+
var incomingRecord = normalize(input, store.readEntry(key), {
|
|
230
|
+
fullPath: key,
|
|
231
|
+
parent: path.parent,
|
|
232
|
+
propertyName: path.propertyName,
|
|
233
|
+
ttl: ttlToUse
|
|
234
|
+
});
|
|
235
|
+
deepFreeze(input);
|
|
236
|
+
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
237
|
+
luvio.storePublish(key, incomingRecord);
|
|
238
|
+
}
|
|
239
|
+
if (ttlToUse !== undefined) {
|
|
240
|
+
var storeMetadataParams = {
|
|
241
|
+
ttl: ttlToUse,
|
|
242
|
+
namespace: "CommunityNavigation",
|
|
243
|
+
version: VERSION,
|
|
244
|
+
representationName: RepresentationType,
|
|
245
|
+
};
|
|
246
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
247
|
+
}
|
|
248
|
+
return createLink(key);
|
|
249
|
+
};
|
|
250
|
+
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
251
|
+
var rootKeySet = new engine.StoreKeyMap();
|
|
252
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
253
|
+
var rootKey = fullPathFactory();
|
|
254
|
+
rootKeySet.set(rootKey, {
|
|
255
|
+
namespace: keyPrefix,
|
|
256
|
+
representationName: RepresentationType,
|
|
257
|
+
mergeable: false
|
|
258
|
+
});
|
|
259
|
+
return rootKeySet;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function select(luvio, params) {
|
|
263
|
+
return select$1();
|
|
264
|
+
}
|
|
265
|
+
function keyBuilder$1(luvio, params) {
|
|
266
|
+
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 + ')';
|
|
267
|
+
}
|
|
268
|
+
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
269
|
+
return getTypeCacheKeys(luvio, response, function () { return keyBuilder$1(luvio, resourceParams); });
|
|
270
|
+
}
|
|
271
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
272
|
+
var body = response.body;
|
|
273
|
+
var key = keyBuilder$1(luvio, resourceParams);
|
|
274
|
+
luvio.storeIngest(key, ingest, body);
|
|
275
|
+
var snapshot = luvio.storeLookup({
|
|
276
|
+
recordId: key,
|
|
277
|
+
node: select(),
|
|
278
|
+
variables: {},
|
|
279
|
+
}, snapshotRefresh);
|
|
280
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
281
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
282
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
return snapshot;
|
|
286
|
+
}
|
|
287
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
288
|
+
var key = keyBuilder$1(luvio, params);
|
|
289
|
+
var errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
290
|
+
luvio.storeIngestError(key, errorSnapshot);
|
|
291
|
+
return errorSnapshot;
|
|
292
|
+
}
|
|
293
|
+
function createResourceRequest(config) {
|
|
294
|
+
var headers = {};
|
|
295
|
+
return {
|
|
296
|
+
baseUri: '/services/data/v58.0',
|
|
297
|
+
basePath: '/connect/communities/' + config.urlParams.communityId + '/navigation-menu/navigation-menu-items',
|
|
298
|
+
method: 'get',
|
|
299
|
+
body: null,
|
|
300
|
+
urlParams: config.urlParams,
|
|
301
|
+
queryParams: config.queryParams,
|
|
302
|
+
headers: headers,
|
|
303
|
+
priority: 'normal',
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
var getCommunityNavigationMenu_ConfigPropertyNames = {
|
|
308
|
+
displayName: 'getCommunityNavigationMenu',
|
|
309
|
+
parameters: {
|
|
310
|
+
required: ['communityId'],
|
|
311
|
+
optional: ['addHomeMenuItem', 'effectiveAccountId', 'includeImageUrl', 'menuItemTypesToSkip', 'navigationLinkSetDeveloperName', 'navigationLinkSetId', 'publishStatus']
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
function createResourceParams(config) {
|
|
315
|
+
var resourceParams = {
|
|
316
|
+
urlParams: {
|
|
317
|
+
communityId: config.communityId
|
|
318
|
+
},
|
|
319
|
+
queryParams: {
|
|
320
|
+
addHomeMenuItem: config.addHomeMenuItem, effectiveAccountId: config.effectiveAccountId, includeImageUrl: config.includeImageUrl, menuItemTypesToSkip: config.menuItemTypesToSkip, navigationLinkSetDeveloperName: config.navigationLinkSetDeveloperName, navigationLinkSetId: config.navigationLinkSetId, publishStatus: config.publishStatus
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
return resourceParams;
|
|
324
|
+
}
|
|
325
|
+
function keyBuilder(luvio, config) {
|
|
326
|
+
var resourceParams = createResourceParams(config);
|
|
327
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
328
|
+
}
|
|
329
|
+
function typeCheckConfig(untrustedConfig) {
|
|
330
|
+
var config = {};
|
|
331
|
+
var untrustedConfig_communityId = untrustedConfig.communityId;
|
|
332
|
+
if (typeof untrustedConfig_communityId === 'string') {
|
|
333
|
+
config.communityId = untrustedConfig_communityId;
|
|
334
|
+
}
|
|
335
|
+
var untrustedConfig_addHomeMenuItem = untrustedConfig.addHomeMenuItem;
|
|
336
|
+
if (typeof untrustedConfig_addHomeMenuItem === 'boolean') {
|
|
337
|
+
config.addHomeMenuItem = untrustedConfig_addHomeMenuItem;
|
|
338
|
+
}
|
|
339
|
+
var untrustedConfig_effectiveAccountId = untrustedConfig.effectiveAccountId;
|
|
340
|
+
if (typeof untrustedConfig_effectiveAccountId === 'string') {
|
|
341
|
+
config.effectiveAccountId = untrustedConfig_effectiveAccountId;
|
|
342
|
+
}
|
|
343
|
+
var untrustedConfig_includeImageUrl = untrustedConfig.includeImageUrl;
|
|
344
|
+
if (typeof untrustedConfig_includeImageUrl === 'boolean') {
|
|
345
|
+
config.includeImageUrl = untrustedConfig_includeImageUrl;
|
|
346
|
+
}
|
|
347
|
+
var untrustedConfig_menuItemTypesToSkip = untrustedConfig.menuItemTypesToSkip;
|
|
348
|
+
if (ArrayIsArray$1(untrustedConfig_menuItemTypesToSkip)) {
|
|
349
|
+
var untrustedConfig_menuItemTypesToSkip_array = [];
|
|
350
|
+
for (var i = 0, arrayLength = untrustedConfig_menuItemTypesToSkip.length; i < arrayLength; i++) {
|
|
351
|
+
var untrustedConfig_menuItemTypesToSkip_item = untrustedConfig_menuItemTypesToSkip[i];
|
|
352
|
+
if (typeof untrustedConfig_menuItemTypesToSkip_item === 'string') {
|
|
353
|
+
untrustedConfig_menuItemTypesToSkip_array.push(untrustedConfig_menuItemTypesToSkip_item);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
config.menuItemTypesToSkip = untrustedConfig_menuItemTypesToSkip_array;
|
|
357
|
+
}
|
|
358
|
+
var untrustedConfig_navigationLinkSetDeveloperName = untrustedConfig.navigationLinkSetDeveloperName;
|
|
359
|
+
if (typeof untrustedConfig_navigationLinkSetDeveloperName === 'string') {
|
|
360
|
+
config.navigationLinkSetDeveloperName = untrustedConfig_navigationLinkSetDeveloperName;
|
|
361
|
+
}
|
|
362
|
+
var untrustedConfig_navigationLinkSetId = untrustedConfig.navigationLinkSetId;
|
|
363
|
+
if (typeof untrustedConfig_navigationLinkSetId === 'string') {
|
|
364
|
+
config.navigationLinkSetId = untrustedConfig_navigationLinkSetId;
|
|
365
|
+
}
|
|
366
|
+
var untrustedConfig_publishStatus = untrustedConfig.publishStatus;
|
|
367
|
+
if (typeof untrustedConfig_publishStatus === 'string') {
|
|
368
|
+
config.publishStatus = untrustedConfig_publishStatus;
|
|
369
|
+
}
|
|
370
|
+
return config;
|
|
371
|
+
}
|
|
372
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
373
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
374
|
+
return null;
|
|
375
|
+
}
|
|
376
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
377
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
378
|
+
}
|
|
379
|
+
var config = typeCheckConfig(untrustedConfig);
|
|
380
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
381
|
+
return null;
|
|
382
|
+
}
|
|
383
|
+
return config;
|
|
384
|
+
}
|
|
385
|
+
function adapterFragment(luvio, config) {
|
|
386
|
+
createResourceParams(config);
|
|
387
|
+
return select();
|
|
388
|
+
}
|
|
389
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
390
|
+
var snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
391
|
+
config: config,
|
|
392
|
+
resolve: function () { return buildNetworkSnapshot(luvio, config, snapshotRefreshOptions); }
|
|
393
|
+
});
|
|
394
|
+
return luvio.storeBroadcast().then(function () { return snapshot; });
|
|
395
|
+
}
|
|
396
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
397
|
+
var snapshot = ingestError(luvio, resourceParams, response, {
|
|
398
|
+
config: config,
|
|
399
|
+
resolve: function () { return buildNetworkSnapshot(luvio, config, snapshotRefreshOptions); }
|
|
400
|
+
});
|
|
401
|
+
return luvio.storeBroadcast().then(function () { return snapshot; });
|
|
402
|
+
}
|
|
403
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
404
|
+
var resourceParams = createResourceParams(config);
|
|
405
|
+
var request = createResourceRequest(resourceParams);
|
|
406
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
407
|
+
.then(function (response) {
|
|
408
|
+
return luvio.handleSuccessResponse(function () { return onFetchResponseSuccess(luvio, config, resourceParams, response); }, function () { return getResponseCacheKeys(luvio, resourceParams, response.body); });
|
|
409
|
+
}, function (response) {
|
|
410
|
+
return luvio.handleErrorResponse(function () { return onFetchResponseError(luvio, config, resourceParams, response); });
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
414
|
+
var luvio = context.luvio, config = context.config;
|
|
415
|
+
var networkPriority = coercedAdapterRequestContext.networkPriority, requestCorrelator = coercedAdapterRequestContext.requestCorrelator, eventObservers = coercedAdapterRequestContext.eventObservers;
|
|
416
|
+
var dispatchOptions = {
|
|
417
|
+
resourceRequestContext: {
|
|
418
|
+
requestCorrelator: requestCorrelator,
|
|
419
|
+
luvioRequestMethod: undefined,
|
|
420
|
+
},
|
|
421
|
+
eventObservers: eventObservers
|
|
422
|
+
};
|
|
423
|
+
if (networkPriority !== 'normal') {
|
|
424
|
+
dispatchOptions.overrides = {
|
|
425
|
+
priority: networkPriority
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
return buildNetworkSnapshot(luvio, config, dispatchOptions);
|
|
429
|
+
}
|
|
430
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
431
|
+
var luvio = context.luvio, config = context.config;
|
|
432
|
+
var selector = {
|
|
433
|
+
recordId: keyBuilder(luvio, config),
|
|
434
|
+
node: adapterFragment(luvio, config),
|
|
435
|
+
variables: {},
|
|
436
|
+
};
|
|
437
|
+
var cacheSnapshot = storeLookup(selector, {
|
|
438
|
+
config: config,
|
|
439
|
+
resolve: function () { return buildNetworkSnapshot(luvio, config, snapshotRefreshOptions); }
|
|
440
|
+
});
|
|
441
|
+
return cacheSnapshot;
|
|
442
|
+
}
|
|
443
|
+
var getCommunityNavigationMenuAdapterFactory = function (luvio) { return function CommunityNavigation__getCommunityNavigationMenu(untrustedConfig, requestContext) {
|
|
444
|
+
var config = validateAdapterConfig(untrustedConfig, getCommunityNavigationMenu_ConfigPropertyNames);
|
|
445
|
+
// Invalid or incomplete config
|
|
446
|
+
if (config === null) {
|
|
447
|
+
return null;
|
|
448
|
+
}
|
|
449
|
+
return luvio.applyCachePolicy((requestContext || {}), { config: config, luvio: luvio }, // BuildSnapshotContext
|
|
450
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
451
|
+
}; };
|
|
452
|
+
|
|
453
|
+
exports.getCommunityNavigationMenuAdapterFactory = getCommunityNavigationMenuAdapterFactory;
|
|
454
|
+
|
|
455
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
456
|
+
|
|
457
|
+
}));
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@salesforce/lds-adapters-community-navigation-menu",
|
|
3
|
+
"version": "1.100.2",
|
|
4
|
+
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
|
+
"description": "Wire adapters Community Navigation Menu",
|
|
6
|
+
"main": "dist/umd/es2018/community-navigation-menu.js",
|
|
7
|
+
"module": "dist/es/es2018/community-navigation-menu.js",
|
|
8
|
+
"types": "dist/types/src/generated/artifacts/main.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"sfdc",
|
|
12
|
+
"src/raml/*"
|
|
13
|
+
],
|
|
14
|
+
"sfdc": {
|
|
15
|
+
"path": "forcelds/ldsAdaptersCommunityNavigationMenu/",
|
|
16
|
+
"namespace": "lightning",
|
|
17
|
+
"module": "communityNavigationMenuApi"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"clean": "rm -rf dist sfdc src/generated karma/dist",
|
|
21
|
+
"build": "yarn build:raml && yarn build:services && yarn build:karma",
|
|
22
|
+
"build:karma": "rollup --config rollup.config.karma.js",
|
|
23
|
+
"build:raml": "luvio generate src/raml/luvio.raml src/generated -p '../lds-compiler-plugins'",
|
|
24
|
+
"build:services": "rollup --config rollup.config.js",
|
|
25
|
+
"start": "karma start",
|
|
26
|
+
"test": "karma start --single-run",
|
|
27
|
+
"test:compat": "karma start --single-run --compat",
|
|
28
|
+
"release:corejar": "yarn build && ../core-build/scripts/core.js --adapter=lds-adapters-community-navigation-menu",
|
|
29
|
+
"release:core": "../../scripts/release/core.js --adapter=lds-adapters-community-navigation-menu"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@salesforce/lds-bindings": "^1.100.2"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@salesforce/lds-karma": "^1.100.2"
|
|
36
|
+
},
|
|
37
|
+
"nx": {
|
|
38
|
+
"targets": {
|
|
39
|
+
"build": {
|
|
40
|
+
"outputs": [
|
|
41
|
+
"packages/lds-adapters-community-navigation-menu/dist",
|
|
42
|
+
"packages/lds-adapters-community-navigation-menu/karma/dist",
|
|
43
|
+
"packages/lds-adapters-community-navigation-menu/sfdc",
|
|
44
|
+
"packages/lds-adapters-community-navigation-menu/src/generated"
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"volta": {
|
|
50
|
+
"extends": "../../package.json"
|
|
51
|
+
}
|
|
52
|
+
}
|
package/sfdc/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/types/src/generated/artifacts/sfdc';
|