@salesforce/lds-adapters-community-info 1.363.0 → 1.365.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.
@@ -4,7 +4,7 @@
4
4
  * For full license text, see the LICENSE.txt file
5
5
  */
6
6
 
7
- import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, typeCheckConfig as typeCheckConfig$1, StoreKeyMap, createResourceParams as createResourceParams$1 } from '@luvio/engine';
7
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$2, typeCheckConfig as typeCheckConfig$2, StoreKeyMap, createResourceParams as createResourceParams$2 } from '@luvio/engine';
8
8
 
9
9
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
10
  const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
@@ -74,15 +74,28 @@ const keyPrefix = 'CommunityInfo';
74
74
  const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
75
75
  const { isArray: ArrayIsArray } = Array;
76
76
  const { stringify: JSONStringify } = JSON;
77
+ function equalsArray(a, b, equalsItem) {
78
+ const aLength = a.length;
79
+ const bLength = b.length;
80
+ if (aLength !== bLength) {
81
+ return false;
82
+ }
83
+ for (let i = 0; i < aLength; i++) {
84
+ if (equalsItem(a[i], b[i]) === false) {
85
+ return false;
86
+ }
87
+ }
88
+ return true;
89
+ }
77
90
  function createLink(ref) {
78
91
  return {
79
92
  __ref: serializeStructuredKey(ref),
80
93
  };
81
94
  }
82
95
 
