@salesforce/lds-runtime-aura 1.313.0 → 1.314.0

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.
@@ -22,7 +22,7 @@ import applyPredictionRequestLimit from '@salesforce/gate/lds.pdl.applyRequestLi
22
22
  import useExactMatchesPlusGate from '@salesforce/gate/lds.pdl.useExactMatchesPlus';
23
23
  import { GetApexWireAdapterFactory, registerPrefetcher as registerPrefetcher$1 } from 'force/ldsAdaptersApex';
24
24
  import { instrument, getRecordAvatarsAdapterFactory, getRecordAdapterFactory, coerceFieldIdArray, getRecordsAdapterFactory, getRecordActionsAdapterFactory, getObjectInfosAdapterFactory, coerceObjectIdArray, getObjectInfoAdapterFactory, coerceObjectId, getRelatedListsActionsAdapterFactory, getRelatedListInfoBatchAdapterFactory, getRelatedListInfoAdapterFactory, getRelatedListRecordsBatchAdapterFactory, getRelatedListRecordsAdapterFactory, getListInfoByNameAdapterFactory, getListInfosByObjectNameAdapterFactory, getListRecordsByNameAdapterFactory, getListObjectInfoAdapterFactory, configuration, InMemoryRecordRepresentationQueryEvaluator, UiApiNamespace, RecordRepresentationRepresentationType, registerPrefetcher } from 'force/ldsAdaptersUiapi';
25
- import { BaseCommand, convertAuraResponseToData, convertFetchResponseToData } from 'force/luvioRuntime5';
25
+ import { BaseCommand, convertFetchResponseToData } from 'force/luvioRuntime5';
26
26
  import { serviceBroker } from 'force/luvioServiceBroker5';
27
27
  import oneStoreEnabled from '@salesforce/gate/lds.oneStoreEnabled.ltng';
28
28
  import oneStoreUiapiEnabled from '@salesforce/gate/lds.oneStoreUiapiEnabled.ltng';
