@salesforce/lds-adapters-industries-tearsheet 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, 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 = 'tearsheet';
52
70
 
53
71
  const { isArray: ArrayIsArray } = Array;
@@ -128,26 +146,8 @@ const ingest = function TearsheetListRepresentationIngest(input, path, luvio, st
128
146
  }
129
147
  }
130
148
  const key = path.fullPath;
131
- const existingRecord = store.readEntry(key);
132
149
  const ttlToUse = TTL;
133
- let incomingRecord = normalize(input, store.readEntry(key), {
134
- fullPath: key,
135
- parent: path.parent,
136
- propertyName: path.propertyName,
137
- ttl: ttlToUse
138
- });
139
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
140
- luvio.storePublish(key, incomingRecord);
141
- }
142
- {
143
- const storeMetadataParams = {
144
- ttl: ttlToUse,
145
- namespace: "tearsheet",
146
- version: VERSION,
147
- representationName: RepresentationType,
148
- };
149
- luvio.publishStoreMetadata(key, storeMetadataParams);
150
- }
150
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "tearsheet", VERSION, RepresentationType, equals);
151
151
  return createLink(key);
152
152
  };
153
153
  function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
@@ -212,13 +212,14 @@ function createResourceRequest(config) {
212
212
  };
213
213
  }
214
214
 
215
- const getTearsheets_ConfigPropertyNames = {
216
- displayName: 'getTearsheets',
217
- parameters: {
218
- required: ['accountId'],
219
- optional: ['limit', 'offset', 'templateType']
220
- }
221
- };
215
+ const adapterName = 'getTearsheets';
216
+ const getTearsheets_ConfigPropertyMetadata = [
217
+ generateParamConfigMetadata('accountId', true),
218
+ generateParamConfigMetadata('limit', false),
219
+ generateParamConfigMetadata('offset', false),
220
+ generateParamConfigMetadata('templateType', false),
221
+ ];
222
+ const getTearsheets_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getTearsheets_ConfigPropertyMetadata);
222
223
  function createResourceParams(config) {
223
224
  const resourceParams = {
224
225
  urlParams: {
@@ -290,21 +291,7 @@ function buildNetworkSnapshot(luvio, config, options) {
290
291
  });
291
292
  }
292
293
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
293
- const { luvio, config } = context;
294
- const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
295
- const dispatchOptions = {
296
- resourceRequestContext: {
297
- requestCorrelator,
298
- luvioRequestMethod: undefined,
299
- },
300
- eventObservers
301
- };
302
- if (networkPriority !== 'normal') {
303
- dispatchOptions.overrides = {
304
- priority: networkPriority
305
- };
306
- }
307
- return buildNetworkSnapshot(luvio, config, dispatchOptions);
294
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
308
295
  }
309
296
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
310
297
  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 = "tearsheet";
@@ -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_getConnectFinancialservicesTearsheetsByAccountId_ResourceRequestConfig } from '../resources/getConnectFinancialservicesTearsheetsByAccountId';
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 { TearsheetListRepresentation as types_TearsheetListRepresentation_TearsheetListRepresentation } from '../types/TearsheetListRepresentation';
5
5
  export declare const adapterName = "getTearsheets";
6
+ export declare const getTearsheets_ConfigPropertyMetadata: $64$luvio_engine_AdapterConfigMetadata[];
6
7
  export declare const getTearsheets_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
7
8
  export interface GetTearsheetsConfig {
8
9
  accountId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-industries-tearsheet",
3
- "version": "1.213.0",
3
+ "version": "1.213.2",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "APIs for Tearsheets feature in FSC",
6
6
  "main": "dist/es/es2018/industries-tearsheet.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 = 'tearsheet';
62
80
 
63
81
  const { isArray: ArrayIsArray } = Array;
@@ -138,26 +156,8 @@ const ingest = function TearsheetListRepresentationIngest(input, path, luvio, st
138
156
  }
139
157
  }
140
158
  const key = path.fullPath;
141
- const existingRecord = store.readEntry(key);
142
159
  const ttlToUse = TTL;
143
- let incomingRecord = normalize(input, store.readEntry(key), {
144
- fullPath: key,
145
- parent: path.parent,
146
- propertyName: path.propertyName,
147
- ttl: ttlToUse
148
- });
149
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
150
- luvio.storePublish(key, incomingRecord);
151
- }
152
- {
153
- const storeMetadataParams = {
154
- ttl: ttlToUse,
155
- namespace: "tearsheet",
156
- version: VERSION,
157
- representationName: RepresentationType,
158
- };
159
- luvio.publishStoreMetadata(key, storeMetadataParams);
160
- }
160
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "tearsheet", VERSION, RepresentationType, equals);
161
161
  return createLink(key);
162
162
  };
163
163
  function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
@@ -222,13 +222,14 @@ function createResourceRequest(config) {
222
222
  };
223
223
  }
224
224
 
225
- const getTearsheets_ConfigPropertyNames = {
226
- displayName: 'getTearsheets',
227
- parameters: {
228
- required: ['accountId'],
229
- optional: ['limit', 'offset', 'templateType']
230
- }
231
- };
225
+ const adapterName = 'getTearsheets';
226
+ const getTearsheets_ConfigPropertyMetadata = [
227
+ generateParamConfigMetadata('accountId', true),
228
+ generateParamConfigMetadata('limit', false),
229
+ generateParamConfigMetadata('offset', false),
230
+ generateParamConfigMetadata('templateType', false),
231
+ ];
232
+ const getTearsheets_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getTearsheets_ConfigPropertyMetadata);
232
233
  function createResourceParams(config) {
233
234
  const resourceParams = {
234
235
  urlParams: {
@@ -300,21 +301,7 @@ function buildNetworkSnapshot(luvio, config, options) {
300
301
  });
301
302
  }
302
303
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
303
- const { luvio, config } = context;
304
- const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
305
- const dispatchOptions = {
306
- resourceRequestContext: {
307
- requestCorrelator,
308
- luvioRequestMethod: undefined,
309
- },
310
- eventObservers
311
- };
312
- if (networkPriority !== 'normal') {
313
- dispatchOptions.overrides = {
314
- priority: networkPriority
315
- };
316
- }
317
- return buildNetworkSnapshot(luvio, config, dispatchOptions);
304
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
318
305
  }
319
306
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
320
307
  const { luvio, config } = context;
@@ -361,4 +348,4 @@ withDefaultLuvio((luvio) => {
361
348
  });
362
349
 
363
350
  export { getTearsheets, getTearsheets_imperative };
364
- // version: 1.213.0-951602080
351
+ // version: 1.213.2-1eb996209