83
- const TTL = 3600000;
84
- const VERSION = "a4ffd78a9a641066e050c5a37a879702";
85
- function validate(obj, path = 'CommunityRepresentation') {
96
+ const TTL$1 = 3600000;
97
+ const VERSION$1 = "a4ffd78a9a641066e050c5a37a879702";
98
+ function validate$1(obj, path = 'CommunityRepresentation') {
86
99
  const v_error = (() => {
87
100
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
88
101
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -714,23 +727,23 @@ function validate(obj, path = 'CommunityRepresentation') {
714
727
  })();
715
728
  return v_error === undefined ? null : v_error;
716
729
  }
717
- const RepresentationType = 'CommunityRepresentation';
718
- function keyBuilder$2(luvio, config) {
719
- return keyPrefix + '::' + RepresentationType + ':' + (config.id === null ? '' : config.id);
730
+ const RepresentationType$1 = 'CommunityRepresentation';
731
+ function keyBuilder$4(luvio, config) {
732
+ return keyPrefix + '::' + RepresentationType$1 + ':' + (config.id === null ? '' : config.id);
720
733
  }
721
734
  function keyBuilderFromType(luvio, object) {
722
735
  const keyParams = {
723
736
  id: object.id
724
737
  };
725
- return keyBuilder$2(luvio, keyParams);
738
+ return keyBuilder$4(luvio, keyParams);
726
739
  }
727
- function normalize(input, existing, path, luvio, store, timestamp) {
740
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
728
741
  return input;
729
742
  }
730
- const select$1 = function CommunityRepresentationSelect() {
743
+ const select$3 = function CommunityRepresentationSelect() {
731
744
  return {
732
745
  kind: 'Fragment',
733
- version: VERSION,
746
+ version: VERSION$1,
734
747
  private: [],
735
748
  selections: [
736
749
  {
@@ -832,7 +845,7 @@ const select$1 = function CommunityRepresentationSelect() {
832
845
  ]
833
846
  };
834
847
  };
835
- function equals(existing, incoming) {
848
+ function equals$1(existing, incoming) {
836
849
  const existing_allowChatterAccessWithoutLogin = existing.allowChatterAccessWithoutLogin;
837
850
  const incoming_allowChatterAccessWithoutLogin = incoming.allowChatterAccessWithoutLogin;
838
851
  if (!(existing_allowChatterAccessWithoutLogin === incoming_allowChatterAccessWithoutLogin)) {
@@ -955,24 +968,24 @@ function equals(existing, incoming) {
955
968
  }
956
969
  return true;
957
970
  }
958
- const ingest = function CommunityRepresentationIngest(input, path, luvio, store, timestamp) {
971
+ const ingest$1 = function CommunityRepresentationIngest(input, path, luvio, store, timestamp) {
959
972
  if (process.env.NODE_ENV !== 'production') {
960
- const validateError = validate(input);
973
+ const validateError = validate$1(input);
961
974
  if (validateError !== null) {
962
975
  throw validateError;
963
976
  }
964
977
  }
965
978
  const key = keyBuilderFromType(luvio, input);
966
- const ttlToUse = TTL;
967
- ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "CommunityInfo", VERSION, RepresentationType, equals);
979
+ const ttlToUse = TTL$1;
980
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "CommunityInfo", VERSION$1, RepresentationType$1, equals$1);
968
981
  return createLink(key);
969
982
  };
970
- function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
983
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
971
984
  // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
972
985
  const rootKey = keyBuilderFromType(luvio, input);
973
986
  rootKeySet.set(rootKey, {
974
987
  namespace: keyPrefix,
975
- representationName: RepresentationType,
988
+ representationName: RepresentationType$1,
976
989
  mergeable: false
977
990
  });
978
991
  }
@@ -986,26 +999,274 @@ const notifyUpdateAvailableFactory = (luvio) => {
986
999
  }
987
1000
  });
988
1001
  }
989
- const keys = configs.map(c => keyBuilder$2(luvio, c));
1002
+ const keys = configs.map(c => keyBuilder$4(luvio, c));
990
1003
  return luvio.notifyStoreUpdateAvailable(keys);
991
1004
  };
992
1005
  };
993
1006
 
994
- function select(luvio, params) {
1007
+ const TTL = 60000;
1008
+ const VERSION = "e6f9ff44e6e76bc78cc1e0730e8459c9";
1009
+ function validate(obj, path = 'CommunityCollectionRepresentation') {
1010
+ const v_error = (() => {
1011
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1012
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1013
+ }
1014
+ const obj_communities = obj.communities;
1015
+ const path_communities = path + '.communities';
1016
+ if (!ArrayIsArray(obj_communities)) {
1017
+ return new TypeError('Expected "array" but received "' + typeof obj_communities + '" (at "' + path_communities + '")');
1018
+ }
1019
+ for (let i = 0; i < obj_communities.length; i++) {
1020
+ const obj_communities_item = obj_communities[i];
1021
+ const path_communities_item = path_communities + '[' + i + ']';
1022
+ if (typeof obj_communities_item !== 'object' || Array.isArray(obj_communities_item)) {
1023
+ return new TypeError('Expected "object" but received "' + typeof obj_communities_item + '" (at "' + path_communities_item + '")');
1024
+ }
1025
+ }
1026
+ const obj_total = obj.total;
1027
+ const path_total = path + '.total';
1028
+ if (typeof obj_total !== 'number' || (typeof obj_total === 'number' && Math.floor(obj_total) !== obj_total)) {
1029
+ return new TypeError('Expected "integer" but received "' + typeof obj_total + '" (at "' + path_total + '")');
1030
+ }
1031
+ })();
1032
+ return v_error === undefined ? null : v_error;
1033
+ }
1034
+ const RepresentationType = 'CommunityCollectionRepresentation';
1035
+ function normalize(input, existing, path, luvio, store, timestamp) {
1036
+ const input_communities = input.communities;
1037
+ const input_communities_id = path.fullPath + '__communities';
1038
+ for (let i = 0; i < input_communities.length; i++) {
1039
+ const input_communities_item = input_communities[i];
1040
+ let input_communities_item_id = input_communities_id + '__' + i;
1041
+ input_communities[i] = ingest$1(input_communities_item, {
1042
+ fullPath: input_communities_item_id,
1043
+ propertyName: i,
1044
+ parent: {
1045
+ data: input,
1046
+ key: path.fullPath,
1047
+ existing: existing,
1048
+ },
1049
+ ttl: path.ttl
1050
+ }, luvio, store, timestamp);
1051
+ }
1052
+ return input;
1053
+ }
1054
+ const select$2 = function CommunityCollectionRepresentationSelect() {
1055
+ return {
1056
+ kind: 'Fragment',
1057
+ version: VERSION,
1058
+ private: [],
1059
+ selections: [
1060
+ {
1061
+ name: 'communities',
1062
+ kind: 'Link',
1063
+ plural: true,
1064
+ fragment: select$3()
1065
+ },
1066
+ {
1067
+ name: 'total',
1068
+ kind: 'Scalar'
1069
+ }
1070
+ ]
1071
+ };
1072
+ };
1073
+ function equals(existing, incoming) {
1074
+ const existing_total = existing.total;
1075
+ const incoming_total = incoming.total;
1076
+ if (!(existing_total === incoming_total)) {
1077
+ return false;
1078
+ }
1079
+ const existing_communities = existing.communities;
1080
+ const incoming_communities = incoming.communities;
1081
+ const equals_communities_items = equalsArray(existing_communities, incoming_communities, (existing_communities_item, incoming_communities_item) => {
1082
+ if (!(existing_communities_item.__ref === incoming_communities_item.__ref)) {
1083
+ return false;
1084
+ }
1085
+ });
1086
+ if (equals_communities_items === false) {
1087
+ return false;
1088
+ }
1089
+ return true;
1090
+ }
1091
+ const ingest = function CommunityCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
1092
+ if (process.env.NODE_ENV !== 'production') {
1093
+ const validateError = validate(input);
1094
+ if (validateError !== null) {
1095
+ throw validateError;
1096
+ }
1097
+ }
1098
+ const key = path.fullPath;
1099
+ const ttlToUse = TTL;
1100
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "CommunityInfo", VERSION, RepresentationType, equals);
1101
+ return createLink(key);
1102
+ };
1103
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
1104
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1105
+ const rootKey = fullPathFactory();
1106
+ rootKeySet.set(rootKey, {
1107
+ namespace: keyPrefix,
1108
+ representationName: RepresentationType,
1109
+ mergeable: false
1110
+ });
1111
+ const input_communities_length = input.communities.length;
1112
+ for (let i = 0; i < input_communities_length; i++) {
1113
+ getTypeCacheKeys$1(rootKeySet, luvio, input.communities[i]);
1114
+ }
1115
+ }
1116
+
1117
+ function select$1(luvio, params) {
1118
+ return select$2();
1119
+ }
1120
+ function keyBuilder$3(luvio, params) {
1121
+ return keyPrefix + '::CommunityCollectionRepresentation:(' + 'status:' + params.queryParams.status + ')';
1122
+ }
1123
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
1124
+ getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$3(luvio, resourceParams));
1125
+ }
1126
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
1127
+ const { body } = response;
1128
+ const key = keyBuilder$3(luvio, resourceParams);
1129
+ luvio.storeIngest(key, ingest, body);
1130
+ const snapshot = luvio.storeLookup({
1131
+ recordId: key,
1132
+ node: select$1(),
1133
+ variables: {},
1134
+ }, snapshotRefresh);
1135
+ if (process.env.NODE_ENV !== 'production') {
1136
+ if (snapshot.state !== 'Fulfilled') {
1137
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1138
+ }
1139
+ }
1140
+ deepFreeze(snapshot.data);
1141
+ return snapshot;
1142
+ }
1143
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
1144
+ const key = keyBuilder$3(luvio, params);
1145
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1146
+ const storeMetadataParams = {
1147
+ ttl: TTL,
1148
+ namespace: keyPrefix,
1149
+ version: VERSION,
1150
+ representationName: RepresentationType
1151
+ };
1152
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
1153
+ return errorSnapshot;
1154
+ }
1155
+ function createResourceRequest$1(config) {
1156
+ const headers = {};
1157
+ return {
1158
+ baseUri: '/services/data/v65.0',
1159
+ basePath: '/connect/communities',
1160
+ method: 'get',
1161
+ body: null,
1162
+ urlParams: {},
1163
+ queryParams: config.queryParams,
1164
+ headers,
1165
+ priority: 'normal',
1166
+ };
1167
+ }
1168
+
1169
+ const adapterName$1 = 'getCommunities';
1170
+ const getCommunities_ConfigPropertyMetadata = [
1171
+ generateParamConfigMetadata('status', false, 1 /* QueryParameter */, 0 /* String */),
1172
+ ];
1173
+ const getCommunities_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getCommunities_ConfigPropertyMetadata);
1174
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$2(getCommunities_ConfigPropertyMetadata);
1175
+ function keyBuilder$2(luvio, config) {
1176
+ const resourceParams = createResourceParams$1(config);
1177
+ return keyBuilder$3(luvio, resourceParams);
1178
+ }
1179
+ function typeCheckConfig$1(untrustedConfig) {
1180
+ const config = {};
1181
+ typeCheckConfig$2(untrustedConfig, config, getCommunities_ConfigPropertyMetadata);
1182
+ return config;
1183
+ }
1184
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
1185
+ if (!untrustedIsObject(untrustedConfig)) {
1186
+ return null;
1187
+ }
1188
+ if (process.env.NODE_ENV !== 'production') {
1189
+ validateConfig(untrustedConfig, configPropertyNames);
1190
+ }
1191
+ const config = typeCheckConfig$1(untrustedConfig);
1192
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1193
+ return null;
1194
+ }
1195
+ return config;
1196
+ }
1197
+ function adapterFragment$1(luvio, config) {
1198
+ createResourceParams$1(config);
995
1199
  return select$1();
996
1200
  }
