@salesforce/lds-runtime-aura 1.329.1 → 1.331.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.
@@ -12,7 +12,7 @@
12
12
  * *******************************************************************************************
13
13
  */
14
14
  /* proxy-compat-disable */
15
- import { HttpStatusCode, InMemoryStore, Environment, Luvio, InMemoryStoreQueryEvaluator } from 'force/luvioEngine';
15
+ import { HttpStatusCode as HttpStatusCode$2, InMemoryStore, Environment, Luvio, InMemoryStoreQueryEvaluator } from 'force/luvioEngine';
16
16
  import ldsTrackedFieldsBehaviorGate from '@salesforce/gate/lds.useNewTrackedFieldBehavior';
17
17
  import usePredictiveLoading from '@salesforce/gate/lds.usePredictiveLoading';
18
18
  import useApexPredictions from '@salesforce/gate/lds.pdl.useApexPredictions';
@@ -287,6 +287,20 @@ function toError(x) {
287
287
  return new Error(typeof x === 'string' ? x : JSON.stringify(x));
288
288
  }
289
289
 
290
+ var HttpStatusCode$1;
291
+ (function (HttpStatusCode) {
292
+ HttpStatusCode[HttpStatusCode["Ok"] = 200] = "Ok";
293
+ HttpStatusCode[HttpStatusCode["Created"] = 201] = "Created";
294
+ HttpStatusCode[HttpStatusCode["NoContent"] = 204] = "NoContent";
295
+ HttpStatusCode[HttpStatusCode["NotModified"] = 304] = "NotModified";
296
+ HttpStatusCode[HttpStatusCode["BadRequest"] = 400] = "BadRequest";
297
+ HttpStatusCode[HttpStatusCode["Unauthorized"] = 401] = "Unauthorized";
298
+ HttpStatusCode[HttpStatusCode["Forbidden"] = 403] = "Forbidden";
299
+ HttpStatusCode[HttpStatusCode["NotFound"] = 404] = "NotFound";
300
+ HttpStatusCode[HttpStatusCode["ServerError"] = 500] = "ServerError";
301
+ HttpStatusCode[HttpStatusCode["GatewayTimeout"] = 504] = "GatewayTimeout";
302
+ })(HttpStatusCode$1 || (HttpStatusCode$1 = {}));
303
+
290
304
  /**
291
305
  * Copyright (c) 2022, Salesforce, Inc.,
292
306
  * All rights reserved.
@@ -294,23 +308,6 @@ function toError(x) {
294
308
  */
295
309
 
296
310
 
297
- function convertAuraResponseToData(responsePromise) {
298
- return responsePromise
299
- .then((response) => {
300
- return ok(response.getReturnValue());
301
- })
302
- .catch((error) => {
303
- if (!error || !error.getError) {
304
- return err(toError('Failed to get error from response'));
305
- }
306
- const actionErrors = error.getError();
307
- if (actionErrors.length > 0) {
308
- return err(toError(actionErrors[0]));
309
- }
310
- return err(toError('Error fetching component'));
311
- });
312
- }
313
-
314
311
  /**
315
312
  * An implementation of NetworkCommand that uses Aura as the transport mechanism
316
313
  */
@@ -325,8 +322,27 @@ class AuraNetworkCommand extends NetworkCommand {
325
322
  storable: false,
326
323
  };
327
324
  }
325
+ coerceAuraErrors(auraErrors) {
326
+ return toError(auraErrors[0]); // Default Implmentation stringifies the response
327
+ }
328
+ convertAuraResponseToData(responsePromise, coerceError) {
329
+ return responsePromise
330
+ .then((response) => {
331
+ return ok(response.getReturnValue());
332
+ })
333
+ .catch((error) => {
334
+ if (!error || !error.getError) {
335
+ return err(toError('Failed to get error from response'));
336
+ }
337
+ const actionErrors = error.getError();
338
+ if (actionErrors.length > 0) {
339
+ return err(coerceError(actionErrors));
340
+ }
341
+ return err(toError('Error fetching component'));
342
+ });
343
+ }
328
344
  fetch() {
329
- return convertAuraResponseToData(this.services.auraNetwork(this.endpoint, this.auraParams, this.actionConfig));
345
+ return this.convertAuraResponseToData(this.services.auraNetwork(this.endpoint, this.auraParams, this.actionConfig), this.coerceAuraErrors);
330
346
  }
331
347
  }
332
348
 
@@ -402,9 +418,12 @@ class AuraResourceCacheControlCommand extends CacheControlCommand {
402
418
  return resolvedPromiseLike(ok((_a = cache.get(this.buildKey())) === null || _a === void 0 ? void 0 : _a.value));
403
419
  }
