@salesforce/lds-adapters-community-info 1.212.1 → 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, StoreKeyMap } from '@luvio/engine';
7
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, typeCheckScalars, 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 = 'CommunityInfo';
52
70
 
53
71
  const { isArray: ArrayIsArray } = Array;
@@ -905,26 +923,8 @@ const ingest = function CommunityRepresentationIngest(input, path, luvio, store,
905
923
  }
906
924
  }
907
925
  const key = keyBuilderFromType(luvio, input);
908
- const existingRecord = store.readEntry(key);
909
926
  const ttlToUse = TTL;
910
- let incomingRecord = normalize(input, store.readEntry(key), {
911
- fullPath: key,
912
- parent: path.parent,
913
- propertyName: path.propertyName,
914
- ttl: ttlToUse
915
- });
916
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
917
- luvio.storePublish(key, incomingRecord);
918
- }
919
- {
920
- const storeMetadataParams = {
921
- ttl: ttlToUse,
922
- namespace: "CommunityInfo",
923
- version: VERSION,
924
- representationName: RepresentationType,
925
- };
926
- luvio.publishStoreMetadata(key, storeMetadataParams);
927
- }
927
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "CommunityInfo", VERSION, RepresentationType, equals);
928
928
  return createLink(key);
929
929
  };
930
930
  function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
@@ -991,13 +991,11 @@ function createResourceRequest(config) {
991
991
  };
992
992
  }
993
993
 
994
- const getCommunity_ConfigPropertyNames = {
995
- displayName: 'getCommunity',
996
- parameters: {
997
- required: ['communityId'],
998
- optional: []
999
- }
1000
- };
994
+ const adapterName = 'getCommunity';
995
+ const getCommunity_ConfigPropertyMetadata = [
996
+ generateParamConfigMetadata('communityId', true),
997
+ ];
998
+ const getCommunity_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getCommunity_ConfigPropertyMetadata);
1001
999
  function createResourceParams(config) {
1002
1000
  const resourceParams = {
1003
1001
  urlParams: {
@@ -1063,21 +1061,7 @@ function buildNetworkSnapshot(luvio, config, options) {
1063
1061
  });
1064
1062
  }
1065
1063
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
1066
- const { luvio, config } = context;
1067
- const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
1068
- const dispatchOptions = {
1069
- resourceRequestContext: {
1070
- requestCorrelator,
1071
- luvioRequestMethod: undefined,
1072
- },
1073
- eventObservers
1074
- };
1075
- if (networkPriority !== 'normal') {
1076
- dispatchOptions.overrides = {
1077
- priority: networkPriority
1078
- };
1079
- }
1080
- return buildNetworkSnapshot(luvio, config, dispatchOptions);
1064
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
1081
1065
  }
1082
1066
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
1083
1067
  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 = "CommunityInfo";
@@ -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_getConnectCommunitiesByCommunityId_ResourceRequestConfig } from '../resources/getConnectCommunitiesByCommunityId';
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 { CommunityRepresentation as types_CommunityRepresentation_CommunityRepresentation } from '../types/CommunityRepresentation';
5
5
  export declare const adapterName = "getCommunity";
6
+ export declare const getCommunity_ConfigPropertyMetadata: $64$luvio_engine_AdapterConfigMetadata[];
6
7
  export declare const getCommunity_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
7
8
  export interface GetCommunityConfig {
8
9
  communityId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-community-info",
3
- "version": "1.212.1",
3
+ "version": "1.213.1",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "Gets info about the community",
6
6
  "main": "dist/es/es2018/community-info.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, StoreKeyMap } from 'force/luvioEngine';
17
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, typeCheckScalars, 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 = 'CommunityInfo';
62
80
 
63
81
  const { isArray: ArrayIsArray } = Array;
@@ -915,26 +933,8 @@ const ingest = function CommunityRepresentationIngest(input, path, luvio, store,
915
933
  }
916
934
  }
917
935
  const key = keyBuilderFromType(luvio, input);
918
- const existingRecord = store.readEntry(key);
919
936
  const ttlToUse = TTL;
920
- let incomingRecord = normalize(input, store.readEntry(key), {
921
- fullPath: key,
922
- parent: path.parent,
923
- propertyName: path.propertyName,
924
- ttl: ttlToUse
925
- });
926
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
927
- luvio.storePublish(key, incomingRecord);
928
- }
929
- {
930
- const storeMetadataParams = {
931
- ttl: ttlToUse,
932
- namespace: "CommunityInfo",
933
- version: VERSION,
934
- representationName: RepresentationType,
935
- };
936
- luvio.publishStoreMetadata(key, storeMetadataParams);
937
- }
937
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "CommunityInfo", VERSION, RepresentationType, equals);
938
938
  return createLink(key);
939
939
  };
940
940
  function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
@@ -1001,13 +1001,11 @@ function createResourceRequest(config) {
1001
1001
  };
1002
1002
  }
1003
1003
 
1004
- const getCommunity_ConfigPropertyNames = {
1005
- displayName: 'getCommunity',
1006
- parameters: {
1007
- required: ['communityId'],
1008
- optional: []
1009
- }
1010
- };
1004
+ const adapterName = 'getCommunity';
1005
+ const getCommunity_ConfigPropertyMetadata = [
1006
+ generateParamConfigMetadata('communityId', true),
1007
+ ];
1008
+ const getCommunity_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getCommunity_ConfigPropertyMetadata);
1011
1009
  function createResourceParams(config) {
1012
1010
  const resourceParams = {
1013
1011
  urlParams: {
@@ -1073,21 +1071,7 @@ function buildNetworkSnapshot(luvio, config, options) {
1073
1071
  });
1074
1072
  }
1075
1073
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
1076
- const { luvio, config } = context;
1077
- const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
1078
- const dispatchOptions = {
1079
- resourceRequestContext: {
1080
- requestCorrelator,
1081
- luvioRequestMethod: undefined,
1082
- },
1083
- eventObservers
1084
- };
1085
- if (networkPriority !== 'normal') {
1086
- dispatchOptions.overrides = {
1087
- priority: networkPriority
1088
- };
1089
- }
1090
- return buildNetworkSnapshot(luvio, config, dispatchOptions);
1074
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
1091
1075
  }
1092
1076
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
1093
1077
  const { luvio, config } = context;
@@ -1134,4 +1118,4 @@ withDefaultLuvio((luvio) => {
1134
1118
  });
1135
1119
 
1136
1120
  export { getCommunity, getCommunity_imperative };
1137
- // version: 1.212.1-49679d2a7
1121
+ // version: 1.213.1-79de10fe1