1201
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
1202
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
1203
+ config,
1204
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1205
+ });
1206
+ return luvio.storeBroadcast().then(() => snapshot);
1207
+ }
1208
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
1209
+ const snapshot = ingestError$1(luvio, resourceParams, response, {
1210
+ config,
1211
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1212
+ });
1213
+ return luvio.storeBroadcast().then(() => snapshot);
1214
+ }
1215
+ function buildNetworkSnapshot$1(luvio, config, options) {
1216
+ const resourceParams = createResourceParams$1(config);
1217
+ const request = createResourceRequest$1(resourceParams);
1218
+ return luvio.dispatchResourceRequest(request, options)
1219
+ .then((response) => {
1220
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
1221
+ const cache = new StoreKeyMap();
1222
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
1223
+ return cache;
1224
+ });
1225
+ }, (response) => {
1226
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
1227
+ });
1228
+ }
1229
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
1230
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
1231
+ }
1232
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
1233
+ const { luvio, config } = context;
1234
+ const selector = {
1235
+ recordId: keyBuilder$2(luvio, config),
1236
+ node: adapterFragment$1(luvio, config),
1237
+ variables: {},
1238
+ };
1239
+ const cacheSnapshot = storeLookup(selector, {
1240
+ config,
1241
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1242
+ });
1243
+ return cacheSnapshot;
1244
+ }
1245
+ const getCommunitiesAdapterFactory = (luvio) => function CommunityInfo__getCommunities(untrustedConfig, requestContext) {
1246
+ const config = validateAdapterConfig$1(untrustedConfig, getCommunities_ConfigPropertyNames);
1247
+ // Invalid or incomplete config
1248
+ if (config === null) {
1249
+ return null;
1250
+ }
1251
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1252
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
1253
+ };
1254
+
1255
+ function select(luvio, params) {
1256
+ return select$3();
1257
+ }
997
1258
  function keyBuilder$1(luvio, params) {
998
- return keyBuilder$2(luvio, {
1259
+ return keyBuilder$4(luvio, {
999
1260
  id: params.urlParams.communityId
1000
1261
  });
1001
1262
  }
1002
1263
  function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
1003
- getTypeCacheKeys(storeKeyMap, luvio, response);
1264
+ getTypeCacheKeys$1(storeKeyMap, luvio, response);
1004
1265
  }
1005
1266
  function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
1006
1267
  const { body } = response;
1007
1268
  const key = keyBuilder$1(luvio, resourceParams);
1008
- luvio.storeIngest(key, ingest, body);
1269
+ luvio.storeIngest(key, ingest$1, body);
1009
1270
  const snapshot = luvio.storeLookup({
1010
1271
  recordId: key,
1011
1272
  node: select(),
@@ -1023,10 +1284,10 @@ function ingestError(luvio, params, error, snapshotRefresh) {
1023
1284
  const key = keyBuilder$1(luvio, params);
1024
1285
  const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1025
1286
  const storeMetadataParams = {
1026
- ttl: TTL,
1287
+ ttl: TTL$1,
1027
1288
  namespace: keyPrefix,
1028
- version: VERSION,
1029
- representationName: RepresentationType
1289
+ version: VERSION$1,
1290
+ representationName: RepresentationType$1
1030
1291
  };
1031
1292
  luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
1032
1293
  return errorSnapshot;
@@ -1050,14 +1311,14 @@ const getCommunity_ConfigPropertyMetadata = [
1050
1311
  generateParamConfigMetadata('communityId', true, 0 /* UrlParameter */, 0 /* String */),
1051
1312
  ];
1052
1313
  const getCommunity_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getCommunity_ConfigPropertyMetadata);
1053
- const createResourceParams = /*#__PURE__*/ createResourceParams$1(getCommunity_ConfigPropertyMetadata);
1314
+ const createResourceParams = /*#__PURE__*/ createResourceParams$2(getCommunity_ConfigPropertyMetadata);
1054
1315
  function keyBuilder(luvio, config) {
1055
1316
  const resourceParams = createResourceParams(config);
1056
1317
  return keyBuilder$1(luvio, resourceParams);
1057
1318
  }
1058
1319
  function typeCheckConfig(untrustedConfig) {
1059
1320
  const config = {};
1060
- typeCheckConfig$1(untrustedConfig, config, getCommunity_ConfigPropertyMetadata);
1321
+ typeCheckConfig$2(untrustedConfig, config, getCommunity_ConfigPropertyMetadata);
1061
1322
  return config;
1062
1323
  }
1063
1324
  function validateAdapterConfig(untrustedConfig, configPropertyNames) {
@@ -1106,7 +1367,7 @@ function buildNetworkSnapshot(luvio, config, options) {
1106
1367
  });
1107
1368
  }
1108
1369
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
1109
- return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
1370
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
1110
1371
  }
1111
1372
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
1112
1373
  const { luvio, config } = context;
@@ -1131,4 +1392,4 @@ const getCommunityAdapterFactory = (luvio) => function CommunityInfo__getCommuni
1131
1392
  buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
1132
1393
  };
1133
1394
 
