@salesforce/lds-adapters-experience-marketing-integration 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, StoreKeyMap, typeCheckScalars } from '@luvio/engine';
7
+ import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, typeCheckScalars, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1 } 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 = 'marketing-integration';
52
70
 
53
71
  const { isArray: ArrayIsArray } = Array;
@@ -348,26 +366,8 @@ const ingest$1 = function FormRepresentationIngest(input, path, luvio, store, ti
348
366
  }
349
367
  }
350
368
  const key = keyBuilderFromType$1(luvio, input);
351
- const existingRecord = store.readEntry(key);
352
369
  const ttlToUse = TTL$1;
353
- let incomingRecord = normalize$1(input, store.readEntry(key), {
354
- fullPath: key,
355
- parent: path.parent,
356
- propertyName: path.propertyName,
357
- ttl: ttlToUse
358
- });
359
- if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
360
- luvio.storePublish(key, incomingRecord);
361
- }
362
- {
363
- const storeMetadataParams = {
364
- ttl: ttlToUse,
365
- namespace: "marketing-integration",
366
- version: VERSION$1,
367
- representationName: RepresentationType$1,
368
- };
369
- luvio.publishStoreMetadata(key, storeMetadataParams);
370
- }
370
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "marketing-integration", VERSION$1, RepresentationType$1, equals$1);
371
371
  return createLink(key);
372
372
  };
373
373
  function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
@@ -417,13 +417,12 @@ function createResourceRequest$2(config) {
417
417
  };
418
418
  }
419
419
 
420
- const saveForm_ConfigPropertyNames = {
421
- displayName: 'saveForm',
422
- parameters: {
423
- required: ['siteId', 'formInput'],
424
- optional: []
425
- }
426
- };
420
+ const adapterName$2 = 'saveForm';
421
+ const saveForm_ConfigPropertyMetadata = [
422
+ generateParamConfigMetadata('siteId', true),
423
+ generateParamConfigMetadata('formInput', true),
424
+ ];
425
+ const saveForm_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, saveForm_ConfigPropertyMetadata);
427
426
  function createResourceParams$2(config) {
428
427
  const resourceParams = {
429
428
  urlParams: {
@@ -543,13 +542,12 @@ function createResourceRequest$1(config) {
543
542
  };
544
543
  }
545
544
 
546
- const getForm_ConfigPropertyNames = {
547
- displayName: 'getForm',
548
- parameters: {
549
- required: ['formId', 'siteId'],
550
- optional: []
551
- }
552
- };
545
+ const adapterName$1 = 'getForm';
546
+ const getForm_ConfigPropertyMetadata = [
547
+ generateParamConfigMetadata('formId', true),
548
+ generateParamConfigMetadata('siteId', true),
549
+ ];
550
+ const getForm_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getForm_ConfigPropertyMetadata);
553
551
  function createResourceParams$1(config) {
554
552
  const resourceParams = {
555
553
  urlParams: {
@@ -616,21 +614,7 @@ function buildNetworkSnapshot$1(luvio, config, options) {
616
614
  });
617
615
  }
618
616
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
619
- const { luvio, config } = context;
620
- const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
621
- const dispatchOptions = {
622
- resourceRequestContext: {
623
- requestCorrelator,
624
- luvioRequestMethod: undefined,
625
- },
626
- eventObservers
627
- };
628
- if (networkPriority !== 'normal') {
629
- dispatchOptions.overrides = {
630
- priority: networkPriority
631
- };
632
- }
633
- return buildNetworkSnapshot$1(luvio, config, dispatchOptions);
617
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
634
618
  }
635
619
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
636
620
  const { luvio, config } = context;
@@ -772,26 +756,8 @@ const ingest = function FormSubmissionRepresentationIngest(input, path, luvio, s
772
756
  }
773
757
  }
774
758
  const key = keyBuilderFromType(luvio, input);
775
- const existingRecord = store.readEntry(key);
776
759
  const ttlToUse = TTL;
777
- let incomingRecord = normalize(input, store.readEntry(key), {
778
- fullPath: key,
779
- parent: path.parent,
780
- propertyName: path.propertyName,
781
- ttl: ttlToUse
782
- });
783
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
784
- luvio.storePublish(key, incomingRecord);
785
- }
786
- {
787
- const storeMetadataParams = {
788
- ttl: ttlToUse,
789
- namespace: "marketing-integration",
790
- version: VERSION,
791
- representationName: RepresentationType,
792
- };
793
- luvio.publishStoreMetadata(key, storeMetadataParams);
794
- }
760
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "marketing-integration", VERSION, RepresentationType, equals);
795
761
  return createLink(key);
796
762
  };
797
763
  function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
@@ -841,13 +807,13 @@ function createResourceRequest(config) {
841
807
  };
842
808
  }
843
809
 