404
420
  requestFromNetwork() {
405
- return this.convertAuraResponseToData(this.services.auraNetwork(this.endpoint, this.auraParams, this.actionConfig));
421
+ return this.convertAuraResponseToData(this.services.auraNetwork(this.endpoint, this.auraParams, this.actionConfig), this.coerceError);
406
422
  }
407
- convertAuraResponseToData(responsePromise) {
423
+ coerceError(auraErrors) {
424
+ return toError(auraErrors[0]); // Default Implementation stringifies the response
425
+ }
426
+ convertAuraResponseToData(responsePromise, coerceError) {
408
427
  return responsePromise
409
428
  .then((response) => {
410
429
  return ok(response.getReturnValue());
@@ -415,7 +434,7 @@ class AuraResourceCacheControlCommand extends CacheControlCommand {
415
434
  }
416
435
  const actionErrors = error.getError();
417
436
  if (actionErrors.length > 0) {
418
- return err(new AuraError(actionErrors));
437
+ return err(coerceError(actionErrors));
419
438
  }
420
439
  return err(toError('Error fetching component'));
421
440
  });
@@ -433,12 +452,6 @@ class AuraResourceCacheControlCommand extends CacheControlCommand {
433
452
  return `{"endpoint":${this.endpoint},"params":${stableJSONStringify$2(this.auraParams)}}`;
434
453
  }
435
454
  }
436
- class AuraError extends Error {
437
- constructor(data) {
438
- super();
439
- this.data = data;
440
- }
441
- }
442
455
 
443
456
  function buildServiceDescriptor$8() {
444
457
  return {
@@ -464,15 +477,18 @@ class FetchNetworkCommand extends NetworkCommand {
464
477
  this.services = services;
465
478
  }
466
479
  fetch() {
467
- return this.convertFetchResponseToData(this.services.fetch(...this.fetchParams));
480
+ return this.convertFetchResponseToData(this.services.fetch(...this.fetchParams), this.coerceError);
481
+ }
482
+ async coerceError(errorResponse) {
483
+ return toError(errorResponse.statusText); // Default Behavior
468
484
  }
469
- convertFetchResponseToData(response) {
485
+ convertFetchResponseToData(response, coerceError) {
470
486
  return response.then((response) => {
471
487
  if (response.ok) {
472
488
  return response.json().then((json) => ok(json), (reason) => err(toError(reason)));
473
489
  }
474
490
  else {
475
- return err(toError(response.statusText));
491
+ return coerceError(response).then((coercedError) => err(coercedError));
476
492
  }
477
493
  }, (reason) => err(toError(reason)));
478
494
  }
@@ -1277,6 +1293,20 @@ function loggerService(level, printer, formatter) {
1277
1293
  return new ConsoleLogger(level, printer, formatter);
1278
1294
  }
1279
1295
 
1296
+ var HttpStatusCode;
1297
+ (function (HttpStatusCode) {
1298
+ HttpStatusCode[HttpStatusCode["Ok"] = 200] = "Ok";
1299
+ HttpStatusCode[HttpStatusCode["Created"] = 201] = "Created";
1300
+ HttpStatusCode[HttpStatusCode["NoContent"] = 204] = "NoContent";
1301
+ HttpStatusCode[HttpStatusCode["NotModified"] = 304] = "NotModified";
1302
+ HttpStatusCode[HttpStatusCode["BadRequest"] = 400] = "BadRequest";
1303
+ HttpStatusCode[HttpStatusCode["Unauthorized"] = 401] = "Unauthorized";
1304
+ HttpStatusCode[HttpStatusCode["Forbidden"] = 403] = "Forbidden";
1305
+ HttpStatusCode[HttpStatusCode["NotFound"] = 404] = "NotFound";
1306
+ HttpStatusCode[HttpStatusCode["ServerError"] = 500] = "ServerError";
1307
+ HttpStatusCode[HttpStatusCode["GatewayTimeout"] = 504] = "GatewayTimeout";
1308
+ })(HttpStatusCode || (HttpStatusCode = {}));
1309
+
1280
1310
  /**
1281
1311
  * Represents a JWT token with its decoded info and optional extra info.
1282
1312
  *
@@ -1683,7 +1713,7 @@ const platformSfapJwtResolver = {
1683
1713
  }
1684
1714
  // AuraFetchResponse errors
1685
1715
  const { status } = error;
1686
- if (status !== HttpStatusCode.ServerError) {
1716
+ if (status !== HttpStatusCode$2.ServerError) {
1687
1717
  // ConnectInJavaError
1688
1718
  reject(error.body.message);
1689
1719
  return;
@@ -4345,7 +4375,7 @@ function getEnvironmentSetting(name) {
4345
4375
  }
4346
4376
  return undefined;
4347
4377
  }
4348
- // version: 1.329.1-c9b166ef17
4378
+ // version: 1.331.0-e9c482e8ab
4349
4379
 
4350
4380
  const forceRecordTransactionsDisabled = getEnvironmentSetting(EnvironmentSettings.ForceRecordTransactionsDisabled);
4351
4381
  //TODO: Some duplication here that can be most likely moved to a util class
@@ -5044,4 +5074,4 @@ function ldsEngineCreator() {
5044
5074
  }
5045
5075
 
5046
5076
  export { LexRequestStrategy, PdlRequestPriority, buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore, registerRequestStrategy, saveRequestAsPrediction, unregisterRequestStrategy, whenPredictionsReady };
5047
- // version: 1.329.1-0d03c6aeee
5077
+ // version: 1.331.0-fec0cd0317
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-aura",
3
- "version": "1.329.1",
3
+ "version": "1.331.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS engine for Aura runtime",
6
6
  "main": "dist/ldsEngineCreator.js",
@@ -34,42 +34,42 @@
34
34
  "release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-aura"
35
35
  },
36
36
  "devDependencies": {
37
- "@luvio/service-provisioner": "5.21.0",
38
- "@salesforce/lds-adapters-apex": "^1.329.1",
39
- "@salesforce/lds-adapters-uiapi": "^1.329.1",
37
+ "@luvio/service-provisioner": "5.23.0",
38
+ "@salesforce/lds-adapters-apex": "^1.331.0",
39
+ "@salesforce/lds-adapters-uiapi": "^1.331.0",
40
40
  "@salesforce/lds-adapters-uiapi-lex": "^1.302.0",
41
- "@salesforce/lds-ads-bridge": "^1.329.1",
42
- "@salesforce/lds-aura-storage": "^1.329.1",
43
- "@salesforce/lds-bindings": "^1.329.1",
44
- "@salesforce/lds-instrumentation": "^1.329.1",
45
- "@salesforce/lds-network-aura": "^1.329.1",
46
- "@salesforce/lds-network-fetch-with-jwt": "^1.329.1",
41
+ "@salesforce/lds-ads-bridge": "^1.331.0",
42
+ "@salesforce/lds-aura-storage": "^1.331.0",
43
+ "@salesforce/lds-bindings": "^1.331.0",
44
+ "@salesforce/lds-instrumentation": "^1.331.0",
45
+ "@salesforce/lds-network-aura": "^1.331.0",
46
+ "@salesforce/lds-network-fetch-with-jwt": "^1.331.0",
47
47
  "jwt-encode": "1.0.1"
48
48
  },
49
49
  "dependencies": {
50
- "@luvio/command-aura-network": "5.21.0",
51
- "@luvio/command-aura-resource-cache-control": "5.21.0",
52
- "@luvio/command-fetch-network": "5.21.0",
53
- "@luvio/command-network": "5.21.0",
54
- "@luvio/command-sse": "5.21.0",
55
- "@luvio/command-streaming": "5.21.0",
50
+ "@luvio/command-aura-network": "5.23.0",
51
+ "@luvio/command-aura-resource-cache-control": "5.23.0",
52
+ "@luvio/command-fetch-network": "5.23.0",
53
+ "@luvio/command-network": "5.23.0",
54
+ "@luvio/command-sse": "5.23.0",
55
+ "@luvio/command-streaming": "5.23.0",
56
56
  "@luvio/network-adapter-composable": "0.156.5",
57
57
  "@luvio/network-adapter-fetch": "0.156.5",
58
- "@luvio/service-aura-network": "5.21.0",
59
- "@luvio/service-cache": "5.21.0",
60
- "@luvio/service-cache-control": "5.21.0",
61
- "@luvio/service-fetch-network": "5.21.0",
62
- "@luvio/service-instrument-command": "5.21.0",
63
- "@luvio/service-store": "5.21.0",
64
- "@luvio/utils": "5.21.0",
65
- "@salesforce/lds-adapters-uiapi-lex": "^1.329.1"
58
+ "@luvio/service-aura-network": "5.23.0",
59
+ "@luvio/service-cache": "5.23.0",
60
+ "@luvio/service-cache-control": "5.23.0",
61
+ "@luvio/service-fetch-network": "5.23.0",
62
+ "@luvio/service-instrument-command": "5.23.0",
63
+ "@luvio/service-store": "5.23.0",
64
+ "@luvio/utils": "5.23.0",
65
+ "@salesforce/lds-adapters-uiapi-lex": "^1.331.0"
66
66
  },
67
67
  "luvioBundlesize": [
68
68
  {
69
69
  "path": "./dist/ldsEngineCreator.js",
70
70
  "maxSize": {
71
- "none": "189 kB",
72
- "min": "78.5 kB",
71
+ "none": "191 kB",
72
+ "min": "79.5 kB",
73
73
  "compressed": "34 kB"
74
74
  }
75
75
  }