1134
- export { getCommunityAdapterFactory, notifyUpdateAvailableFactory as notifyCommunityUpdateAvailableFactory };
1395
+ export { getCommunitiesAdapterFactory, getCommunityAdapterFactory, notifyUpdateAvailableFactory as notifyCommunityUpdateAvailableFactory };
@@ -0,0 +1,27 @@
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';
3
+ import { ResourceRequestConfig as resources_getConnectCommunities_ResourceRequestConfig } from '../resources/getConnectCommunities';
4
+ import { CommunityCollectionRepresentation as types_CommunityCollectionRepresentation_CommunityCollectionRepresentation } from '../types/CommunityCollectionRepresentation';
5
+ export declare const adapterName = "getCommunities";
6
+ export declare const getCommunities_ConfigPropertyMetadata: $64$luvio_engine_AdapterConfigMetadata[];
7
+ export declare const getCommunities_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
8
+ export interface GetCommunitiesConfig {
9
+ status?: string;
10
+ }
11
+ export declare const createResourceParams: (config: GetCommunitiesConfig) => resources_getConnectCommunities_ResourceRequestConfig;
12
+ export declare function keyBuilder(luvio: $64$luvio_engine_Luvio, config: GetCommunitiesConfig): string;
13
+ export declare function keyBuilder_StructuredKey(luvio: $64$luvio_engine_Luvio, config: GetCommunitiesConfig): $64$luvio_engine_NormalizedKeyMetadata;
14
+ export declare function typeCheckConfig(untrustedConfig: adapter$45$utils_Untrusted<GetCommunitiesConfig>): adapter$45$utils_Untrusted<GetCommunitiesConfig>;
15
+ export declare function validateAdapterConfig(untrustedConfig: unknown, configPropertyNames: adapter$45$utils_AdapterValidationConfig): GetCommunitiesConfig | null;
16
+ export declare function adapterFragment(luvio: $64$luvio_engine_Luvio, config: GetCommunitiesConfig): $64$luvio_engine_Fragment;
17
+ export declare function buildCachedSnapshot(luvio: $64$luvio_engine_Luvio, config: GetCommunitiesConfig): $64$luvio_engine_Snapshot<types_CommunityCollectionRepresentation_CommunityCollectionRepresentation, any>;
18
+ export declare function onFetchResponseSuccess(luvio: $64$luvio_engine_Luvio, config: GetCommunitiesConfig, resourceParams: resources_getConnectCommunities_ResourceRequestConfig, response: $64$luvio_engine_FetchResponse<types_CommunityCollectionRepresentation_CommunityCollectionRepresentation>): Promise<import("@luvio/engine").FulfilledSnapshot<types_CommunityCollectionRepresentation_CommunityCollectionRepresentation, {}> | import("@luvio/engine").StaleSnapshot<types_CommunityCollectionRepresentation_CommunityCollectionRepresentation, {}> | import("@luvio/engine").PendingSnapshot<types_CommunityCollectionRepresentation_CommunityCollectionRepresentation, any>>;
19
+ export declare function onFetchResponseError(luvio: $64$luvio_engine_Luvio, config: GetCommunitiesConfig, resourceParams: resources_getConnectCommunities_ResourceRequestConfig, response: $64$luvio_engine_ErrorResponse): Promise<import("@luvio/engine").ErrorSnapshot>;
20
+ export declare function buildNetworkSnapshot(luvio: $64$luvio_engine_Luvio, config: GetCommunitiesConfig, options?: $64$luvio_engine_DispatchResourceRequestContext): Promise<$64$luvio_engine_Snapshot<types_CommunityCollectionRepresentation_CommunityCollectionRepresentation, any>>;
21
+ export type BuildSnapshotContext = {
22
+ luvio: $64$luvio_engine_Luvio;
23
+ config: GetCommunitiesConfig;
24
+ };
25
+ export declare function buildNetworkSnapshotCachePolicy(context: BuildSnapshotContext, coercedAdapterRequestContext: $64$luvio_engine_CoercedAdapterRequestContext): Promise<$64$luvio_engine_Snapshot<types_CommunityCollectionRepresentation_CommunityCollectionRepresentation, any>>;
26
+ export declare function buildCachedSnapshotCachePolicy(context: BuildSnapshotContext, storeLookup: $64$luvio_engine_StoreLookup<types_CommunityCollectionRepresentation_CommunityCollectionRepresentation>): $64$luvio_engine_Snapshot<types_CommunityCollectionRepresentation_CommunityCollectionRepresentation, any>;
27
+ export declare const getCommunitiesAdapterFactory: $64$luvio_engine_AdapterFactory<GetCommunitiesConfig, types_CommunityCollectionRepresentation_CommunityCollectionRepresentation>;
@@ -1,2 +1,3 @@
1
+ export { getCommunitiesAdapterFactory } from '../adapters/getCommunities';
1
2
  export { getCommunityAdapterFactory } from '../adapters/getCommunity';
2
3
  export { notifyUpdateAvailableFactory as notifyCommunityUpdateAvailableFactory } from '../types/CommunityRepresentation';
@@ -1,5 +1,7 @@
1
+ declare let getCommunities: any;
1
2
  declare let getCommunity: any;
3
+ declare let getCommunities_imperative: any;
2
4
  declare let getCommunity_imperative: any;
3
5
  declare let notifyCommunityUpdateAvailable: any;
4
- export { getCommunity, getCommunity_imperative };
6
+ export { getCommunities, getCommunity, getCommunities_imperative, getCommunity_imperative };
5
7
  export { notifyCommunityUpdateAvailable };