844
- const submitForm_ConfigPropertyNames = {
845
- displayName: 'submitForm',
846
- parameters: {
847
- required: ['formId', 'siteId', 'formSubmissionInput'],
848
- optional: []
849
- }
850
- };
810
+ const adapterName = 'submitForm';
811
+ const submitForm_ConfigPropertyMetadata = [
812
+ generateParamConfigMetadata('formId', true),
813
+ generateParamConfigMetadata('siteId', true),
814
+ generateParamConfigMetadata('formSubmissionInput', true),
815
+ ];
816
+ const submitForm_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, submitForm_ConfigPropertyMetadata);
851
817
  function createResourceParams(config) {
852
818
  const resourceParams = {
853
819
  urlParams: {
@@ -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 = "marketing-integration";
@@ -1,8 +1,9 @@
1
- import { AdapterValidationConfig as adapter$45$utils_AdapterValidationConfig, Untrusted as adapter$45$utils_Untrusted, UncoercedConfiguration as adapter$45$utils_UncoercedConfiguration } 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, UncoercedConfiguration as adapter$45$utils_UncoercedConfiguration } from './adapter-utils';
2
3
  import { ResourceRequestConfig as resources_getSitesMarketingIntegrationFormsByFormIdAndSiteId_ResourceRequestConfig } from '../resources/getSitesMarketingIntegrationFormsByFormIdAndSiteId';
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 { FormRepresentation as types_FormRepresentation_FormRepresentation, KeyParams as types_FormRepresentation_KeyParams } from '../types/FormRepresentation';
5
5
  export declare const adapterName = "getForm";
6
+ export declare const getForm_ConfigPropertyMetadata: $64$luvio_engine_AdapterConfigMetadata[];
6
7
  export declare const getForm_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
7
8
  export interface GetFormConfig {
8
9
  formId: string;
@@ -1,9 +1,10 @@
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, DispatchResourceRequestContext as $64$luvio_engine_DispatchResourceRequestContext, 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 { FormInputRepresentation as types_FormInputRepresentation_FormInputRepresentation } from '../types/FormInputRepresentation';
3
4
  import { ResourceRequestConfig as resources_postSitesMarketingIntegrationFormsBySiteId_ResourceRequestConfig } from '../resources/postSitesMarketingIntegrationFormsBySiteId';
4
- import { Luvio as $64$luvio_engine_Luvio, DispatchResourceRequestContext as $64$luvio_engine_DispatchResourceRequestContext, AdapterFactory as $64$luvio_engine_AdapterFactory } from '@luvio/engine';
5
5
  import { FormRepresentation as types_FormRepresentation_FormRepresentation } from '../types/FormRepresentation';
6
6
  export declare const adapterName = "saveForm";
7
+ export declare const saveForm_ConfigPropertyMetadata: $64$luvio_engine_AdapterConfigMetadata[];
7
8
  export declare const saveForm_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
8
9
  export interface SaveFormConfig {
9
10
  siteId: string;
@@ -1,9 +1,10 @@
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, DispatchResourceRequestContext as $64$luvio_engine_DispatchResourceRequestContext, 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 { FormSubmissionInputRepresentation as types_FormSubmissionInputRepresentation_FormSubmissionInputRepresentation } from '../types/FormSubmissionInputRepresentation';
3
4
  import { ResourceRequestConfig as resources_postSitesMarketingIntegrationFormsDataByFormIdAndSiteId_ResourceRequestConfig } from '../resources/postSitesMarketingIntegrationFormsDataByFormIdAndSiteId';
4
- import { Luvio as $64$luvio_engine_Luvio, DispatchResourceRequestContext as $64$luvio_engine_DispatchResourceRequestContext, AdapterFactory as $64$luvio_engine_AdapterFactory } from '@luvio/engine';
5
5
  import { FormSubmissionRepresentation as types_FormSubmissionRepresentation_FormSubmissionRepresentation } from '../types/FormSubmissionRepresentation';
6
6
  export declare const adapterName = "submitForm";
7
+ export declare const submitForm_ConfigPropertyMetadata: $64$luvio_engine_AdapterConfigMetadata[];
7
8
  export declare const submitForm_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
8
9
  export interface SubmitFormConfig {
9
10
  formId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-experience-marketing-integration",
3
- "version": "1.213.0",
3
+ "version": "1.213.2",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "With this API, you can CRUD data in Marketing Cloud's storage, Data Extensions.",
6
6
  "main": "dist/es/es2018/experience-marketing-integration.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, StoreKeyMap, typeCheckScalars } from 'force/luvioEngine';
17
+ import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, typeCheckScalars } 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 = 'marketing-integration';
62
80
 
63
81
  const { isArray: ArrayIsArray } = Array;
@@ -288,26 +306,8 @@ const ingest$1 = function FormRepresentationIngest(input, path, luvio, store, ti
288
306
  }
289
307
  }
290
308
  const key = keyBuilderFromType$1(luvio, input);
291
- const existingRecord = store.readEntry(key);
292
309
  const ttlToUse = TTL$1;
293
- let incomingRecord = normalize$1(input, store.readEntry(key), {
294
- fullPath: key,
295
- parent: path.parent,
296
- propertyName: path.propertyName,
297
- ttl: ttlToUse
298
- });
299
- if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
300
- luvio.storePublish(key, incomingRecord);
301
- }
302
- {
303
- const storeMetadataParams = {
304
- ttl: ttlToUse,
305
- namespace: "marketing-integration",
306
- version: VERSION$1,
307
- representationName: RepresentationType$1,
308
- };
309
- luvio.publishStoreMetadata(key, storeMetadataParams);
310
- }
310
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "marketing-integration", VERSION$1, RepresentationType$1, equals$1);
311
311
  return createLink(key);
312
312
  };
