@salesforce/lds-adapters-community-seo 1.213.0 → 1.213.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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$1, create: ObjectCreate$1 } = 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 = 'CommunitiesSeo';
52
70
 
53
71
  const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
@@ -124,26 +142,8 @@ const ingest = function RecordSeoPropertiesRepresentationIngest(input, path, luv
124
142
  }
125
143
  }
126
144
  const key = path.fullPath;
127
- const existingRecord = store.readEntry(key);
128
145
  const ttlToUse = TTL;
129
- let incomingRecord = normalize(input, store.readEntry(key), {
130
- fullPath: key,
131
- parent: path.parent,
132
- propertyName: path.propertyName,
133
- ttl: ttlToUse
134
- });
135
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
136
- luvio.storePublish(key, incomingRecord);
137
- }
138
- {
139
- const storeMetadataParams = {
140
- ttl: ttlToUse,
141
- namespace: "CommunitiesSeo",
142
- version: VERSION,
143
- representationName: RepresentationType,
144
- };
145
- luvio.publishStoreMetadata(key, storeMetadataParams);
146
- }
146
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "CommunitiesSeo", VERSION, RepresentationType, equals);
147
147
  return createLink(key);
148
148
  };
149
149
  function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
@@ -208,13 +208,13 @@ function createResourceRequest(config) {
208
208
  };
209
209
  }
210
210
 
211
- const getRecordSeoProperties_ConfigPropertyNames = {
212
- displayName: 'getRecordSeoProperties',
213
- parameters: {
214
- required: ['communityId', 'recordId'],
215
- optional: ['fields']
216
- }
217
- };
211
+ const adapterName = 'getRecordSeoProperties';
212
+ const getRecordSeoProperties_ConfigPropertyMetadata = [
213
+ generateParamConfigMetadata('communityId', true),
214
+ generateParamConfigMetadata('recordId', true),
215
+ generateParamConfigMetadata('fields', false),
216
+ ];
217
+ const getRecordSeoProperties_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getRecordSeoProperties_ConfigPropertyMetadata);
218
218
  function createResourceParams(config) {
219
219
  const resourceParams = {
220
220
  urlParams: {
@@ -285,21 +285,7 @@ function buildNetworkSnapshot(luvio, config, options) {
285
285
  });
286
286
  }
287
287
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
288
- const { luvio, config } = context;
289
- const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
290
- const dispatchOptions = {
291
- resourceRequestContext: {
292
- requestCorrelator,
293
- luvioRequestMethod: undefined,
294
- },
295
- eventObservers
296
- };
297
- if (networkPriority !== 'normal') {
298
- dispatchOptions.overrides = {
299
- priority: networkPriority
300
- };
301
- }
302
- return buildNetworkSnapshot(luvio, config, dispatchOptions);
288
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
303
289
  }
304
290
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
305
291
  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 = "CommunitiesSeo";
@@ -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_getConnectCommunitiesSeoPropertiesByCommunityIdAndRecordId_ResourceRequestConfig } from '../resources/getConnectCommunitiesSeoPropertiesByCommunityIdAndRecordId';
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 { RecordSeoPropertiesRepresentation as types_RecordSeoPropertiesRepresentation_RecordSeoPropertiesRepresentation } from '../types/RecordSeoPropertiesRepresentation';
5
5
  export declare const adapterName = "getRecordSeoProperties";
6
+ export declare const getRecordSeoProperties_ConfigPropertyMetadata: $64$luvio_engine_AdapterConfigMetadata[];
6
7
  export declare const getRecordSeoProperties_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
7
8
  export interface GetRecordSeoPropertiesConfig {
8
9
  communityId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-community-seo",
3
- "version": "1.213.0",
3
+ "version": "1.213.2",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "APIs for various SEO features in experiences",
6
6
  "main": "dist/es/es2018/community-seo.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$1, create: ObjectCreate$1 } = 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 = 'CommunitiesSeo';
62
80
 
63
81
  const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
@@ -134,26 +152,8 @@ const ingest = function RecordSeoPropertiesRepresentationIngest(input, path, luv
134
152
  }
135
153
  }
136
154
  const key = path.fullPath;
137
- const existingRecord = store.readEntry(key);
138
155
  const ttlToUse = TTL;
139
- let incomingRecord = normalize(input, store.readEntry(key), {
140
- fullPath: key,
141
- parent: path.parent,
142
- propertyName: path.propertyName,
143
- ttl: ttlToUse
144
- });
145
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
146
- luvio.storePublish(key, incomingRecord);
147
- }
148
- {
149
- const storeMetadataParams = {
150
- ttl: ttlToUse,
151
- namespace: "CommunitiesSeo",
152
- version: VERSION,
153
- representationName: RepresentationType,
154
- };
155
- luvio.publishStoreMetadata(key, storeMetadataParams);
156
- }
156
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "CommunitiesSeo", VERSION, RepresentationType, equals);
157
157
  return createLink(key);
158
158
  };
159
159
  function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
@@ -218,13 +218,13 @@ function createResourceRequest(config) {
218
218
  };
219
219
  }
220
220
 
221
- const getRecordSeoProperties_ConfigPropertyNames = {
222
- displayName: 'getRecordSeoProperties',
223
- parameters: {
224
- required: ['communityId', 'recordId'],
225
- optional: ['fields']
226
- }
227
- };
221
+ const adapterName = 'getRecordSeoProperties';
222
+ const getRecordSeoProperties_ConfigPropertyMetadata = [
223
+ generateParamConfigMetadata('communityId', true),
224
+ generateParamConfigMetadata('recordId', true),
225
+ generateParamConfigMetadata('fields', false),
226
+ ];
227
+ const getRecordSeoProperties_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getRecordSeoProperties_ConfigPropertyMetadata);
228
228
  function createResourceParams(config) {
229
229
  const resourceParams = {
230
230
  urlParams: {
@@ -295,21 +295,7 @@ function buildNetworkSnapshot(luvio, config, options) {
295
295
  });
296
296
  }
297
297
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
298
- const { luvio, config } = context;
299
- const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
300
- const dispatchOptions = {
301
- resourceRequestContext: {
302
- requestCorrelator,
303
- luvioRequestMethod: undefined,
304
- },
305
- eventObservers
306
- };
307
- if (networkPriority !== 'normal') {
308
- dispatchOptions.overrides = {
309
- priority: networkPriority
310
- };
311
- }
312
- return buildNetworkSnapshot(luvio, config, dispatchOptions);
298
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
313
299
  }
314
300
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
315
301
  const { luvio, config } = context;
@@ -356,4 +342,4 @@ withDefaultLuvio((luvio) => {
356
342
  });
357
343
 
358
344
  export { getRecordSeoProperties, getRecordSeoProperties_imperative };
359
- // version: 1.213.0-951602080
345
+ // version: 1.213.2-1eb996209