@@ -0,0 +1,15 @@
1
+ import { Luvio as $64$luvio_engine_Luvio, Fragment as $64$luvio_engine_Fragment, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata, FetchResponse as $64$luvio_engine_FetchResponse, SnapshotRefresh as $64$luvio_engine_SnapshotRefresh, FulfilledSnapshot as $64$luvio_engine_FulfilledSnapshot, StaleSnapshot as $64$luvio_engine_StaleSnapshot, PendingSnapshot as $64$luvio_engine_PendingSnapshot, ErrorResponse as $64$luvio_engine_ErrorResponse, ErrorSnapshot as $64$luvio_engine_ErrorSnapshot, ResourceRequest as $64$luvio_engine_ResourceRequest } from '@luvio/engine';
2
+ import { CommunityCollectionRepresentation as types_CommunityCollectionRepresentation_CommunityCollectionRepresentation } from '../types/CommunityCollectionRepresentation';
3
+ export interface ResourceRequestConfig {
4
+ queryParams: {
5
+ status?: string;
6
+ };
7
+ }
8
+ export declare function select(luvio: $64$luvio_engine_Luvio, params: ResourceRequestConfig): $64$luvio_engine_Fragment;
9
+ export declare function keyBuilder(luvio: $64$luvio_engine_Luvio, params: ResourceRequestConfig): string;
10
+ export declare function keyBuilder_StructuredKey(luvio: $64$luvio_engine_Luvio, params: ResourceRequestConfig): $64$luvio_engine_NormalizedKeyMetadata;
11
+ export declare function getResponseCacheKeys(storeKeyMap: any, luvio: $64$luvio_engine_Luvio, resourceParams: ResourceRequestConfig, response: types_CommunityCollectionRepresentation_CommunityCollectionRepresentation): void;
12
+ export declare function ingestSuccess(luvio: $64$luvio_engine_Luvio, resourceParams: ResourceRequestConfig, response: $64$luvio_engine_FetchResponse<types_CommunityCollectionRepresentation_CommunityCollectionRepresentation>, snapshotRefresh?: $64$luvio_engine_SnapshotRefresh<types_CommunityCollectionRepresentation_CommunityCollectionRepresentation>): $64$luvio_engine_FulfilledSnapshot<types_CommunityCollectionRepresentation_CommunityCollectionRepresentation, {}> | $64$luvio_engine_StaleSnapshot<types_CommunityCollectionRepresentation_CommunityCollectionRepresentation, {}> | $64$luvio_engine_PendingSnapshot<types_CommunityCollectionRepresentation_CommunityCollectionRepresentation, any>;
13
+ export declare function ingestError(luvio: $64$luvio_engine_Luvio, params: ResourceRequestConfig, error: $64$luvio_engine_ErrorResponse, snapshotRefresh?: $64$luvio_engine_SnapshotRefresh<types_CommunityCollectionRepresentation_CommunityCollectionRepresentation>): $64$luvio_engine_ErrorSnapshot;
14
+ export declare function createResourceRequest(config: ResourceRequestConfig): $64$luvio_engine_ResourceRequest;
15
+ export default createResourceRequest;
@@ -0,0 +1,42 @@
1
+ import { IngestPath as $64$luvio_engine_IngestPath, Luvio as $64$luvio_engine_Luvio, Store as $64$luvio_engine_Store, ResourceIngest as $64$luvio_engine_ResourceIngest, FragmentSelection as $64$luvio_engine_FragmentSelection, LinkSelection as $64$luvio_engine_LinkSelection, StoreLink as $64$luvio_engine_StoreLink, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata } from '@luvio/engine';
2
+ import { CommunityRepresentation as CommunityRepresentation_CommunityRepresentation } from './CommunityRepresentation';
3
+ export declare const TTL = 60000;
4
+ export declare const VERSION = "e6f9ff44e6e76bc78cc1e0730e8459c9";
5
+ export declare function validate(obj: any, path?: string): TypeError | null;
6
+ export declare const RepresentationType: string;
7
+ export declare function normalize(input: CommunityCollectionRepresentation, existing: CommunityCollectionRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): CommunityCollectionRepresentationNormalized;
8
+ export interface DynamicIngestParams {
9
+ communities: $64$luvio_engine_ResourceIngest;
10
+ }
11
+ export declare function dynamicNormalize(ingestParams: DynamicIngestParams): (input: CommunityCollectionRepresentation, existing: CommunityCollectionRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number) => CommunityCollectionRepresentationNormalized;
12
+ export declare const select: () => $64$luvio_engine_FragmentSelection;
13
+ export interface DynamicSelectParams {
14
+ communities?: $64$luvio_engine_LinkSelection;
15
+ }
16
+ export declare const dynamicSelect: (params: DynamicSelectParams) => $64$luvio_engine_FragmentSelection;
17
+ export declare function equals(existing: CommunityCollectionRepresentationNormalized, incoming: CommunityCollectionRepresentationNormalized): boolean;
18
+ export declare const ingest: $64$luvio_engine_ResourceIngest;
19
+ export declare function getTypeCacheKeys(rootKeySet: $64$luvio_engine_DurableStoreKeyMetadataMap, luvio: $64$luvio_engine_Luvio, input: CommunityCollectionRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
20
+ export declare function dynamicIngest(ingestParams: DynamicIngestParams): $64$luvio_engine_ResourceIngest;
21
+ /**
22
+ * A list of Communities.
23
+ *
24
+ * Keys:
25
+ * (none)
26
+ */
27
+ export interface CommunityCollectionRepresentationNormalized {
28
+ /** List of communities available to the current user. */
29
+ communities: Array<$64$luvio_engine_StoreLink>;
30
+ /** Total number of communities available to the current user. */
31
+ total: number;
32
+ }
33
+ /**
34
+ * A list of Communities.
35
+ *
36
+ * Keys:
37
+ * (none)
38
+ */
39
+ export interface CommunityCollectionRepresentation {
40
+ communities: Array<CommunityRepresentation_CommunityRepresentation>;
41
+ total: number;
42
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-community-info",
3
- "version": "1.363.0",
3
+ "version": "1.365.0",
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.363.0"
47
+ "@salesforce/lds-bindings": "^1.365.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@salesforce/lds-compiler-plugins": "^1.363.0",
51
- "@salesforce/lds-karma": "^1.363.0"
50
+ "@salesforce/lds-compiler-plugins": "^1.365.0",
51
+ "@salesforce/lds-karma": "^1.365.0"
52
52
  },
53
53
  "nx": {
54
54
  "targets": {
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, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, typeCheckConfig as typeCheckConfig$1, StoreKeyMap, createResourceParams as createResourceParams$1 } from 'force/luvioEngine';
17
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$2, typeCheckConfig as typeCheckConfig$2, StoreKeyMap, createResourceParams as createResourceParams$2 } from 'force/luvioEngine';
18
18
 
19
19
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
20
20
  const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
@@ -84,15 +84,28 @@ const keyPrefix = 'CommunityInfo';
84
84
  const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
85
85
  const { isArray: ArrayIsArray } = Array;
86
86
  const { stringify: JSONStringify } = JSON;
87
+ function equalsArray(a, b, equalsItem) {
88
+ const aLength = a.length;
89
+ const bLength = b.length;
90
+ if (aLength !== bLength) {
91
+ return false;
92
+ }
93
+ for (let i = 0; i < aLength; i++) {
94
+ if (equalsItem(a[i], b[i]) === false) {
95
+ return false;
96
+ }
97
+ }
98
+ return true;
99
+ }
87
100
  function createLink(ref) {
88
101
  return {
89
102
  __ref: serializeStructuredKey(ref),
90
103
  };
91
104
  }
92
105
 
93
- const TTL = 3600000;
94
- const VERSION = "a4ffd78a9a641066e050c5a37a879702";
95
- function validate(obj, path = 'CommunityRepresentation') {
106
+ const TTL$1 = 3600000;
107
+ const VERSION$1 = "a4ffd78a9a641066e050c5a37a879702";
108
+ function validate$1(obj, path = 'CommunityRepresentation') {
96
109
  const v_error = (() => {
97
110
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
98
111
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -724,23 +737,23 @@ function validate(obj, path = 'CommunityRepresentation') {
724
737
  })();
725
738
  return v_error === undefined ? null : v_error;
726
739
  }
727
- const RepresentationType = 'CommunityRepresentation';
728
- function keyBuilder$2(luvio, config) {
729
- return keyPrefix + '::' + RepresentationType + ':' + (config.id === null ? '' : config.id);
740
+ const RepresentationType$1 = 'CommunityRepresentation';
741
+ function keyBuilder$4(luvio, config) {
742
+ return keyPrefix + '::' + RepresentationType$1 + ':' + (config.id === null ? '' : config.id);
730
743
  }
731
744
  function keyBuilderFromType(luvio, object) {
732
745
  const keyParams = {
733
746
  id: object.id
734
747
  };
735
- return keyBuilder$2(luvio, keyParams);
748
+ return keyBuilder$4(luvio, keyParams);
736
749
  }
737
- function normalize(input, existing, path, luvio, store, timestamp) {
750
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
738
751
  return input;
739
752
  }
740
- const select$1 = function CommunityRepresentationSelect() {
753
+ const select$3 = function CommunityRepresentationSelect() {
741
754
  return {
742
755
  kind: 'Fragment',
743
- version: VERSION,
756
+ version: VERSION$1,
744
757
  private: [],
745
758
  selections: [
746
759
  {
@@ -842,7 +855,7 @@ const select$1 = function CommunityRepresentationSelect() {
842
855
  ]
843
856
  };
844
857
  };
845
- function equals(existing, incoming) {
858
+ function equals$1(existing, incoming) {
846
859
  const existing_allowChatterAccessWithoutLogin = existing.allowChatterAccessWithoutLogin;
847
860
  const incoming_allowChatterAccessWithoutLogin = incoming.allowChatterAccessWithoutLogin;
848
861
  if (!(existing_allowChatterAccessWithoutLogin === incoming_allowChatterAccessWithoutLogin)) {
@@ -965,24 +978,24 @@ function equals(existing, incoming) {
965
978
  }
966
979
  return true;
967
980
  }
968
- const ingest = function CommunityRepresentationIngest(input, path, luvio, store, timestamp) {
981
+ const ingest$1 = function CommunityRepresentationIngest(input, path, luvio, store, timestamp) {
969
982
  if (process.env.NODE_ENV !== 'production') {
970
- const validateError = validate(input);
983
+ const validateError = validate$1(input);
971
984
  if (validateError !== null) {
972
985
  throw validateError;
973
986
  }
974
987
  }
975
988
  const key = keyBuilderFromType(luvio, input);
976
- const ttlToUse = TTL;
977
- ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "CommunityInfo", VERSION, RepresentationType, equals);
989
+ const ttlToUse = TTL$1;
990
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "CommunityInfo", VERSION$1, RepresentationType$1, equals$1);
978
991
  return createLink(key);
979
992
  };
980
- function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
993
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
981
994
  // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
982
995
  const rootKey = keyBuilderFromType(luvio, input);
983
996
  rootKeySet.set(rootKey, {
984
997
  namespace: keyPrefix,
985
- representationName: RepresentationType,
998
+ representationName: RepresentationType$1,
986
999
  mergeable: false
987
1000
  });
988
1001
  }
@@ -996,26 +1009,274 @@ const notifyUpdateAvailableFactory = (luvio) => {
996
1009
  }
997
1010
  });
998
1011
  }
999
- const keys = configs.map(c => keyBuilder$2(luvio, c));
1012
+ const keys = configs.map(c => keyBuilder$4(luvio, c));
1000
1013
  return luvio.notifyStoreUpdateAvailable(keys);
1001
1014
  };
1002
1015
  };
1003
1016
 
1004
- function select(luvio, params) {
1017
+ const TTL = 60000;
1018
+ const VERSION = "e6f9ff44e6e76bc78cc1e0730e8459c9";
1019
+ function validate(obj, path = 'CommunityCollectionRepresentation') {
1020
+ const v_error = (() => {
1021
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1022
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1023
+ }
1024
+ const obj_communities = obj.communities;
1025
+ const path_communities = path + '.communities';
1026
+ if (!ArrayIsArray(obj_communities)) {
1027
+ return new TypeError('Expected "array" but received "' + typeof obj_communities + '" (at "' + path_communities + '")');
1028
+ }
1029
+ for (let i = 0; i < obj_communities.length; i++) {
1030
+ const obj_communities_item = obj_communities[i];
1031
+ const path_communities_item = path_communities + '[' + i + ']';
1032
+ if (typeof obj_communities_item !== 'object' || Array.isArray(obj_communities_item)) {
1033
+ return new TypeError('Expected "object" but received "' + typeof obj_communities_item + '" (at "' + path_communities_item + '")');
1034
+ }
1035
+ }
1036
+ const obj_total = obj.total;
1037
+ const path_total = path + '.total';
1038
+ if (typeof obj_total !== 'number' || (typeof obj_total === 'number' && Math.floor(obj_total) !== obj_total)) {
1039
+ return new TypeError('Expected "integer" but received "' + typeof obj_total + '" (at "' + path_total + '")');
1040
+ }
1041
+ })();
1042
+ return v_error === undefined ? null : v_error;
1043
+ }
1044
+ const RepresentationType = 'CommunityCollectionRepresentation';
1045
+ function normalize(input, existing, path, luvio, store, timestamp) {
1046
+ const input_communities = input.communities;
1047
+ const input_communities_id = path.fullPath + '__communities';
1048
+ for (let i = 0; i < input_communities.length; i++) {
1049
+ const input_communities_item = input_communities[i];
1050
+ let input_communities_item_id = input_communities_id + '__' + i;
1051
+ input_communities[i] = ingest$1(input_communities_item, {
1052
+ fullPath: input_communities_item_id,
1053
+ propertyName: i,
1054
+ parent: {
1055
+ data: input,
1056
+ key: path.fullPath,
1057
+ existing: existing,
1058
+ },
1059
+ ttl: path.ttl
1060
+ }, luvio, store, timestamp);
1061
+ }
1062
+ return input;
1063
+ }
1064
+ const select$2 = function CommunityCollectionRepresentationSelect() {
1065
+ return {
1066
+ kind: 'Fragment',
1067
+ version: VERSION,
1068
+ private: [],
1069
+ selections: [
1070
+ {
1071
+ name: 'communities',
1072
+ kind: 'Link',
1073
+ plural: true,
1074
+ fragment: select$3()
1075
+ },
1076
+ {
1077
+ name: 'total',
1078
+ kind: 'Scalar'
1079
+ }
1080
+ ]
1081
+ };
1082
+ };
1083
+ function equals(existing, incoming) {
1084
+ const existing_total = existing.total;
1085
+ const incoming_total = incoming.total;
1086
+ if (!(existing_total === incoming_total)) {
1087
+ return false;
1088
+ }
1089
+ const existing_communities = existing.communities;
1090
+ const incoming_communities = incoming.communities;
1091
+ const equals_communities_items = equalsArray(existing_communities, incoming_communities, (existing_communities_item, incoming_communities_item) => {
1092
+ if (!(existing_communities_item.__ref === incoming_communities_item.__ref)) {
1093
+ return false;
1094
+ }
1095
+ });
1096
+ if (equals_communities_items === false) {
1097
+ return false;
1098
+ }
1099
+ return true;
1100
+ }
1101
+ const ingest = function CommunityCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
1102
+ if (process.env.NODE_ENV !== 'production') {
1103
+ const validateError = validate(input);
1104
+ if (validateError !== null) {
1105
+ throw validateError;
1106
+ }
1107
+ }
1108
+ const key = path.fullPath;
1109
+ const ttlToUse = TTL;
1110
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "CommunityInfo", VERSION, RepresentationType, equals);
1111
+ return createLink(key);
1112
+ };
1113
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
1114
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1115
+ const rootKey = fullPathFactory();
1116
+ rootKeySet.set(rootKey, {
1117
+ namespace: keyPrefix,
1118
+ representationName: RepresentationType,
1119
+ mergeable: false
1120
+ });
1121
+ const input_communities_length = input.communities.length;
1122
+ for (let i = 0; i < input_communities_length; i++) {
1123
+ getTypeCacheKeys$1(rootKeySet, luvio, input.communities[i]);
1124
+ }
1125
+ }
1126
+
1127
+ function select$1(luvio, params) {
1128
+ return select$2();
1129
+ }
1130
+ function keyBuilder$3(luvio, params) {
1131
+ return keyPrefix + '::CommunityCollectionRepresentation:(' + 'status:' + params.queryParams.status + ')';
1132
+ }
1133
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
1134
+ getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$3(luvio, resourceParams));
1135
+ }
1136
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
1137
+ const { body } = response;
1138
+ const key = keyBuilder$3(luvio, resourceParams);
1139
+ luvio.storeIngest(key, ingest, body);
1140
+ const snapshot = luvio.storeLookup({
1141
+ recordId: key,
1142
+ node: select$1(),
1143
+ variables: {},
1144
+ }, snapshotRefresh);
1145
+ if (process.env.NODE_ENV !== 'production') {
1146
+ if (snapshot.state !== 'Fulfilled') {
1147
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1148
+ }
1149
+ }
1150
+ deepFreeze(snapshot.data);
1151
+ return snapshot;
1152
+ }
1153
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
1154
+ const key = keyBuilder$3(luvio, params);
1155
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1156
+ const storeMetadataParams = {
1157
+ ttl: TTL,
1158
+ namespace: keyPrefix,
1159
+ version: VERSION,
1160
+ representationName: RepresentationType
1161
+ };
1162
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
1163
+ return errorSnapshot;
1164
+ }
1165
+ function createResourceRequest$1(config) {
1166
+ const headers = {};
1167
+ return {
1168
+ baseUri: '/services/data/v65.0',
1169
+ basePath: '/connect/communities',
1170
+ method: 'get',
1171
+ body: null,
1172
+ urlParams: {},
1173
+ queryParams: config.queryParams,
1174
+ headers,
1175
+ priority: 'normal',
1176
+ };
1177
+ }
1178
+
1179
+ const adapterName$1 = 'getCommunities';
1180
+ const getCommunities_ConfigPropertyMetadata = [
1181
+ generateParamConfigMetadata('status', false, 1 /* QueryParameter */, 0 /* String */),
1182
+ ];
1183
+ const getCommunities_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getCommunities_ConfigPropertyMetadata);
1184
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$2(getCommunities_ConfigPropertyMetadata);
1185
+ function keyBuilder$2(luvio, config) {
1186
+ const resourceParams = createResourceParams$1(config);
1187
+ return keyBuilder$3(luvio, resourceParams);
1188
+ }
1189
+ function typeCheckConfig$1(untrustedConfig) {
1190
+ const config = {};
1191
+ typeCheckConfig$2(untrustedConfig, config, getCommunities_ConfigPropertyMetadata);
1192
+ return config;
1193
+ }
1194
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
1195
+ if (!untrustedIsObject(untrustedConfig)) {
1196
+ return null;
1197
+ }
1198
+ if (process.env.NODE_ENV !== 'production') {
1199
+ validateConfig(untrustedConfig, configPropertyNames);
1200
+ }
1201
+ const config = typeCheckConfig$1(untrustedConfig);
1202
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1203
+ return null;
1204
+ }
1205
+ return config;
1206
+ }
1207
+ function adapterFragment$1(luvio, config) {
1208
+ createResourceParams$1(config);
1005
1209
  return select$1();
1006
1210
  }
