@salesforce/lds-adapters-platform-lightning-cards 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, 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 = 'LightningCards';
52
70
 
53
71
  const { isArray: ArrayIsArray } = Array;
@@ -200,26 +218,8 @@ const ingest = function ActivationDataCollectionRepresentationIngest(input, path
200
218
  }
201
219
  }
202
220
  const key = path.fullPath;
203
- const existingRecord = store.readEntry(key);
204
221
  const ttlToUse = TTL;
205
- let incomingRecord = normalize(input, store.readEntry(key), {
206
- fullPath: key,
207
- parent: path.parent,
208
- propertyName: path.propertyName,
209
- ttl: ttlToUse
210
- });
211
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
212
- luvio.storePublish(key, incomingRecord);
213
- }
214
- {
215
- const storeMetadataParams = {
216
- ttl: ttlToUse,
217
- namespace: "LightningCards",
218
- version: VERSION,
219
- representationName: RepresentationType,
220
- };
221
- luvio.publishStoreMetadata(key, storeMetadataParams);
222
- }
222
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "LightningCards", VERSION, RepresentationType, equals);
223
223
  return createLink(key);
224
224
  };
225
225
  function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
@@ -284,13 +284,11 @@ function createResourceRequest(config) {
284
284
  };
285
285
  }
286
286
 
287
- const getActivationData_ConfigPropertyNames = {
288
- displayName: 'getActivationData',
289
- parameters: {
290
- required: ['flexiPageId'],
291
- optional: []
292
- }
293
- };
287
+ const adapterName = 'getActivationData';
288
+ const getActivationData_ConfigPropertyMetadata = [
289
+ generateParamConfigMetadata('flexiPageId', true),
290
+ ];
291
+ const getActivationData_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getActivationData_ConfigPropertyMetadata);
294
292
  function createResourceParams(config) {
295
293
  const resourceParams = {
296
294
  urlParams: {
@@ -356,21 +354,7 @@ function buildNetworkSnapshot(luvio, config, options) {
356
354
  });
357
355
  }
358
356
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
359
- const { luvio, config } = context;
360
- const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
361
- const dispatchOptions = {
362
- resourceRequestContext: {
363
- requestCorrelator,
364
- luvioRequestMethod: undefined,
365
- },
366
- eventObservers
367
- };
368
- if (networkPriority !== 'normal') {
369
- dispatchOptions.overrides = {
370
- priority: networkPriority
371
- };
372
- }
373
- return buildNetworkSnapshot(luvio, config, dispatchOptions);
357
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
374
358
  }
375
359
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
376
360
  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 = "LightningCards";
@@ -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_getConnectLightningcardsActivationdataByFlexiPageId_ResourceRequestConfig } from '../resources/getConnectLightningcardsActivationdataByFlexiPageId';
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 { ActivationDataCollectionRepresentation as types_ActivationDataCollectionRepresentation_ActivationDataCollectionRepresentation } from '../types/ActivationDataCollectionRepresentation';
5
5
  export declare const adapterName = "getActivationData";
6
+ export declare const getActivationData_ConfigPropertyMetadata: $64$luvio_engine_AdapterConfigMetadata[];
6
7
  export declare const getActivationData_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
7
8
  export interface GetActivationDataConfig {
8
9
  flexiPageId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-platform-lightning-cards",
3
- "version": "1.213.0",
3
+ "version": "1.213.1",
4
4
  "description": "Card Builder Connect API Family",
5
5
  "license": "MIT",
6
6
  "main": "dist/es/es2018/platform-lightning-cards.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 = 'LightningCards';
62
80
 
63
81
  const { isArray: ArrayIsArray } = Array;
@@ -210,26 +228,8 @@ const ingest = function ActivationDataCollectionRepresentationIngest(input, path
210
228
  }
211
229
  }
212
230
  const key = path.fullPath;
213
- const existingRecord = store.readEntry(key);
214
231
  const ttlToUse = TTL;
215
- let incomingRecord = normalize(input, store.readEntry(key), {
216
- fullPath: key,
217
- parent: path.parent,
218
- propertyName: path.propertyName,
219
- ttl: ttlToUse
220
- });
221
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
222
- luvio.storePublish(key, incomingRecord);
223
- }
224
- {
225
- const storeMetadataParams = {
226
- ttl: ttlToUse,
227
- namespace: "LightningCards",
228
- version: VERSION,
229
- representationName: RepresentationType,
230
- };
231
- luvio.publishStoreMetadata(key, storeMetadataParams);
232
- }
232
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "LightningCards", VERSION, RepresentationType, equals);
233
233
  return createLink(key);
234
234
  };
235
235
  function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
@@ -294,13 +294,11 @@ function createResourceRequest(config) {
294
294
  };
295
295
  }
296
296
 
297
- const getActivationData_ConfigPropertyNames = {
298
- displayName: 'getActivationData',
299
- parameters: {
300
- required: ['flexiPageId'],
301
- optional: []
302
- }
303
- };
297
+ const adapterName = 'getActivationData';
298
+ const getActivationData_ConfigPropertyMetadata = [
299
+ generateParamConfigMetadata('flexiPageId', true),
300
+ ];
301
+ const getActivationData_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getActivationData_ConfigPropertyMetadata);
304
302
  function createResourceParams(config) {
305
303
  const resourceParams = {
306
304
  urlParams: {
@@ -366,21 +364,7 @@ function buildNetworkSnapshot(luvio, config, options) {
366
364
  });
367
365
  }
368
366
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
369
- const { luvio, config } = context;
370
- const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
371
- const dispatchOptions = {
372
- resourceRequestContext: {
373
- requestCorrelator,
374
- luvioRequestMethod: undefined,
375
- },
376
- eventObservers
377
- };
378
- if (networkPriority !== 'normal') {
379
- dispatchOptions.overrides = {
380
- priority: networkPriority
381
- };
382
- }
383
- return buildNetworkSnapshot(luvio, config, dispatchOptions);
367
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
384
368
  }
385
369
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
386
370
  const { luvio, config } = context;
@@ -427,4 +411,4 @@ withDefaultLuvio((luvio) => {
427
411
  });
428
412
 
429
413
  export { getActivationData, getActivationData_imperative };
430
- // version: 1.213.0-951602080
414
+ // version: 1.213.1-79de10fe1