@@ -74,68 +74,6 @@ function buildNetworkCommandBaseClassService() {
74
74
  */
75
75
 
76
76
 
77
- /**
78
- * An implementation of BaseCommand that makes network requests but does not try to
79
- * use the store.
80
- */
81
- class AuraNetworkCommand extends NetworkCommand {
82
- constructor(services) {
83
- super(services);
84
- this.services = services;
85
- this.actionConfig = {
86
- background: false,
87
- hotspot: true,
88
- longRunning: false,
89
- storable: false,
90
- };
91
- }
92
- fetch() {
93
- return convertAuraResponseToData(this.services.auraNetwork(this.endpoint, this.auraParams, this.actionConfig));
94
- }
95
- }
96
- function buildAuraNetworkCommandBaseClassService() {
97
- return {
98
- type: 'auraNetworkCommandBaseClass',
99
- version: '1.0',
100
- service: AuraNetworkCommand,
101
- };
102
- }
103
-
104
- /**
105
- * Copyright (c) 2022, Salesforce, Inc.,
106
- * All rights reserved.
107
- * For full license text, see the LICENSE.txt file
108
- */
109
-
110
-
111
- /**
112
- * An implementation of BaseCommand that makes network requests but does not try to
113
- * use the store.
114
- */
115
- class FetchNetworkCommand extends NetworkCommand {
116
- constructor(services) {
117
- super(services);
118
- this.services = services;
119
- }
120
- fetch() {
121
- return convertFetchResponseToData(this.services.fetch(...this.fetchParams));
122
- }
123
- }
124
- function buildFetchNetworkCommandBaseClassService() {
125
- return {
126
- type: 'fetchNetworkCommandBaseClass',
127
- version: '1.0',
128
- service: FetchNetworkCommand,
129
- };
130
- }
131
-
132
- /**
133
- * Copyright (c) 2022, Salesforce, Inc.,
134
- * All rights reserved.
135
- * For full license text, see the LICENSE.txt file
136
- */
137
-
138
-
139
77
  const LogLevelMap$1 = {
140
78
  TRACE: 4,
141
79
  DEBUG: 3,
@@ -300,6 +238,85 @@ function isCacheHitOrError(value) {
300
238
  */
301
239
 
302
240
 
241
+ function convertAuraResponseToData(responsePromise) {
242
+ return responsePromise
243
+ .then((response) => {
244
+ return ok(response.getReturnValue());
245
+ })
246
+ .catch((error) => {
247
+ if (!error || !error.getError) {
248
+ return err(toError('Failed to get error from response'));
249
+ }
250
+ const actionErrors = error.getError();
251
+ if (actionErrors.length > 0) {
252
+ return err(toError(actionErrors[0]));
253
+ }
254
+ return err(toError('Error fetching component'));
255
+ });
256
+ }
257
+
258
+ /**
259
+ * An implementation of BaseCommand that makes network requests but does not try to
260
+ * use the store.
261
+ */
262
+ class AuraNetworkCommand extends NetworkCommand {
263
+ constructor(services) {
264
+ super(services);
265
+ this.services = services;
266
+ this.actionConfig = {
267
+ background: false,
268
+ hotspot: true,
269
+ longRunning: false,
270
+ storable: false,
271
+ };
272
+ }
273
+ fetch() {
274
+ return convertAuraResponseToData(this.services.auraNetwork(this.endpoint, this.auraParams, this.actionConfig));
275
+ }
276
+ }
277
+ function buildAuraNetworkCommandBaseClassService() {
278
+ return {
279
+ type: 'auraNetworkCommandBaseClass',
280
+ version: '1.0',
281
+ service: AuraNetworkCommand,
282
+ };
283
+ }
284
+
285
+ /**
286
+ * Copyright (c) 2022, Salesforce, Inc.,
287
+ * All rights reserved.
288
+ * For full license text, see the LICENSE.txt file
289
+ */
290
+
291
+
292
+ /**
293
+ * An implementation of BaseCommand that makes network requests but does not try to
294
+ * use the store.
295
+ */
296
+ class FetchNetworkCommand extends NetworkCommand {
297
+ constructor(services) {
298
+ super(services);
299
+ this.services = services;
300
+ }
301
+ fetch() {
302
+ return convertFetchResponseToData(this.services.fetch(...this.fetchParams));
303
+ }
304
+ }
305
+ function buildFetchNetworkCommandBaseClassService() {
306
+ return {
307
+ type: 'fetchNetworkCommandBaseClass',
308
+ version: '1.0',
309
+ service: FetchNetworkCommand,
310
+ };
311
+ }
312
+
313
+ /**
314
+ * Copyright (c) 2022, Salesforce, Inc.,
315
+ * All rights reserved.
316
+ * For full license text, see the LICENSE.txt file
317
+ */
318
+
319
+
303
320
  /**
304
321
  * An implementation of BaseCommand that supports streaming responses and does not use the store.
305
322
  */
@@ -4005,24 +4022,33 @@ class GetListRecordsByNameRequestStrategy extends LuvioAdapterRequestStrategy {
4005
4022
  return similarRequest;
4006
4023
  }
4007
4024
  transformForSave(request) {
4008
- // if (request.config.fields === undefined && request.config.optionalFields === undefined) {
4009
- // return request;
4010
- // }
4011
- // let fields = request.config.fields || [];
4012
- // let optionalFields = request.config.optionalFields || [];
4013
- // return {
4014
- // ...request,
4015
- // config: {
4016
- // ...request.config,
4017
- // fields: [],
4018
- // optionalFields: Array.from(new Set([...fields, ...optionalFields]),
4019
- // },
4020
- // };
4021
- // Right now getListRecordsByName has both fields and optional fiends in the key
4022
- // which means if we try to move fields to optionalFields then the wire will fire twice
4023
- // A raml artifact which combines fields and optional fields into one larger list and uses that
4024
- // to build the key should solve this issue till then we can't move fields into optional fields
4025
- return request;
4025
+ if (request.config.fields === undefined && request.config.optionalFields === undefined) {
4026
+ return request;
4027
+ }
4028
+ let fields = request.config.fields || [];
4029
+ let optionalFields = request.config.optionalFields || [];
4030
+ return {
4031
+ ...request,
4032
+ config: {
4033
+ ...request.config,
4034
+ fields: [],
4035
+ optionalFields: Array.from(new Set([...fields, ...optionalFields])),
4036
+ },
4037
+ };
4038
+ }
4039
+ canCombine(reqA, reqB) {
4040
+ return (reqA.objectApiName === reqB.objectApiName &&
4041
+ reqA.listViewApiName === reqB.listViewApiName &&
4042
+ reqA.pageSize === reqB.pageSize &&
4043
+ reqA.searchTerm === reqB.searchTerm &&
4044
+ reqA.sortBy === reqB.sortBy &&
4045
+ reqA.where === reqB.where);
4046
+ }
4047
+ combineRequests(reqA, reqB) {
4048
+ return {
4049
+ ...reqA,
4050
+ optionalFields: Array.from(new Set([...(reqA.optionalFields || []), ...(reqB.optionalFields || [])])),
4051
+ };
4026
4052
  }
4027
4053
  }
4028
4054
 
@@ -4046,6 +4072,12 @@ class GetListObjectInfoRequestStrategy extends LuvioAdapterRequestStrategy {
4046
4072
  },
4047
4073
  };
4048
4074
  }
