@salesforce/lds-adapters-community-info 1.286.0 → 1.287.0-dev10

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.
@@ -7,7 +7,7 @@
7
7
  import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, typeCheckConfig as typeCheckConfig$1, StoreKeyMap, createResourceParams as createResourceParams$1 } from '@luvio/engine';
8
8
 
9
9
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
- const { keys: ObjectKeys, create: ObjectCreate } = Object;
10
+ const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
11
11
  const { isArray: ArrayIsArray$1 } = Array;
12
12
  /**
13
13
  * Validates an adapter config is well-formed.
@@ -31,7 +31,7 @@ function validateConfig(config, adapter, oneOf) {
31
31
  throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
32
32
  }
33
33
  const supported = required.concat(optional);
34
- if (ObjectKeys(config).some(key => !supported.includes(key))) {
34
+ if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
35
35
  throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
36
36
  }
37
37
  }
@@ -71,7 +71,9 @@ function buildAdapterValidationConfig(displayName, paramsMeta) {
71
71
  }
72
72
  const keyPrefix = 'CommunityInfo';
73
73
 
74
+ const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
74
75
  const { isArray: ArrayIsArray } = Array;
76
+ const { stringify: JSONStringify } = JSON;
75
77
  function createLink(ref) {
76
78
  return {
77
79
  __ref: serializeStructuredKey(ref),
@@ -939,6 +941,20 @@ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
939
941
  mergeable: false
940
942
  });
941
943
  }
944
+ const notifyUpdateAvailableFactory = (luvio) => {
945
+ return function notifyCommunityUpdateAvailable(configs) {
946
+ if (process.env.NODE_ENV !== 'production') {
947
+ const requiredKeyParams = ['id'];
948
+ configs.forEach(config => {
949
+ if (false === requiredKeyParams.every(req => req in config)) {
950
+ throw new Error(`one of the configs did not contain all required parameters: ${JSONStringify(ObjectKeys(config))}`);
951
+ }
952
+ });
953
+ }
954
+ const keys = configs.map(c => keyBuilder$2(luvio, c));
955
+ return luvio.notifyStoreUpdateAvailable(keys);
956
+ };
957
+ };
942
958
 
943
959
  function select(luvio, params) {
944
960
  return select$1();
@@ -1080,4 +1096,4 @@ const getCommunityAdapterFactory = (luvio) => function CommunityInfo__getCommuni
1080
1096
  buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
1081
1097
  };
1082
1098
 
1083
- export { getCommunityAdapterFactory };
1099
+ export { getCommunityAdapterFactory, notifyUpdateAvailableFactory as notifyCommunityUpdateAvailableFactory };
@@ -1 +1,2 @@
1
1
  export { getCommunityAdapterFactory } from '../adapters/getCommunity';
2
+ export { notifyUpdateAvailableFactory as notifyCommunityUpdateAvailableFactory } from '../types/CommunityRepresentation';
@@ -1,3 +1,5 @@
1
1
  declare let getCommunity: any;
2
2
  declare let getCommunity_imperative: any;
3
+ declare let notifyCommunityUpdateAvailable: any;
3
4
  export { getCommunity, getCommunity_imperative };
5
+ export { notifyCommunityUpdateAvailable };
@@ -102,3 +102,4 @@ export interface CommunityRepresentation {
102
102
  url: string | null;
103
103
  urlPathPrefix: string | null;
104
104
  }
105
+ export declare const notifyUpdateAvailableFactory: (luvio: $64$luvio_engine_Luvio) => (configs: Partial<KeyParams>[]) => Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-community-info",
3
- "version": "1.286.0",
3
+ "version": "1.287.0-dev10",
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",
@@ -44,11 +44,11 @@
44
44
  "test:unit": "jest"
45
45
  },
46
46
  "dependencies": {
47
- "@salesforce/lds-bindings": "^1.286.0"
47
+ "@salesforce/lds-bindings": "^1.287.0-dev10"
48
48
  },
49
49
  "devDependencies": {
50
- "@salesforce/lds-compiler-plugins": "^1.286.0",
51
- "@salesforce/lds-karma": "^1.286.0"
50
+ "@salesforce/lds-compiler-plugins": "^1.287.0-dev10",
51
+ "@salesforce/lds-karma": "^1.287.0-dev10"
52
52
  },
53
53
  "nx": {
54
54
  "targets": {
package/sfdc/index.js CHANGED
@@ -17,7 +17,7 @@ import { withDefaultLuvio } from 'force/ldsEngine';
17
17
  import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, typeCheckConfig as typeCheckConfig$1, StoreKeyMap, createResourceParams as createResourceParams$1 } from 'force/luvioEngine';
18
18
 
19
19
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
20
- const { keys: ObjectKeys, create: ObjectCreate } = Object;
20
+ const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
21
21
  const { isArray: ArrayIsArray$1 } = Array;
22
22
  /**
23
23
  * Validates an adapter config is well-formed.
@@ -41,7 +41,7 @@ function validateConfig(config, adapter, oneOf) {
41
41
  throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
42
42
  }
43
43
  const supported = required.concat(optional);
44
- if (ObjectKeys(config).some(key => !supported.includes(key))) {
44
+ if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
45
45
  throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
46
46
  }
47
47
  }
@@ -81,7 +81,9 @@ function buildAdapterValidationConfig(displayName, paramsMeta) {
81
81
  }
82
82
  const keyPrefix = 'CommunityInfo';
83
83
 
84
+ const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
84
85
  const { isArray: ArrayIsArray } = Array;
86
+ const { stringify: JSONStringify } = JSON;
85
87
  function createLink(ref) {
86
88
  return {
87
89
  __ref: serializeStructuredKey(ref),
@@ -949,6 +951,20 @@ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
949
951
  mergeable: false
950
952
  });
951
953
  }
954
+ const notifyUpdateAvailableFactory = (luvio) => {
955
+ return function notifyCommunityUpdateAvailable(configs) {
956
+ if (process.env.NODE_ENV !== 'production') {
957
+ const requiredKeyParams = ['id'];
958
+ configs.forEach(config => {
959
+ if (false === requiredKeyParams.every(req => req in config)) {
960
+ throw new Error(`one of the configs did not contain all required parameters: ${JSONStringify(ObjectKeys(config))}`);
961
+ }
962
+ });
963
+ }
964
+ const keys = configs.map(c => keyBuilder$2(luvio, c));
965
+ return luvio.notifyStoreUpdateAvailable(keys);
966
+ };
967
+ };
952
968
 
953
969
  function select(luvio, params) {
954
970
  return select$1();
@@ -1096,6 +1112,7 @@ let getCommunity_imperative;
1096
1112
  // Adapter Metadata
1097
1113
  const getCommunityMetadata = { apiFamily: 'CommunityInfo', name: 'getCommunity', ttl: 3600000 };
1098
1114
  // Notify Update Available
1115
+ let notifyCommunityUpdateAvailable;
1099
1116
  function bindExportsTo(luvio) {
1100
1117
  // LDS Adapters
1101
1118
  const getCommunity_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getCommunity', getCommunityAdapterFactory), getCommunityMetadata);
@@ -1104,11 +1121,13 @@ function bindExportsTo(luvio) {
1104
1121
  // Imperative GET Adapters
1105
1122
  getCommunity_imperative: createImperativeAdapter(luvio, getCommunity_ldsAdapter, getCommunityMetadata),
1106
1123
  // Notify Update Availables
1124
+ notifyCommunityUpdateAvailable: createLDSAdapter(luvio, 'notifyCommunityUpdateAvailable', notifyUpdateAvailableFactory),
1107
1125
  };
1108
1126
  }
1109
1127
  withDefaultLuvio((luvio) => {
1110
- ({ getCommunity, getCommunity_imperative } = bindExportsTo(luvio));
1128
+ ({ getCommunity, getCommunity_imperative, notifyCommunityUpdateAvailable } =
1129
+ bindExportsTo(luvio));
1111
1130
  });
1112
1131
 
1113
- export { getCommunity, getCommunity_imperative };
1114
- // version: 1.286.0-27bef7c46
1132
+ export { getCommunity, getCommunity_imperative, notifyCommunityUpdateAvailable };
1133
+ // version: 1.287.0-dev10-32adad9f2
@@ -12,6 +12,10 @@ types:
12
12
  (luvio.ttl): 3600000
13
13
  (luvio.key):
14
14
  id: id
15
+ (luvio.updateAvailable):
16
+ name: notifyCommunityUpdateAvailable
17
+ parameters:
18
+ id: id
15
19
 
16
20
  /connect/communities/{communityId}:
17
21
  get: