@salesforce/lds-adapters-analytics-smart-data-discovery 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, typeCheckArrayOfScalars, StoreKeyMap } from '@luvio/engine';
7
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, typeCheckScalars, typeCheckArrayOfScalars, 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 = 'smart-data-discovery';
52
70
 
53
71
  const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
@@ -576,26 +594,8 @@ const ingest$1 = function StoryRepresentationIngest(input, path, luvio, store, t
576
594
  }
577
595
  }
578
596
  const key = path.fullPath;
579
- const existingRecord = store.readEntry(key);
580
597
  const ttlToUse = path.ttl;
581
- let incomingRecord = normalize$1(input, store.readEntry(key), {
582
- fullPath: key,
583
- parent: path.parent,
584
- propertyName: path.propertyName,
585
- ttl: ttlToUse
586
- });
587
- if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
588
- luvio.storePublish(key, incomingRecord);
589
- }
590
- if (ttlToUse !== undefined) {
591
- const storeMetadataParams = {
592
- ttl: ttlToUse,
593
- namespace: "smart-data-discovery",
594
- version: VERSION$1,
595
- representationName: RepresentationType$1,
596
- };
597
- luvio.publishStoreMetadata(key, storeMetadataParams);
598
- }
598
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "smart-data-discovery", VERSION$1, RepresentationType$1, equals$1);
599
599
  return createLink(key);
600
600
  };
601
601
  function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
@@ -663,7 +663,7 @@ function normalize(input, existing, path, luvio, store, timestamp) {
663
663
  existing: existing,
664
664
  },
665
665
  ttl: path.ttl
666
- }, luvio, store);
666
+ }, luvio, store, timestamp);
667
667
  }
668
668
  return input;
669
669
  }
@@ -739,26 +739,8 @@ const ingest = function StoryCollectionRepresentationIngest(input, path, luvio,
739
739
  }
740
740
  }
741
741
  const key = path.fullPath;
742
- const existingRecord = store.readEntry(key);
743
742
  const ttlToUse = TTL;
744
- let incomingRecord = normalize(input, store.readEntry(key), {
745
- fullPath: key,
746
- parent: path.parent,
747
- propertyName: path.propertyName,
748
- ttl: ttlToUse
749
- }, luvio, store);
750
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
751
- luvio.storePublish(key, incomingRecord);
752
- }
753
- {
754
- const storeMetadataParams = {
755
- ttl: ttlToUse,
756
- namespace: "smart-data-discovery",
757
- version: VERSION,
758
- representationName: RepresentationType,
759
- };
760
- luvio.publishStoreMetadata(key, storeMetadataParams);
761
- }
743
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "smart-data-discovery", VERSION, RepresentationType, equals);
762
744
  return createLink(key);
763
745
  };
764
746
  function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
@@ -827,13 +809,18 @@ function createResourceRequest(config) {
827
809
  };
828
810
  }
829
811
 
830
- const getStories_ConfigPropertyNames = {
831
- displayName: 'getStories',
832
- parameters: {
833
- required: [],
834
- optional: ['folderId', 'inputId', 'page', 'pageSize', 'q', 'scope', 'sourceType', 'sourceTypes']
835
- }
836
- };
812
+ const adapterName = 'getStories';
813
+ const getStories_ConfigPropertyMetadata = [
814
+ generateParamConfigMetadata('folderId', false),
815
+ generateParamConfigMetadata('inputId', false),
816
+ generateParamConfigMetadata('page', false),
817
+ generateParamConfigMetadata('pageSize', false),
818
+ generateParamConfigMetadata('q', false),
819
+ generateParamConfigMetadata('scope', false),
820
+ generateParamConfigMetadata('sourceType', false),
821
+ generateParamConfigMetadata('sourceTypes', false),
822
+ ];
823
+ const getStories_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getStories_ConfigPropertyMetadata);
837
824
  function createResourceParams(config) {
838
825
  const resourceParams = {
839
826
  queryParams: {
@@ -908,21 +895,7 @@ function buildNetworkSnapshot(luvio, config, options) {
908
895
  });
909
896
  }
910
897
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
911
- const { luvio, config } = context;
912
- const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
913
- const dispatchOptions = {
914
- resourceRequestContext: {
915
- requestCorrelator,
916
- luvioRequestMethod: undefined,
917
- },
918
- eventObservers
919
- };
920
- if (networkPriority !== 'normal') {
921
- dispatchOptions.overrides = {
922
- priority: networkPriority
923
- };
924
- }
925
- return buildNetworkSnapshot(luvio, config, dispatchOptions);
898
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
926
899
  }
927
900
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
928
901
  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 = "smart-data-discovery";
@@ -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_getSmartdatadiscoveryStories_ResourceRequestConfig } from '../resources/getSmartdatadiscoveryStories';
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 { StoryCollectionRepresentation as types_StoryCollectionRepresentation_StoryCollectionRepresentation } from '../types/StoryCollectionRepresentation';
5
5
  export declare const adapterName = "getStories";
6
+ export declare const getStories_ConfigPropertyMetadata: $64$luvio_engine_AdapterConfigMetadata[];
6
7
  export declare const getStories_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