4075
+ canCombine(reqA, reqB) {
4076
+ return reqA.objectApiName === reqB.objectApiName;
4077
+ }
4078
+ combineRequests(reqA, _reqB) {
4079
+ return reqA;
4080
+ }
4049
4081
  }
4050
4082
 
4051
4083
  class InMemoryPrefetchStorage {
@@ -4173,7 +4205,7 @@ function getEnvironmentSetting(name) {
4173
4205
  }
4174
4206
  return undefined;
4175
4207
  }
4176
- // version: 1.313.0-19e9b0d234
4208
+ // version: 1.314.0-022b0c843b
4177
4209
 
4178
4210
  const forceRecordTransactionsDisabled = getEnvironmentSetting(EnvironmentSettings.ForceRecordTransactionsDisabled);
4179
4211
  //TODO: Some duplication here that can be most likely moved to a util class
@@ -4388,12 +4420,40 @@ function setRejectConfig(request, error) {
4388
4420
  };
4389
4421
  }
4390
4422
 
4391
- const UIAPI_FAMILY = '/ui-api/'; // swap this to an allowlist per family (or build it off package.jsons?)
4392
- // Denylist
4393
- const PRIVATE_RESOURCES = ['record-avatars', 'user-state']; // These resources have Connect client filters, must be requested through UiTier :eyeroll:
4394
- function isPrivatePath(basePath) {
4395
- return PRIVATE_RESOURCES.some((privateResource) => basePath.includes(privateResource));
4396
- }
4423
+ const API_PATHS = [
4424
+ // getLookupActions
4425
+ '/ui-api/actions/lookup/{objectApiNames}',
4426
+ // getRecordActions
4427
+ '/ui-api/actions/record/{recordIds}',
4428
+ // getRelatedListActions
4429
+ '/ui-api/actions/record/{recordIds}/related-list/{relatedListId}',
4430
+ // getDuplicateConfiguration
4431
+ '/ui-api/duplicates/{objectApiName}',
4432
+ // getListInfosByObjectName
4433
+ '/ui-api/list-info/{objectApiName}',
4434
+ // getLookupRecords
4435
+ '/ui-api/lookups/{objectApiName}/{fieldApiName}',
4436
+ // getObjectInfo
4437
+ '/ui-api/object-info/{objectApiName}',
4438
+ // getObjectInfos
4439
+ '/ui-api/object-info/batch/{objectApiNames}',
4440
+ // getPicklistValuesByRecordType
4441
+ '/ui-api/object-info/{objectApiName}/picklist-values/{recordTypeId}',
4442
+ // getDuplicates
4443
+ '/ui-api/predupe',
4444
+ // getRecord
4445
+ '/ui-api/records/{recordId}',
4446
+ // getRecordUi
4447
+ '/ui-api/record-ui/{recordIds}',
4448
+ // getRelatedListInfo
4449
+ '/ui-api/related-list-info/{parentObjectApiName}/{relatedListId}',
4450
+ // getRelatedListRecords
4451
+ '/ui-api/related-list-records/{parentRecordId}/{relatedListId}',
4452
+ ];
4453
+ const API_PATH_MATCHERS = API_PATHS.map((path) => {
4454
+ const regexString = path.replace(/\{.+?\}/g, '[^/]+');
4455
+ return new RegExp(`^${regexString}$`);
4456
+ });
4397
4457
  const modifyLexResourceRequest = function (resourceRequest, jwtToken) {
4398
4458
  const jwtBaseUri = jwtToken.decodedInfo.iss;
4399
4459
  return {
@@ -4419,8 +4479,11 @@ const requestLogger = {
4419
4479
  };
4420
4480
  const composedFetchNetworkAdapter = {
4421
4481
  shouldHandleRequest(resourceRequest) {
4422
- return (resourceRequest.basePath.startsWith(UIAPI_FAMILY) &&
4423
- !isPrivatePath(resourceRequest.basePath));
4482
+ let path = resourceRequest.basePath.trim();
4483
+ if (path.endsWith('/')) {
4484
+ path = path.substring(0, path.length - 1);
4485
+ }
4486
+ return API_PATH_MATCHERS.some((matcher) => matcher.test(path));
4424
4487
  },
4425
4488
  adapter: setupLexJwtNetworkAdapter(auraNetworkAdapter, modifyLexResourceRequest, requestTracker, requestLogger),
4426
4489
  };
@@ -4739,4 +4802,4 @@ function ldsEngineCreator() {
4739
4802
  }
4740
4803
 
4741
4804
  export { buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore };
4742
- // version: 1.313.0-bf88d762e3
4805
+ // version: 1.314.0-5a451c78cd
@@ -13,4 +13,6 @@ export declare class GetListObjectInfoRequestStrategy extends LuvioAdapterReques
13
13
  adapterFactory: import("@luvio/engine").AdapterFactory<GetListObjectInfoConfig, import("packages/lds-adapters-uiapi/dist/es/es2018/types/src/generated/types/ListObjectInfoRepresentation").ListObjectInfoRepresentation>;
14
14
  buildConcreteRequest(similarRequest: GetListObjectInfoRequest): GetListObjectInfoRequest;
15
15
  transformForSave(request: GetListObjectInfoRequest): GetListObjectInfoRequest;
16
+ canCombine(reqA: GetListObjectInfoConfig, reqB: GetListObjectInfoConfig): boolean;
17
+ combineRequests(reqA: GetListObjectInfoConfig, _reqB: GetListObjectInfoConfig): GetListObjectInfoConfig;
16
18
  }
@@ -14,4 +14,6 @@ export declare class GetListRecordsByNameRequestStrategy extends LuvioAdapterReq
14
14
  adapterFactory: import("@luvio/engine").AdapterFactory<GetListRecordsByNameConfig, import("packages/lds-adapters-uiapi/dist/es/es2018/types/src/generated/types/ListRecordCollectionRepresentation").ListRecordCollectionRepresentation>;
15
15
  buildConcreteRequest(similarRequest: GetListRecordsByNameRequest): GetListRecordsByNameRequest;
16
16
  transformForSave(request: GetListRecordsByNameRequest): GetListRecordsByNameRequest;
17
+ canCombine(reqA: GetListRecordsByNameConfig, reqB: GetListRecordsByNameConfig): boolean;
18
+ combineRequests(reqA: GetListRecordsByNameConfig, reqB: GetListRecordsByNameConfig): GetListRecordsByNameConfig;
17
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-aura",
3
- "version": "1.313.0",
3
+ "version": "1.314.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS engine for Aura runtime",
6
6
  "main": "dist/ldsEngineCreator.js",
@@ -34,43 +34,43 @@
34
34
  "release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-aura"
35
35
  },
36
36
  "devDependencies": {
37
- "@luvio/service-broker": "5.3.1",
38
- "@salesforce/lds-adapters-apex": "^1.313.0",
39
- "@salesforce/lds-adapters-uiapi": "^1.313.0",
37
+ "@luvio/service-broker": "5.5.0",
38
+ "@salesforce/lds-adapters-apex": "^1.314.0",
39
+ "@salesforce/lds-adapters-uiapi": "^1.314.0",
40
40
  "@salesforce/lds-adapters-uiapi-lex": "^1.302.0",
41
- "@salesforce/lds-ads-bridge": "^1.313.0",
42
- "@salesforce/lds-aura-storage": "^1.313.0",
43
- "@salesforce/lds-bindings": "^1.313.0",
44
- "@salesforce/lds-instrumentation": "^1.313.0",
45
- "@salesforce/lds-network-aura": "^1.313.0",
46
- "@salesforce/lds-network-fetch-with-jwt": "^1.313.0"
41
+ "@salesforce/lds-ads-bridge": "^1.314.0",
42
+ "@salesforce/lds-aura-storage": "^1.314.0",
43
+ "@salesforce/lds-bindings": "^1.314.0",
44
+ "@salesforce/lds-instrumentation": "^1.314.0",
45
+ "@salesforce/lds-network-aura": "^1.314.0",
46
+ "@salesforce/lds-network-fetch-with-jwt": "^1.314.0"
47
47
  },