1211
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
1212
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
1213
+ config,
1214
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1215
+ });
1216
+ return luvio.storeBroadcast().then(() => snapshot);
1217
+ }
1218
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
1219
+ const snapshot = ingestError$1(luvio, resourceParams, response, {
1220
+ config,
1221
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1222
+ });
1223
+ return luvio.storeBroadcast().then(() => snapshot);
1224
+ }
1225
+ function buildNetworkSnapshot$1(luvio, config, options) {
1226
+ const resourceParams = createResourceParams$1(config);
1227
+ const request = createResourceRequest$1(resourceParams);
1228
+ return luvio.dispatchResourceRequest(request, options)
1229
+ .then((response) => {
1230
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
1231
+ const cache = new StoreKeyMap();
1232
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
1233
+ return cache;
1234
+ });
1235
+ }, (response) => {
1236
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
1237
+ });
1238
+ }
1239
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
1240
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
1241
+ }
1242
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
1243
+ const { luvio, config } = context;
1244
+ const selector = {
1245
+ recordId: keyBuilder$2(luvio, config),
1246
+ node: adapterFragment$1(luvio, config),
1247
+ variables: {},
1248
+ };
1249
+ const cacheSnapshot = storeLookup(selector, {
1250
+ config,
1251
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1252
+ });
1253
+ return cacheSnapshot;
1254
+ }
1255
+ const getCommunitiesAdapterFactory = (luvio) => function CommunityInfo__getCommunities(untrustedConfig, requestContext) {
1256
+ const config = validateAdapterConfig$1(untrustedConfig, getCommunities_ConfigPropertyNames);
1257
+ // Invalid or incomplete config
1258
+ if (config === null) {
1259
+ return null;
1260
+ }
1261
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1262
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
1263
+ };
1264
+
1265
+ function select(luvio, params) {
1266
+ return select$3();
1267
+ }
1007
1268
  function keyBuilder$1(luvio, params) {
1008
- return keyBuilder$2(luvio, {
1269
+ return keyBuilder$4(luvio, {
1009
1270
  id: params.urlParams.communityId
1010
1271
  });
1011
1272
  }
1012
1273
  function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
1013
- getTypeCacheKeys(storeKeyMap, luvio, response);
1274
+ getTypeCacheKeys$1(storeKeyMap, luvio, response);
1014
1275
  }
1015
1276
  function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
1016
1277
  const { body } = response;
1017
1278
  const key = keyBuilder$1(luvio, resourceParams);
1018
- luvio.storeIngest(key, ingest, body);
1279
+ luvio.storeIngest(key, ingest$1, body);
1019
1280
  const snapshot = luvio.storeLookup({
1020
1281
  recordId: key,
1021
1282
  node: select(),
@@ -1033,10 +1294,10 @@ function ingestError(luvio, params, error, snapshotRefresh) {
1033
1294
  const key = keyBuilder$1(luvio, params);
1034
1295
  const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1035
1296
  const storeMetadataParams = {
1036
- ttl: TTL,
1297
+ ttl: TTL$1,
1037
1298
  namespace: keyPrefix,
1038
- version: VERSION,
1039
- representationName: RepresentationType
1299
+ version: VERSION$1,
1300
+ representationName: RepresentationType$1
1040
1301
  };
1041
1302
  luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
1042
1303
  return errorSnapshot;
@@ -1060,14 +1321,14 @@ const getCommunity_ConfigPropertyMetadata = [
1060
1321
  generateParamConfigMetadata('communityId', true, 0 /* UrlParameter */, 0 /* String */),
1061
1322
  ];
1062
1323
  const getCommunity_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getCommunity_ConfigPropertyMetadata);
1063
- const createResourceParams = /*#__PURE__*/ createResourceParams$1(getCommunity_ConfigPropertyMetadata);
1324
+ const createResourceParams = /*#__PURE__*/ createResourceParams$2(getCommunity_ConfigPropertyMetadata);
1064
1325
  function keyBuilder(luvio, config) {
1065
1326
  const resourceParams = createResourceParams(config);
1066
1327
  return keyBuilder$1(luvio, resourceParams);
1067
1328
  }
1068
1329
  function typeCheckConfig(untrustedConfig) {
1069
1330
  const config = {};
1070
- typeCheckConfig$1(untrustedConfig, config, getCommunity_ConfigPropertyMetadata);
1331
+ typeCheckConfig$2(untrustedConfig, config, getCommunity_ConfigPropertyMetadata);
1071
1332
  return config;
1072
1333
  }
1073
1334
  function validateAdapterConfig(untrustedConfig, configPropertyNames) {
@@ -1116,7 +1377,7 @@ function buildNetworkSnapshot(luvio, config, options) {
1116
1377
  });
1117
1378
  }
1118
1379
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
1119
- return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
1380
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
1120
1381
  }
1121
1382
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
1122
1383
  const { luvio, config } = context;
@@ -1141,28 +1402,39 @@ const getCommunityAdapterFactory = (luvio) => function CommunityInfo__getCommuni
1141
1402
  buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
1142
1403
  };
