@salesforce/lds-adapters-community-navigation-menu 1.213.0 → 1.213.1

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.
@@ -4,7 +4,7 @@
4
4
  * For full license text, see the LICENSE.txt file
5
5
  */
6
6
 
7
- import { serializeStructuredKey, deepFreeze, typeCheckScalars, typeCheckArrayOfScalars, StoreKeyMap } from '@luvio/engine';
7
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, typeCheckScalars, typeCheckArrayOfScalars, StoreKeyMap } from '@luvio/engine';
8
8
 
9
9
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
10
  const { keys: ObjectKeys, create: ObjectCreate } = Object;
@@ -48,6 +48,24 @@ const snapshotRefreshOptions = {
48
48
  },
49
49
  }
50
50
  };
51
+ function generateParamConfigMetadata(name, required, coerceFn) {
52
+ return {
53
+ name,
54
+ required,
55
+ coerceFn,
56
+ };
57
+ }
58
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
59
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
60
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
61
+ return {
62
+ displayName,
63
+ parameters: {
64
+ required,
65
+ optional,
66
+ }
67
+ };
68
+ }
51
69
  const keyPrefix = 'CommunityNavigation';
52
70
 
53
71
  const { isArray: ArrayIsArray } = Array;
@@ -199,26 +217,8 @@ const ingest = function NavigationMenuItemCollectionRepresentationIngest(input,
199
217
  }
200
218
  }
201
219
  const key = path.fullPath;
202
- const existingRecord = store.readEntry(key);
203
220
  const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
204
- let incomingRecord = normalize(input, store.readEntry(key), {
205
- fullPath: key,
206
- parent: path.parent,
207
- propertyName: path.propertyName,
208
- ttl: ttlToUse
209
- });
210
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
211
- luvio.storePublish(key, incomingRecord);
212
- }
213
- if (ttlToUse !== undefined) {
214
- const storeMetadataParams = {
215
- ttl: ttlToUse,
216
- namespace: "CommunityNavigation",
217
- version: VERSION,
218
- representationName: RepresentationType,
219
- };
220
- luvio.publishStoreMetadata(key, storeMetadataParams);
221
- }
221
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "CommunityNavigation", VERSION, RepresentationType, equals);
222
222
  return createLink(key);
223
223
  };
224
224
  function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
@@ -277,13 +277,18 @@ function createResourceRequest(config) {
277
277
  };
278
278
  }
279
279
 
280
- const getCommunityNavigationMenu_ConfigPropertyNames = {
281
- displayName: 'getCommunityNavigationMenu',
282
- parameters: {
283
- required: ['communityId'],
284
- optional: ['addHomeMenuItem', 'effectiveAccountId', 'includeImageUrl', 'menuItemTypesToSkip', 'navigationLinkSetDeveloperName', 'navigationLinkSetId', 'publishStatus']
285
- }
286
- };
280
+ const adapterName = 'getCommunityNavigationMenu';
281
+ const getCommunityNavigationMenu_ConfigPropertyMetadata = [
282
+ generateParamConfigMetadata('communityId', true),
283
+ generateParamConfigMetadata('addHomeMenuItem', false),
284
+ generateParamConfigMetadata('effectiveAccountId', false),
285
+ generateParamConfigMetadata('includeImageUrl', false),
286
+ generateParamConfigMetadata('menuItemTypesToSkip', false),
287
+ generateParamConfigMetadata('navigationLinkSetDeveloperName', false),
288
+ generateParamConfigMetadata('navigationLinkSetId', false),
289
+ generateParamConfigMetadata('publishStatus', false),
290
+ ];
291
+ const getCommunityNavigationMenu_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getCommunityNavigationMenu_ConfigPropertyMetadata);
287
292
  function createResourceParams(config) {
288
293
  const resourceParams = {
289
294
  urlParams: {
@@ -361,21 +366,7 @@ function buildNetworkSnapshot(luvio, config, options) {
361
366
  });
362
367
  }
363
368
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
364
- const { luvio, config } = context;
365
- const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
366
- const dispatchOptions = {
367
- resourceRequestContext: {
368
- requestCorrelator,
369
- luvioRequestMethod: undefined,
370
- },
371
- eventObservers
372
- };
373
- if (networkPriority !== 'normal') {
374
- dispatchOptions.overrides = {
375
- priority: networkPriority
376
- };
377
- }
378
- return buildNetworkSnapshot(luvio, config, dispatchOptions);
369
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
379
370
  }
380
371
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
381
372
  const { luvio, config } = context;
@@ -1,4 +1,4 @@
1
- import { Adapter as $64$luvio_engine_Adapter, Snapshot as $64$luvio_engine_Snapshot, UnfulfilledSnapshot as $64$luvio_engine_UnfulfilledSnapshot } from '@luvio/engine';
1
+ import { Adapter as $64$luvio_engine_Adapter, Snapshot as $64$luvio_engine_Snapshot, UnfulfilledSnapshot as $64$luvio_engine_UnfulfilledSnapshot, AdapterConfigMetadata as $64$luvio_engine_AdapterConfigMetadata } from '@luvio/engine';
2
2
  export declare const ObjectPrototypeHasOwnProperty: (v: PropertyKey) => boolean;
3
3
  declare const ObjectKeys: {
4
4
  (o: object): string[];
@@ -57,4 +57,6 @@ export declare const snapshotRefreshOptions: {
57
57
  export declare function stableJSONStringify(node: any): string | undefined;
58
58
  export declare function getFetchResponseStatusText(status: number): string;
59
59
  export declare function isUnfulfilledSnapshot<T, U>(snapshot: $64$luvio_engine_Snapshot<T, U>): snapshot is $64$luvio_engine_UnfulfilledSnapshot<T, U>;
60
+ export declare function generateParamConfigMetadata(name: string, required: boolean, coerceFn?: (v: unknown) => unknown): $64$luvio_engine_AdapterConfigMetadata;
61
+ export declare function buildAdapterValidationConfig(displayName: string, paramsMeta: $64$luvio_engine_AdapterConfigMetadata[]): AdapterValidationConfig;
60
62
  export declare const keyPrefix = "CommunityNavigation";
@@ -1,8 +1,9 @@
1
- import { AdapterValidationConfig as adapter$45$utils_AdapterValidationConfig, Untrusted as adapter$45$utils_Untrusted } from './adapter-utils';
1
+ import { AdapterConfigMetadata as $64$luvio_engine_AdapterConfigMetadata, Luvio as $64$luvio_engine_Luvio, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata, Fragment as $64$luvio_engine_Fragment, Snapshot as $64$luvio_engine_Snapshot, FetchResponse as $64$luvio_engine_FetchResponse, ErrorResponse as $64$luvio_engine_ErrorResponse, DispatchResourceRequestContext as $64$luvio_engine_DispatchResourceRequestContext, CoercedAdapterRequestContext as $64$luvio_engine_CoercedAdapterRequestContext, StoreLookup as $64$luvio_engine_StoreLookup, AdapterFactory as $64$luvio_engine_AdapterFactory } from '@luvio/engine';
2
+ import { Untrusted as adapter$45$utils_Untrusted, AdapterValidationConfig as adapter$45$utils_AdapterValidationConfig } from './adapter-utils';
2
3
  import { ResourceRequestConfig as resources_getConnectCommunitiesNavigationMenuNavigationMenuItemsByCommunityId_ResourceRequestConfig } from '../resources/getConnectCommunitiesNavigationMenuNavigationMenuItemsByCommunityId';
3
- import { Luvio as $64$luvio_engine_Luvio, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata, Fragment as $64$luvio_engine_Fragment, Snapshot as $64$luvio_engine_Snapshot, FetchResponse as $64$luvio_engine_FetchResponse, ErrorResponse as $64$luvio_engine_ErrorResponse, DispatchResourceRequestContext as $64$luvio_engine_DispatchResourceRequestContext, CoercedAdapterRequestContext as $64$luvio_engine_CoercedAdapterRequestContext, StoreLookup as $64$luvio_engine_StoreLookup, AdapterFactory as $64$luvio_engine_AdapterFactory } from '@luvio/engine';
4
4
  import { NavigationMenuItemCollectionRepresentation as types_NavigationMenuItemCollectionRepresentation_NavigationMenuItemCollectionRepresentation } from '../types/NavigationMenuItemCollectionRepresentation';
5
5
  export declare const adapterName = "getCommunityNavigationMenu";
6
+ export declare const getCommunityNavigationMenu_ConfigPropertyMetadata: $64$luvio_engine_AdapterConfigMetadata[];
6
7
  export declare const getCommunityNavigationMenu_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
7
8
  export interface GetCommunityNavigationMenuConfig {
8
9
  communityId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-community-navigation-menu",
3
- "version": "1.213.0",
3
+ "version": "1.213.1",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "Wire adapters Community Navigation Menu",
6
6
  "main": "dist/es/es2018/community-navigation-menu.js",
package/sfdc/index.js CHANGED
@@ -14,7 +14,7 @@
14
14
  /* proxy-compat-disable */
15
15
  import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
16
16
  import { withDefaultLuvio } from 'force/ldsEngine';
17
- import { serializeStructuredKey, deepFreeze, typeCheckScalars, typeCheckArrayOfScalars, StoreKeyMap } from 'force/luvioEngine';
17
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, typeCheckScalars, typeCheckArrayOfScalars, StoreKeyMap } from 'force/luvioEngine';
18
18
 
19
19
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
20
20
  const { keys: ObjectKeys, create: ObjectCreate } = Object;
@@ -58,6 +58,24 @@ const snapshotRefreshOptions = {
58
58
  },
59
59
  }
60
60
  };