313
313
  function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
@@ -381,13 +381,12 @@ function createResourceRequestFromRepresentation(representation) {
381
381
  return createResourceRequest$2(config);
382
382
  }
383
383
 
384
- const getForm_ConfigPropertyNames = {
385
- displayName: 'getForm',
386
- parameters: {
387
- required: ['formId', 'siteId'],
388
- optional: []
389
- }
390
- };
384
+ const adapterName$2 = 'getForm';
385
+ const getForm_ConfigPropertyMetadata = [
386
+ generateParamConfigMetadata('formId', true),
387
+ generateParamConfigMetadata('siteId', true),
388
+ ];
389
+ const getForm_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getForm_ConfigPropertyMetadata);
391
390
  function createResourceParams$2(config) {
392
391
  const resourceParams = {
393
392
  urlParams: {
@@ -454,21 +453,7 @@ function buildNetworkSnapshot$2(luvio, config, options) {
454
453
  });
455
454
  }
456
455
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
457
- const { luvio, config } = context;
458
- const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
459
- const dispatchOptions = {
460
- resourceRequestContext: {
461
- requestCorrelator,
462
- luvioRequestMethod: undefined,
463
- },
464
- eventObservers
465
- };
466
- if (networkPriority !== 'normal') {
467
- dispatchOptions.overrides = {
468
- priority: networkPriority
469
- };
470
- }
471
- return buildNetworkSnapshot$2(luvio, config, dispatchOptions);
456
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
472
457
  }
473
458
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
474
459
  const { luvio, config } = context;
@@ -634,13 +619,12 @@ function createResourceRequest$1(config) {
634
619
  };
635
620
  }
636
621
 
637
- const saveForm_ConfigPropertyNames = {
638
- displayName: 'saveForm',
639
- parameters: {
640
- required: ['siteId', 'formInput'],
641
- optional: []
642
- }
643
- };
622
+ const adapterName$1 = 'saveForm';
623
+ const saveForm_ConfigPropertyMetadata = [
624
+ generateParamConfigMetadata('siteId', true),
625
+ generateParamConfigMetadata('formInput', true),
626
+ ];
627
+ const saveForm_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, saveForm_ConfigPropertyMetadata);
644
628
  function createResourceParams$1(config) {
645
629
  const resourceParams = {
646
630
  urlParams: {
@@ -823,26 +807,8 @@ const ingest = function FormSubmissionRepresentationIngest(input, path, luvio, s
823
807
  }
824
808
  }
825
809
  const key = keyBuilderFromType(luvio, input);
826
- const existingRecord = store.readEntry(key);
827
810
  const ttlToUse = TTL;
828
- let incomingRecord = normalize(input, store.readEntry(key), {
829
- fullPath: key,
830
- parent: path.parent,
831
- propertyName: path.propertyName,
832
- ttl: ttlToUse
833
- });
834
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
835
- luvio.storePublish(key, incomingRecord);
836
- }
837
- {
838
- const storeMetadataParams = {
839
- ttl: ttlToUse,
840
- namespace: "marketing-integration",
841
- version: VERSION,
842
- representationName: RepresentationType,
843
- };
844
- luvio.publishStoreMetadata(key, storeMetadataParams);
845
- }
811
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "marketing-integration", VERSION, RepresentationType, equals);
846
812
  return createLink(key);
847
813
  };
848
814
  function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
@@ -892,13 +858,13 @@ function createResourceRequest(config) {
892
858
  };
893
859
  }
894
860
 
895
- const submitForm_ConfigPropertyNames = {
896
- displayName: 'submitForm',
897
- parameters: {
898
- required: ['formId', 'siteId', 'formSubmissionInput'],
899
- optional: []
900
- }
901
- };
861
+ const adapterName = 'submitForm';
862
+ const submitForm_ConfigPropertyMetadata = [
863
+ generateParamConfigMetadata('formId', true),
864
+ generateParamConfigMetadata('siteId', true),
865
+ generateParamConfigMetadata('formSubmissionInput', true),
866
+ ];
867
+ const submitForm_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, submitForm_ConfigPropertyMetadata);
902
868
  function createResourceParams(config) {
903
869
  const resourceParams = {
904
870
  urlParams: {
@@ -1000,4 +966,4 @@ withDefaultLuvio((luvio) => {
1000
966
  });
1001
967
 
1002
968
  export { getForm, getFormNotifyChange, getForm_imperative, saveForm, submitForm };
1003
- // version: 1.213.0-951602080
969
+ // version: 1.213.2-1eb996209