@salesforce/lds-adapters-platform-data-provider 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$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 = 'DataProviders';
52
70
 
53
71
  const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
@@ -109,26 +127,8 @@ const ingest = function DataProviderSchemaRepresentationIngest(input, path, luvi
109
127
  }
110
128
  }
111
129
  const key = path.fullPath;
112
- const existingRecord = store.readEntry(key);
113
130
  const ttlToUse = TTL;
114
- let incomingRecord = normalize(input, store.readEntry(key), {
115
- fullPath: key,
116
- parent: path.parent,
117
- propertyName: path.propertyName,
118
- ttl: ttlToUse
119
- });
120
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
121
- luvio.storePublish(key, incomingRecord);
122
- }
123
- {
124
- const storeMetadataParams = {
125
- ttl: ttlToUse,
126
- namespace: "DataProviders",
127
- version: VERSION,
128
- representationName: RepresentationType,
129
- };
130
- luvio.publishStoreMetadata(key, storeMetadataParams);
131
- }
131
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "DataProviders", VERSION, RepresentationType, equals);
132
132
  return createLink(key);
133
133
  };
134
134
  function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
@@ -193,13 +193,12 @@ function createResourceRequest(config) {
193
193
  };
194
194
  }
195
195
 
196
- const getSchema_ConfigPropertyNames = {
197
- displayName: 'getSchema',
198
- parameters: {
199
- required: ['dataProviderFullyQualifiedName', 'schema'],
200
- optional: []
201
- }
202
- };
196
+ const adapterName = 'getSchema';
197
+ const getSchema_ConfigPropertyMetadata = [
198
+ generateParamConfigMetadata('dataProviderFullyQualifiedName', true),
199
+ generateParamConfigMetadata('schema', true),
200
+ ];
201
+ const getSchema_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getSchema_ConfigPropertyMetadata);
203
202
  function createResourceParams(config) {
204
203
  const resourceParams = {
205
204
  urlParams: {
@@ -270,21 +269,7 @@ function buildNetworkSnapshot(luvio, config, options) {
270
269
  });
271
270
  }
272
271
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
273
- const { luvio, config } = context;
274
- const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
275
- const dispatchOptions = {
276
- resourceRequestContext: {
277
- requestCorrelator,
278
- luvioRequestMethod: 'get',
279
- },
280
- eventObservers
281
- };
282
- if (networkPriority !== 'normal') {
283
- dispatchOptions.overrides = {
284
- priority: networkPriority
285
- };
286
- }
287
- return buildNetworkSnapshot(luvio, config, dispatchOptions);
272
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, 'get', false);
288
273
  }
289
274
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
290
275
  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 = "DataProviders";
@@ -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_postConnectDataProvidersSchemaByDataProviderFullyQualifiedName_ResourceRequestConfig } from '../resources/postConnectDataProvidersSchemaByDataProviderFullyQualifiedName';
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 { DataProviderSchemaRepresentation as types_DataProviderSchemaRepresentation_DataProviderSchemaRepresentation } from '../types/DataProviderSchemaRepresentation';
5
5
  export declare const adapterName = "getSchema";
6
+ export declare const getSchema_ConfigPropertyMetadata: $64$luvio_engine_AdapterConfigMetadata[];
6
7
  export declare const getSchema_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
7
8
  export interface GetSchemaConfig {
8
9
  dataProviderFullyQualifiedName: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-platform-data-provider",
3
- "version": "1.213.0",
3
+ "version": "1.213.1",
4
4
  "description": "Data Provider connect api resource family",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "dist/es/es2018/platform-data-provider.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$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 = 'DataProviders';
62
80
 
63
81
  const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
@@ -119,26 +137,8 @@ const ingest = function DataProviderSchemaRepresentationIngest(input, path, luvi
119
137
  }
120
138
  }
121
139
  const key = path.fullPath;
122
- const existingRecord = store.readEntry(key);
123
140
  const ttlToUse = TTL;
124
- let incomingRecord = normalize(input, store.readEntry(key), {
125
- fullPath: key,
126
- parent: path.parent,
127
- propertyName: path.propertyName,
128
- ttl: ttlToUse
129
- });
130
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
131
- luvio.storePublish(key, incomingRecord);
132
- }
133
- {
134
- const storeMetadataParams = {
135
- ttl: ttlToUse,
136
- namespace: "DataProviders",
137
- version: VERSION,
138
- representationName: RepresentationType,
139
- };
140
- luvio.publishStoreMetadata(key, storeMetadataParams);
141
- }
141
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "DataProviders", VERSION, RepresentationType, equals);
142
142
  return createLink(key);
143
143
  };
144
144
  function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
@@ -203,13 +203,12 @@ function createResourceRequest(config) {
203
203
  };
204
204
  }
205
205
 
206
- const getSchema_ConfigPropertyNames = {
207
- displayName: 'getSchema',
208
- parameters: {
209
- required: ['dataProviderFullyQualifiedName', 'schema'],
210
- optional: []
211
- }
212
- };
206
+ const adapterName = 'getSchema';
207
+ const getSchema_ConfigPropertyMetadata = [
208
+ generateParamConfigMetadata('dataProviderFullyQualifiedName', true),
209
+ generateParamConfigMetadata('schema', true),
210
+ ];
211
+ const getSchema_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getSchema_ConfigPropertyMetadata);
213
212
  function createResourceParams(config) {
214
213
  const resourceParams = {
215
214
  urlParams: {
@@ -280,21 +279,7 @@ function buildNetworkSnapshot(luvio, config, options) {
280
279
  });
281
280
  }
282
281
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
283
- const { luvio, config } = context;
284
- const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
285
- const dispatchOptions = {
286
- resourceRequestContext: {
287
- requestCorrelator,
288
- luvioRequestMethod: 'get',
289
- },
290
- eventObservers
291
- };
292
- if (networkPriority !== 'normal') {
293
- dispatchOptions.overrides = {
294
- priority: networkPriority
295
- };
296
- }
297
- return buildNetworkSnapshot(luvio, config, dispatchOptions);
282
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, 'get', false);
298
283
  }
299
284
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
300
285
  const { luvio, config } = context;
@@ -341,4 +326,4 @@ withDefaultLuvio((luvio) => {
341
326
  });
342
327
 
343
328
  export { getSchema, getSchema_imperative };
344
- // version: 1.213.0-951602080
329
+ // version: 1.213.1-79de10fe1