48
48
  "dependencies": {
49
- "@luvio/command-aura-network": "5.3.1",
50
- "@luvio/command-fetch-network": "5.3.1",
51
- "@luvio/command-network": "5.3.1",
52
- "@luvio/command-sse": "5.3.1",
53
- "@luvio/command-streaming": "5.3.1",
49
+ "@luvio/command-aura-network": "5.5.0",
50
+ "@luvio/command-fetch-network": "5.5.0",
51
+ "@luvio/command-network": "5.5.0",
52
+ "@luvio/command-sse": "5.5.0",
53
+ "@luvio/command-streaming": "5.5.0",
54
54
  "@luvio/network-adapter-composable": "0.156.4",
55
55
  "@luvio/network-adapter-fetch": "0.156.4",
56
- "@luvio/runtime": "5.3.1",
57
- "@luvio/service-aura-network": "5.3.1",
58
- "@luvio/service-cache-inclusion-policy": "5.3.1",
59
- "@luvio/service-cache-policy": "5.3.1",
60
- "@luvio/service-dedupe": "5.3.1",
61
- "@luvio/service-fetch-network": "5.3.1",
62
- "@luvio/service-instrument-command": "5.3.1",
63
- "@luvio/service-store": "5.3.1",
64
- "@luvio/service-subscription": "5.3.1",
65
- "@luvio/service-type-registry": "5.3.1",
66
- "@luvio/utils": "5.3.1",
67
- "@salesforce/lds-adapters-uiapi-lex": "^1.313.0"
56
+ "@luvio/runtime": "5.5.0",
57
+ "@luvio/service-aura-network": "5.5.0",
58
+ "@luvio/service-cache-inclusion-policy": "5.5.0",
59
+ "@luvio/service-cache-policy": "5.5.0",
60
+ "@luvio/service-dedupe": "5.5.0",
61
+ "@luvio/service-fetch-network": "5.5.0",
62
+ "@luvio/service-instrument-command": "5.5.0",
63
+ "@luvio/service-store": "5.5.0",
64
+ "@luvio/service-subscription": "5.5.0",
65
+ "@luvio/service-type-registry": "5.5.0",
66
+ "@luvio/utils": "5.5.0",
67
+ "@salesforce/lds-adapters-uiapi-lex": "^1.314.0"
68
68
  },
69
69
  "luvioBundlesize": [
70
70
  {
71
71
  "path": "./dist/ldsEngineCreator.js",
72
72
  "maxSize": {
73
- "none": "178 kB",
73
+ "none": "179 kB",
74
74
  "min": "75 kB",
75
75
  "compressed": "32 kB"
76
76
  }