61
+ function generateParamConfigMetadata(name, required, coerceFn) {
62
+ return {
63
+ name,
64
+ required,
65
+ coerceFn,
66
+ };
67
+ }
68
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
69
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
70
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
71
+ return {
72
+ displayName,
73
+ parameters: {
74
+ required,
75
+ optional,
76
+ }
77
+ };
78
+ }
61
79
  const keyPrefix = 'CommunityNavigation';
62
80
 
63
81
  const { isArray: ArrayIsArray } = Array;
@@ -209,26 +227,8 @@ const ingest = function NavigationMenuItemCollectionRepresentationIngest(input,
209
227
  }
210
228
  }
211
229
  const key = path.fullPath;
212
- const existingRecord = store.readEntry(key);
213
230
  const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
214
- let incomingRecord = normalize(input, store.readEntry(key), {
215
- fullPath: key,
216
- parent: path.parent,
217
- propertyName: path.propertyName,
218
- ttl: ttlToUse
219
- });
220
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
221
- luvio.storePublish(key, incomingRecord);
222
- }
223
- if (ttlToUse !== undefined) {
224
- const storeMetadataParams = {
225
- ttl: ttlToUse,
226
- namespace: "CommunityNavigation",
227
- version: VERSION,
228
- representationName: RepresentationType,
229
- };
230
- luvio.publishStoreMetadata(key, storeMetadataParams);
231
- }
231
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "CommunityNavigation", VERSION, RepresentationType, equals);
232
232
  return createLink(key);
233
233
  };
234
234
  function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
@@ -287,13 +287,18 @@ function createResourceRequest(config) {
287
287
  };
288
288
  }
289
289
 
290
- const getCommunityNavigationMenu_ConfigPropertyNames = {
291
- displayName: 'getCommunityNavigationMenu',
292
- parameters: {
293
- required: ['communityId'],
294
- optional: ['addHomeMenuItem', 'effectiveAccountId', 'includeImageUrl', 'menuItemTypesToSkip', 'navigationLinkSetDeveloperName', 'navigationLinkSetId', 'publishStatus']
295
- }
296
- };
290
+ const adapterName = 'getCommunityNavigationMenu';
291
+ const getCommunityNavigationMenu_ConfigPropertyMetadata = [
292
+ generateParamConfigMetadata('communityId', true),
293
+ generateParamConfigMetadata('addHomeMenuItem', false),
294
+ generateParamConfigMetadata('effectiveAccountId', false),
295
+ generateParamConfigMetadata('includeImageUrl', false),
296
+ generateParamConfigMetadata('menuItemTypesToSkip', false),
297
+ generateParamConfigMetadata('navigationLinkSetDeveloperName', false),
298
+ generateParamConfigMetadata('navigationLinkSetId', false),
299
+ generateParamConfigMetadata('publishStatus', false),
300
+ ];
301
+ const getCommunityNavigationMenu_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getCommunityNavigationMenu_ConfigPropertyMetadata);
297
302
  function createResourceParams(config) {
298
303
  const resourceParams = {
299
304
  urlParams: {
@@ -371,21 +376,7 @@ function buildNetworkSnapshot(luvio, config, options) {
371
376
  });
372
377
  }
373
378
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
374
- const { luvio, config } = context;
375
- const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
376
- const dispatchOptions = {
377
- resourceRequestContext: {
378
- requestCorrelator,
379
- luvioRequestMethod: undefined,
380
- },
381
- eventObservers
382
- };
383
- if (networkPriority !== 'normal') {
384
- dispatchOptions.overrides = {
385
- priority: networkPriority
386
- };
387
- }
388
- return buildNetworkSnapshot(luvio, config, dispatchOptions);
379
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
389
380
  }
390
381
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
391
382
  const { luvio, config } = context;
@@ -432,4 +423,4 @@ withDefaultLuvio((luvio) => {
432
423
  });
433
424
 
434
425
  export { getCommunityNavigationMenu, getCommunityNavigationMenu_imperative };
435
- // version: 1.213.0-951602080
426
+ // version: 1.213.1-79de10fe1