@salesforce/lds-adapters-industries-einstein-aiaccelerator 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$1, create: ObjectCreate$1 } = 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 = 'Einstein-AIAccelerator';
45
63
 
46
64
  const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
@@ -2282,26 +2300,8 @@ const ingest$1 = function PredictionOutputRepresentationIngest(input, path, luvi
2282
2300
  }
2283
2301
  }
2284
2302
  const key = keyBuilderFromType$1(luvio, input);
2285
- const existingRecord = store.readEntry(key);
2286
2303
  const ttlToUse = TTL$1;
2287
- let incomingRecord = normalize$1(input, store.readEntry(key), {
2288
- fullPath: key,
2289
- parent: path.parent,
2290
- propertyName: path.propertyName,
2291
- ttl: ttlToUse
2292
- });
2293
- if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
2294
- luvio.storePublish(key, incomingRecord);
2295
- }
2296
- {
2297
- const storeMetadataParams = {
2298
- ttl: ttlToUse,
2299
- namespace: "Einstein-AIAccelerator",
2300
- version: VERSION$1,
2301
- representationName: RepresentationType$1,
2302
- };
2303
- luvio.publishStoreMetadata(key, storeMetadataParams);
2304
- }
2304
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "Einstein-AIAccelerator", VERSION$1, RepresentationType$1, equals$1);
2305
2305
  return createLink(key);
2306
2306
  };
2307
2307
  function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
@@ -2351,13 +2351,11 @@ function createResourceRequest$1(config) {
2351
2351
  };
2352
2352
  }
2353
2353
 
2354
- const predictions_ConfigPropertyNames = {
2355
- displayName: 'predictions',
2356
- parameters: {
2357
- required: ['predictionInput'],
2358
- optional: []
2359
- }
2360
- };
2354
+ const adapterName$1 = 'predictions';
2355
+ const predictions_ConfigPropertyMetadata = [
2356
+ generateParamConfigMetadata('predictionInput', true),
2357
+ ];
2358
+ const predictions_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, predictions_ConfigPropertyMetadata);
2361
2359
  function createResourceParams$1(config) {
2362
2360
  const resourceParams = {
2363
2361
  body: {
@@ -3543,26 +3541,8 @@ const ingest = function RecommendationOutputRepresentationIngest(input, path, lu
3543
3541
  }
3544
3542
  }
3545
3543
  const key = keyBuilderFromType(luvio, input);
3546
- const existingRecord = store.readEntry(key);
3547
3544
  const ttlToUse = TTL;
3548
- let incomingRecord = normalize(input, store.readEntry(key), {
3549
- fullPath: key,
3550
- parent: path.parent,
3551
- propertyName: path.propertyName,
3552
- ttl: ttlToUse
3553
- });
3554
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
3555
- luvio.storePublish(key, incomingRecord);
3556
- }
3557
- {
3558
- const storeMetadataParams = {
3559
- ttl: ttlToUse,
3560
- namespace: "Einstein-AIAccelerator",
3561
- version: VERSION,
3562
- representationName: RepresentationType,
3563
- };
3564
- luvio.publishStoreMetadata(key, storeMetadataParams);
3565
- }
3545
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "Einstein-AIAccelerator", VERSION, RepresentationType, equals);
3566
3546
  return createLink(key);
3567
3547
  };
3568
3548
  function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
@@ -3612,13 +3592,11 @@ function createResourceRequest(config) {
3612
3592
  };
3613
3593
  }
3614
3594
 