1143
1404
 
1405
+ let getCommunities;
1144
1406
  let getCommunity;
1145
1407
  // Imperative GET Adapters
1408
+ let getCommunities_imperative;
1146
1409
  let getCommunity_imperative;
1147
1410
  // Adapter Metadata
1411
+ const getCommunitiesMetadata = { apiFamily: 'CommunityInfo', name: 'getCommunities', ttl: 60000 };
1148
1412
  const getCommunityMetadata = { apiFamily: 'CommunityInfo', name: 'getCommunity', ttl: 3600000 };
1149
1413
  // Notify Update Available
1150
1414
  let notifyCommunityUpdateAvailable;
1151
1415
  function bindExportsTo(luvio) {
1152
1416
  // LDS Adapters
1417
+ const getCommunities_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getCommunities', getCommunitiesAdapterFactory), getCommunitiesMetadata);
1153
1418
  const getCommunity_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getCommunity', getCommunityAdapterFactory), getCommunityMetadata);
1154
1419
  return {
1420
+ getCommunities: createWireAdapterConstructor(luvio, getCommunities_ldsAdapter, getCommunitiesMetadata),
1155
1421
  getCommunity: createWireAdapterConstructor(luvio, getCommunity_ldsAdapter, getCommunityMetadata),
1156
1422
  // Imperative GET Adapters
1423
+ getCommunities_imperative: createImperativeAdapter(luvio, getCommunities_ldsAdapter, getCommunitiesMetadata),
1157
1424
  getCommunity_imperative: createImperativeAdapter(luvio, getCommunity_ldsAdapter, getCommunityMetadata),
1158
1425
  // Notify Update Availables
1159
1426
  notifyCommunityUpdateAvailable: createLDSAdapter(luvio, 'notifyCommunityUpdateAvailable', notifyUpdateAvailableFactory),
1160
1427
  };
1161
1428
  }