7
8
  export interface GetStoriesConfig {
8
9
  folderId?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-analytics-smart-data-discovery",
3
- "version": "1.212.1",
3
+ "version": "1.213.1",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "The Einstein Discovery family of APIs",
6
6
  "main": "dist/es/es2018/analytics-smart-data-discovery.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, typeCheckArrayOfScalars, StoreKeyMap } from 'force/luvioEngine';
17
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, typeCheckScalars, typeCheckArrayOfScalars, 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 = 'smart-data-discovery';
62
80
 
63
81
  const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
@@ -586,26 +604,8 @@ const ingest$1 = function StoryRepresentationIngest(input, path, luvio, store, t
586
604
  }
587
605
  }
588
606
  const key = path.fullPath;
589
- const existingRecord = store.readEntry(key);
590
607
  const ttlToUse = path.ttl;
591
- let incomingRecord = normalize$1(input, store.readEntry(key), {
592
- fullPath: key,
593
- parent: path.parent,
594
- propertyName: path.propertyName,
595
- ttl: ttlToUse
596
- });
597
- if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
598
- luvio.storePublish(key, incomingRecord);
599
- }
600
- if (ttlToUse !== undefined) {
601
- const storeMetadataParams = {
602
- ttl: ttlToUse,
603
- namespace: "smart-data-discovery",
604
- version: VERSION$1,
605
- representationName: RepresentationType$1,
606
- };
607
- luvio.publishStoreMetadata(key, storeMetadataParams);
608
- }
608
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "smart-data-discovery", VERSION$1, RepresentationType$1, equals$1);
609
609
  return createLink(key);
610
610
  };
611
611
  function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
@@ -673,7 +673,7 @@ function normalize(input, existing, path, luvio, store, timestamp) {
673
673
  existing: existing,
674
674
  },
675
675
  ttl: path.ttl
676
- }, luvio, store);
676
+ }, luvio, store, timestamp);
677
677
  }
678
678
  return input;
679
679
  }
@@ -749,26 +749,8 @@ const ingest = function StoryCollectionRepresentationIngest(input, path, luvio,
749
749
  }
750
750
  }
751
751
  const key = path.fullPath;
752
- const existingRecord = store.readEntry(key);
753
752
  const ttlToUse = TTL;
754
- let incomingRecord = normalize(input, store.readEntry(key), {
755
- fullPath: key,
756
- parent: path.parent,
757
- propertyName: path.propertyName,
758
- ttl: ttlToUse
759
- }, luvio, store);
760
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
761
- luvio.storePublish(key, incomingRecord);
762
- }
763
- {
764
- const storeMetadataParams = {
765
- ttl: ttlToUse,
766
- namespace: "smart-data-discovery",
767
- version: VERSION,
768
- representationName: RepresentationType,
769
- };
770
- luvio.publishStoreMetadata(key, storeMetadataParams);
771
- }
753
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "smart-data-discovery", VERSION, RepresentationType, equals);
772
754
  return createLink(key);
773
755
  };
774
756
  function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
@@ -837,13 +819,18 @@ function createResourceRequest(config) {
837
819
  };
838
820
  }
839
821
 
840
- const getStories_ConfigPropertyNames = {
841
- displayName: 'getStories',
842
- parameters: {
843
- required: [],
844
- optional: ['folderId', 'inputId', 'page', 'pageSize', 'q', 'scope', 'sourceType', 'sourceTypes']
845
- }
846
- };
822
+ const adapterName = 'getStories';
823
+ const getStories_ConfigPropertyMetadata = [
824
+ generateParamConfigMetadata('folderId', false),
825
+ generateParamConfigMetadata('inputId', false),
826
+ generateParamConfigMetadata('page', false),
827
+ generateParamConfigMetadata('pageSize', false),
828
+ generateParamConfigMetadata('q', false),
829
+ generateParamConfigMetadata('scope', false),
830
+ generateParamConfigMetadata('sourceType', false),
831
+ generateParamConfigMetadata('sourceTypes', false),
832
+ ];
833
+ const getStories_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getStories_ConfigPropertyMetadata);
847
834
  function createResourceParams(config) {
848
835
  const resourceParams = {
849
836
  queryParams: {
@@ -918,21 +905,7 @@ function buildNetworkSnapshot(luvio, config, options) {
918
905
  });
919
906
  }
920
907
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
921
- const { luvio, config } = context;
922
- const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
923
- const dispatchOptions = {
924
- resourceRequestContext: {
925
- requestCorrelator,
926
- luvioRequestMethod: undefined,
927
- },
928
- eventObservers
929
- };
930
- if (networkPriority !== 'normal') {
931
- dispatchOptions.overrides = {
932
- priority: networkPriority
933
- };
934
- }
935
- return buildNetworkSnapshot(luvio, config, dispatchOptions);
908
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
936
909
  }
937
910
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
938
911
  const { luvio, config } = context;
@@ -979,4 +952,4 @@ withDefaultLuvio((luvio) => {
979
952
  });
980
953
 
981
954
  export { getStories, getStories_imperative };
982
- // version: 1.212.1-49679d2a7
955
+ // version: 1.213.1-79de10fe1