3615
- const fetchRecommendations_ConfigPropertyNames = {
3616
- displayName: 'fetchRecommendations',
3617
- parameters: {
3618
- required: ['recommendationInput'],
3619
- optional: []
3620
- }
3621
- };
3595
+ const adapterName = 'fetchRecommendations';
3596
+ const fetchRecommendations_ConfigPropertyMetadata = [
3597
+ generateParamConfigMetadata('recommendationInput', true),
3598
+ ];
3599
+ const fetchRecommendations_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, fetchRecommendations_ConfigPropertyMetadata);
3622
3600
  function createResourceParams(config) {
3623
3601
  const resourceParams = {
3624
3602
  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 = "Einstein-AIAccelerator";
@@ -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 { RecommendationInputRepresentation as types_RecommendationInputRepresentation_RecommendationInputRepresentation } from '../types/RecommendationInputRepresentation';
3
4
  import { ResourceRequestConfig as resources_postConnectAiacceleratorRecommendations_ResourceRequestConfig } from '../resources/postConnectAiacceleratorRecommendations';
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 { RecommendationOutputRepresentation as types_RecommendationOutputRepresentation_RecommendationOutputRepresentation } from '../types/RecommendationOutputRepresentation';
6
6
  export declare const adapterName = "fetchRecommendations";
7
+ export declare const fetchRecommendations_ConfigPropertyMetadata: $64$luvio_engine_AdapterConfigMetadata[];
7
8
  export declare const fetchRecommendations_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
8
9
  export interface FetchRecommendationsConfig {
9
10
  recommendationInput: types_RecommendationInputRepresentation_RecommendationInputRepresentation;
@@ -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 { PredictionInputRepresentation as types_PredictionInputRepresentation_PredictionInputRepresentation } from '../types/PredictionInputRepresentation';
3
4
  import { ResourceRequestConfig as resources_postConnectAiacceleratorPredictions_ResourceRequestConfig } from '../resources/postConnectAiacceleratorPredictions';
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 { PredictionOutputRepresentation as types_PredictionOutputRepresentation_PredictionOutputRepresentation } from '../types/PredictionOutputRepresentation';
6
6
  export declare const adapterName = "predictions";
7
+ export declare const predictions_ConfigPropertyMetadata: $64$luvio_engine_AdapterConfigMetadata[];
7
8
  export declare const predictions_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
8
9
  export interface PredictionsConfig {
9
10
  predictionInput: types_PredictionInputRepresentation_PredictionInputRepresentation;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-industries-einstein-aiaccelerator",
3
- "version": "1.212.1",
3
+ "version": "1.213.1",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "AI Accelerator Connect API to make predictions",
6
6
  "main": "dist/es/es2018/industries-einstein-aiaccelerator.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$1, create: ObjectCreate$1 } = 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 = 'Einstein-AIAccelerator';
54
72
 
55
73
  const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
@@ -1206,26 +1224,8 @@ const ingest$1 = function RecommendationOutputRepresentationIngest(input, path,
1206
1224
  }
1207
1225
  }
1208
1226
  const key = keyBuilderFromType$1(luvio, input);
1209
- const existingRecord = store.readEntry(key);
1210
1227
  const ttlToUse = TTL$1;
1211
- let incomingRecord = normalize$1(input, store.readEntry(key), {
1212
- fullPath: key,
1213
- parent: path.parent,
1214
- propertyName: path.propertyName,
1215
- ttl: ttlToUse
1216
- });
1217
- if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
1218
- luvio.storePublish(key, incomingRecord);
1219
- }
1220
- {
1221
- const storeMetadataParams = {
1222
- ttl: ttlToUse,
1223
- namespace: "Einstein-AIAccelerator",
1224
- version: VERSION$1,
1225
- representationName: RepresentationType$1,
1226
- };
1227
- luvio.publishStoreMetadata(key, storeMetadataParams);
1228
- }
1228
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "Einstein-AIAccelerator", VERSION$1, RepresentationType$1, equals$1);
1229
1229
  return createLink(key);
1230
1230
  };
1231
1231
  function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
@@ -1275,13 +1275,11 @@ function createResourceRequest$1(config) {
1275
1275
  };
1276
1276
  }
1277
1277
 
1278
- const fetchRecommendations_ConfigPropertyNames = {
1279
- displayName: 'fetchRecommendations',
1280
- parameters: {
1281
- required: ['recommendationInput'],
1282
- optional: []
1283
- }
1284
- };
1278
+ const adapterName$1 = 'fetchRecommendations';
1279
+ const fetchRecommendations_ConfigPropertyMetadata = [
1280
+ generateParamConfigMetadata('recommendationInput', true),
1281
+ ];
1282
+ const fetchRecommendations_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, fetchRecommendations_ConfigPropertyMetadata);
1285
1283
  function createResourceParams$1(config) {
1286
1284
  const resourceParams = {
1287
1285
  body: {
@@ -3552,26 +3550,8 @@ const ingest = function PredictionOutputRepresentationIngest(input, path, luvio,
3552
3550
  }
3553
3551
  }
3554
3552
  const key = keyBuilderFromType(luvio, input);
3555
- const existingRecord = store.readEntry(key);
3556
3553
  const ttlToUse = TTL;
3557
- let incomingRecord = normalize(input, store.readEntry(key), {
3558
- fullPath: key,
3559
- parent: path.parent,
3560
- propertyName: path.propertyName,
3561
- ttl: ttlToUse
3562
- });
3563
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
3564
- luvio.storePublish(key, incomingRecord);
3565
- }
3566
- {
3567
- const storeMetadataParams = {
3568
- ttl: ttlToUse,
3569
- namespace: "Einstein-AIAccelerator",
3570
- version: VERSION,
3571
- representationName: RepresentationType,
3572
- };
3573
- luvio.publishStoreMetadata(key, storeMetadataParams);
3574
- }
3554
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "Einstein-AIAccelerator", VERSION, RepresentationType, equals);
3575
3555
  return createLink(key);
3576
3556
  };
3577
3557
  function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
@@ -3621,13 +3601,11 @@ function createResourceRequest(config) {
3621
3601
  };
3622
3602
  }
3623
3603
 
3624
- const predictions_ConfigPropertyNames = {
3625
- displayName: 'predictions',
3626
- parameters: {
3627
- required: ['predictionInput'],
3628
- optional: []
3629
- }
3630
- };
3604
+ const adapterName = 'predictions';
3605
+ const predictions_ConfigPropertyMetadata = [
3606
+ generateParamConfigMetadata('predictionInput', true),
3607
+ ];
3608
+ const predictions_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, predictions_ConfigPropertyMetadata);
3631
3609
  function createResourceParams(config) {
3632
3610
  const resourceParams = {
3633
3611
  body: {
@@ -3708,4 +3686,4 @@ withDefaultLuvio((luvio) => {
3708
3686
  });
3709
3687
 
3710
3688
  export { fetchRecommendations, predictions };
3711
- // version: 1.212.1-49679d2a7
3689
+ // version: 1.213.1-79de10fe1