@salesforce/lds-adapters-revenue-place-quote 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, StoreKeyMap } from '@luvio/engine';
7
+ import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap } from '@luvio/engine';
8
8
 
9
9
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
10
  const { keys: ObjectKeys, create: ObjectCreate } = Object;
@@ -41,6 +41,24 @@ function untrustedIsObject(untrusted) {
41
41
  function areRequiredParametersPresent(config, configPropertyNames) {
42
42
  return configPropertyNames.parameters.required.every(req => req in config);
43
43
  }
44
+ function generateParamConfigMetadata(name, required, coerceFn) {
45
+ return {
46
+ name,
47
+ required,
48
+ coerceFn,
49
+ };
50
+ }
51
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
52
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
53
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
54
+ return {
55
+ displayName,
56
+ parameters: {
57
+ required,
58
+ optional,
59
+ }
60
+ };
61
+ }
44
62
  const keyPrefix = 'place-quote';
45
63
 
46
64
  const { isArray: ArrayIsArray } = Array;
@@ -174,26 +192,8 @@ const ingest = function PlaceQuoteOutputRepresentationIngest(input, path, luvio,
174
192
  }
175
193
  }
176
194
  const key = keyBuilderFromType(luvio, input);
177
- const existingRecord = store.readEntry(key);
178
195
  const ttlToUse = TTL;
179
- let incomingRecord = normalize(input, store.readEntry(key), {
180
- fullPath: key,
181
- parent: path.parent,
182
- propertyName: path.propertyName,
183
- ttl: ttlToUse
184
- });
185
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
186
- luvio.storePublish(key, incomingRecord);
187
- }
188
- {
189
- const storeMetadataParams = {
190
- ttl: ttlToUse,
191
- namespace: "place-quote",
192
- version: VERSION,
193
- representationName: RepresentationType,
194
- };
195
- luvio.publishStoreMetadata(key, storeMetadataParams);
196
- }
196
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "place-quote", VERSION, RepresentationType, equals);
197
197
  return createLink(key);
198
198
  };
199
199
  function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
@@ -243,13 +243,11 @@ function createResourceRequest(config) {
243
243
  };
244
244
  }
245
245
 
246
- const updateQuote_ConfigPropertyNames = {
247
- displayName: 'updateQuote',
248
- parameters: {
249
- required: ['PlaceQuoteInput'],
250
- optional: []
251
- }
252
- };
246
+ const adapterName = 'updateQuote';
247
+ const updateQuote_ConfigPropertyMetadata = [
248
+ generateParamConfigMetadata('PlaceQuoteInput', true),
249
+ ];
250
+ const updateQuote_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, updateQuote_ConfigPropertyMetadata);
253
251
  function createResourceParams(config) {
254
252
  const resourceParams = {
255
253
  body: {
@@ -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 = "place-quote";
@@ -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 { PlaceQuoteInputRepresentation as types_PlaceQuoteInputRepresentation_PlaceQuoteInputRepresentation } from '../types/PlaceQuoteInputRepresentation';
3
4
  import { ResourceRequestConfig as resources_postCommerceQuotesActionsPlace_ResourceRequestConfig } from '../resources/postCommerceQuotesActionsPlace';
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 { PlaceQuoteOutputRepresentation as types_PlaceQuoteOutputRepresentation_PlaceQuoteOutputRepresentation } from '../types/PlaceQuoteOutputRepresentation';
6
6
  export declare const adapterName = "updateQuote";
7
+ export declare const updateQuote_ConfigPropertyMetadata: $64$luvio_engine_AdapterConfigMetadata[];
7
8
  export declare const updateQuote_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
8
9
  export interface UpdateQuoteConfig {
9
10
  PlaceQuoteInput: types_PlaceQuoteInputRepresentation_PlaceQuoteInputRepresentation;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-revenue-place-quote",
3
- "version": "1.212.1",
3
+ "version": "1.213.1",
4
4
  "description": "Place Quote API for partial items and price/taxation updates async",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "dist/es/es2018/revenue-place-quote.js",
package/sfdc/index.js CHANGED
@@ -13,7 +13,7 @@
13
13
  */
14
14
  /* proxy-compat-disable */
15
15
  import { withDefaultLuvio } from 'force/ldsEngine';
16
- import { serializeStructuredKey, deepFreeze, StoreKeyMap } from 'force/luvioEngine';
16
+ import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap } from 'force/luvioEngine';
17
17
 
18
18
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
19
19
  const { keys: ObjectKeys, create: ObjectCreate } = Object;
@@ -50,6 +50,24 @@ function untrustedIsObject(untrusted) {
50
50
  function areRequiredParametersPresent(config, configPropertyNames) {
51
51
  return configPropertyNames.parameters.required.every(req => req in config);
52
52
  }
53
+ function generateParamConfigMetadata(name, required, coerceFn) {
54
+ return {
55
+ name,
56
+ required,
57
+ coerceFn,
58
+ };
59
+ }
60
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
61
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
62
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
63
+ return {
64
+ displayName,
65
+ parameters: {
66
+ required,
67
+ optional,
68
+ }
69
+ };
70
+ }
53
71
  const keyPrefix = 'place-quote';
54
72
 
55
73
  const { isArray: ArrayIsArray } = Array;
@@ -183,26 +201,8 @@ const ingest = function PlaceQuoteOutputRepresentationIngest(input, path, luvio,
183
201
  }
184
202
  }
185
203
  const key = keyBuilderFromType(luvio, input);
186
- const existingRecord = store.readEntry(key);
187
204
  const ttlToUse = TTL;
188
- let incomingRecord = normalize(input, store.readEntry(key), {
189
- fullPath: key,
190
- parent: path.parent,
191
- propertyName: path.propertyName,
192
- ttl: ttlToUse
193
- });
194
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
195
- luvio.storePublish(key, incomingRecord);
196
- }
197
- {
198
- const storeMetadataParams = {
199
- ttl: ttlToUse,
200
- namespace: "place-quote",
201
- version: VERSION,
202
- representationName: RepresentationType,
203
- };
204
- luvio.publishStoreMetadata(key, storeMetadataParams);
205
- }
205
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "place-quote", VERSION, RepresentationType, equals);
206
206
  return createLink(key);
207
207
  };
208
208
  function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
@@ -252,13 +252,11 @@ function createResourceRequest(config) {
252
252
  };
253
253
  }
254
254
 
255
- const updateQuote_ConfigPropertyNames = {
256
- displayName: 'updateQuote',
257
- parameters: {
258
- required: ['PlaceQuoteInput'],
259
- optional: []
260
- }
261
- };
255
+ const adapterName = 'updateQuote';
256
+ const updateQuote_ConfigPropertyMetadata = [
257
+ generateParamConfigMetadata('PlaceQuoteInput', true),
258
+ ];
259
+ const updateQuote_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, updateQuote_ConfigPropertyMetadata);
262
260
  function createResourceParams(config) {
263
261
  const resourceParams = {
264
262
  body: {
@@ -336,4 +334,4 @@ withDefaultLuvio((luvio) => {
336
334
  });
337
335
 
338
336
  export { updateQuote };
339
- // version: 1.212.1-49679d2a7
337
+ // version: 1.213.1-79de10fe1