1162
1429
  withDefaultLuvio((luvio) => {
1163
- ({ getCommunity, getCommunity_imperative, notifyCommunityUpdateAvailable } =
1164
- bindExportsTo(luvio));
1430
+ ({
1431
+ getCommunities,
1432
+ getCommunity,
1433
+ getCommunities_imperative,
1434
+ getCommunity_imperative,
1435
+ notifyCommunityUpdateAvailable,
1436
+ } = bindExportsTo(luvio));
1165
1437
  });
1166
1438
 
1167
- export { getCommunity, getCommunity_imperative, notifyCommunityUpdateAvailable };
1168
- // version: 1.363.0-112332910d
1439
+ export { getCommunities, getCommunities_imperative, getCommunity, getCommunity_imperative, notifyCommunityUpdateAvailable };
1440
+ // version: 1.365.0-4e4411f8a4
package/src/raml/api.raml CHANGED
@@ -25,6 +25,18 @@ annotationTypes:
25
25
  type: string
26
26
  allowedTargets: TypeDeclaration
27
27
  types:
28
+ CommunityCollectionRepresentation:
29
+ description: A list of Communities.
30
+ type: object
31
+ properties:
32
+ communities:
33
+ description: List of communities available to the current user.
34
+ type: array
35
+ items:
36
+ type: CommunityRepresentation
37
+ total:
38
+ description: Total number of communities available to the current user.
39
+ type: integer
28
40
  CommunityRepresentation:
29
41
  description: Communities are customizable public or private spaces for employees,
30
42
  customers, and partners to collaborate on best practices and business processes.
@@ -123,16 +135,36 @@ types:
123
135
  description: Community-specific URL prefix.
124
136
  type: string | nil
125
137
 
126
- /connect/communities/{communityId}:
127
- get:
128
- description: Returns information about the specified community.
129
- responses:
130
- '200':
131
- description: Success
132
- body:
133
- application/json:
134
- type: CommunityRepresentation
135
- uriParameters:
136
- communityId:
137
- type: string
138
- required: true
138
+ /connect:
139
+ /communities:
140
+ get:
141
+ displayName: getCommunityCollection
142
+ description: Returns all the communities available to the context user, optionally
143
+ filtered by status.
144
+ responses:
145
+ '200':
146
+ description: Success
147
+ body:
148
+ application/json:
149
+ type: CommunityCollectionRepresentation
150
+ queryParameters:
151
+ status:
152
+ type: string
153
+ required: false
154
+ enum:
155
+ - Inactive
156
+ - Live
157
+ - UnderConstruction
158
+ /communities/{communityId}:
159
+ get:
160
+ description: Returns information about the specified community.
161
+ responses:
162
+ '200':
163
+ description: Success
164
+ body:
165
+ application/json:
166
+ type: CommunityRepresentation
167
+ uriParameters:
168
+ communityId:
169
+ type: string
170
+ required: true
@@ -8,6 +8,8 @@ uses:
8
8
  (luvio.ttl): 2592000000
9
9
 
10
10
  types:
11
+ CommunityCollectionRepresentation:
12
+ (luvio.ttl): 60000
11
13
  CommunityRepresentation:
12
14
  (luvio.ttl): 3600000
13
15
  (luvio.key):
@@ -17,9 +19,14 @@ types:
17
19
  parameters:
18
20
  id: id
19
21
 
20
- /connect/communities/{communityId}:
21
- get:
22
- (luvio.adapter):
23
- name: getCommunity
24
- (luvio.key):
25
- id: urlParams.communityId
22
+ /connect:
23
+ /communities/{communityId}:
24
+ get:
25
+ (luvio.adapter):
26
+ name: getCommunity
27
+ (luvio.key):
28
+ id: urlParams.communityId
29
+ /communities:
30
+ get:
31
+ (luvio.adapter):
32
+ name: getCommunities