@salesforce/lds-runtime-aura 1.356.0 → 1.358.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.
Files changed (2) hide show
  1. package/dist/ldsEngineCreator.js +110 -26
  2. package/package.json +32 -31
@@ -151,7 +151,7 @@ function resolvedPromiseLike(result) {
151
151
  }
152
152
  return {
153
153
  then: (onFulfilled, _onRejected) => {
154
- if (onFulfilled) {
154
+ if (typeof onFulfilled === 'function') {
155
155
  try {
156
156
  return resolvedPromiseLike(onFulfilled(result));
157
157
  }
@@ -176,7 +176,7 @@ function rejectedPromiseLike(reason) {
176
176
  }
177
177
  return {
178
178
  then: (_onFulfilled, onRejected) => {
179
- if (onRejected) {
179
+ if (typeof onRejected === 'function') {
180
180
  try {
181
181
  return resolvedPromiseLike(onRejected(reason));
182
182
  }
@@ -411,7 +411,7 @@ class NetworkCommand extends BaseCommand {
411
411
  }
412
412
  async afterRequestHooks(_options) { }
413
413
  }
414
- function buildServiceDescriptor$d() {
414
+ function buildServiceDescriptor$e() {
415
415
  return {
416
416
  type: 'networkCommandBaseClass',
417
417
  version: '1.0',
@@ -473,7 +473,7 @@ class AuraNetworkCommand extends NetworkCommand {
473
473
  }
474
474
  }
475
475
 
476
- function buildServiceDescriptor$c() {
476
+ function buildServiceDescriptor$d() {
477
477
  return {
478
478
  type: 'auraNetworkCommandBaseClass',
479
479
  version: '1.0',
@@ -787,7 +787,7 @@ class AuraResourceCacheControlCommand extends AuraCacheControlCommand {
787
787
  }
788
788
  }
789
789
 
790
- function buildServiceDescriptor$b() {
790
+ function buildServiceDescriptor$c() {
791
791
  return {
792
792
  type: 'auraResourceCacheControlCommand',
793
793
  version: '1.0',
@@ -829,7 +829,7 @@ class AuraNormalizedCacheControlCommand extends AuraCacheControlCommand {
829
829
  }
830
830
  }
831
831
 
832
- function buildServiceDescriptor$a() {
832
+ function buildServiceDescriptor$b() {
833
833
  return {
834
834
  type: 'auraNormalizedCacheControlCommand',
835
835
  version: '1.0',
@@ -928,7 +928,7 @@ class HttpNormalizedCacheControlCommand extends HttpCacheControlCommand {
928
928
  }
929
929
  }
930
930
 
931
- function buildServiceDescriptor$9() {
931
+ function buildServiceDescriptor$a() {
932
932
  return {
933
933
  type: 'httpNormalizedCacheControlCommand',
934
934
  version: '1.0',
@@ -986,7 +986,7 @@ class FetchNetworkCommand extends NetworkCommand {
986
986
  }
987
987
  }
988
988
 
989
- function buildServiceDescriptor$8() {
989
+ function buildServiceDescriptor$9() {
990
990
  return {
991
991
  type: 'fetchNetworkCommandBaseClass',
992
992
  version: '1.0',
@@ -1024,7 +1024,7 @@ class StreamingCommand extends BaseCommand {
1024
1024
  }
1025
1025
  }
1026
1026
 
1027
- function buildServiceDescriptor$7() {
1027
+ function buildServiceDescriptor$8() {
1028
1028
  return {
1029
1029
  type: 'streamingCommandBaseClass',
1030
1030
  version: '1.0',
@@ -1068,6 +1068,10 @@ const sseRegex = /^(?<field>[^:]*?)(: ?(?<value>.*?))?(?:\r\n?|\n)/;
1068
1068
  // | ": value", or ": comment" if no field name (optional)
1069
1069
  // |
1070
1070
  // field name (optional); can be entire line if no ":"
1071
+ /**
1072
+ * A TransformStream that parses server-sent event (SSE) data according to the SSE spec:
1073
+ * https://html.spec.whatwg.org/multipage/server-sent-events.html
1074
+ */
1071
1075
  class SSEParsingStream extends TransformStream {
1072
1076
  constructor() {
1073
1077
  let ignoreLeadingLF = false, partialLine = '', data = '', event = '', id = '', retry;
@@ -1140,7 +1144,7 @@ class SSEParsingStream extends TransformStream {
1140
1144
  }
1141
1145
  }
1142
1146
 
1143
- function buildServiceDescriptor$6() {
1147
+ function buildServiceDescriptor$7() {
1144
1148
  return {
1145
1149
  type: 'SSECommandBaseClass',
1146
1150
  version: '1.0',
@@ -1190,7 +1194,7 @@ function buildInstrumentCommand(services) {
1190
1194
  };
1191
1195
  }
1192
1196
 
1193
- function buildServiceDescriptor$5(instrumentation) {
1197
+ function buildServiceDescriptor$6(instrumentation) {
1194
1198
  return {
1195
1199
  type: 'instrumentCommand',
1196
1200
  version: '1.0',
@@ -1456,7 +1460,7 @@ class O11yInstrumentation {
1456
1460
  this.metrics = new O11yOTelMetricsAPI(this.services);
1457
1461
  }
1458
1462
  }
1459
- function buildServiceDescriptor$4(logger) {
1463
+ function buildServiceDescriptor$5(logger) {
1460
1464
  return {
1461
1465
  type: 'instrumentation',
1462
1466
  version: '1.0',
@@ -1715,7 +1719,7 @@ class DefaultCache {
1715
1719
  }
1716
1720
  }
1717
1721
 
1718
- function buildServiceDescriptor$3() {
1722
+ function buildServiceDescriptor$4() {
1719
1723
  return {
1720
1724
  type: 'cache',
1721
1725
  version: '1.0',
@@ -1750,6 +1754,8 @@ class CacheControlStrategy {
1750
1754
  this.config.now > cacheControlMetadata.generatedTime + cacheControlMetadata.maxAge,
1751
1755
  (cacheControlMetadata) => cacheControlMetadata.type === 'max-age' && cacheControlMetadata.maxAge <= 0,
1752
1756
  (cacheControlMetadata) => cacheControlMetadata.type === 'no-store',
1757
+ (cacheControlMetadata) => cacheControlMetadata.type === 'no-cache' &&
1758
+ cacheControlMetadata.generatedTime < this.config.now,
1753
1759
  ];
1754
1760
  }
1755
1761
  }
@@ -1994,7 +2000,7 @@ class CacheController {
1994
2000
  }
1995
2001
  }
1996
2002
 
1997
- function buildServiceDescriptor$2(cache) {
2003
+ function buildServiceDescriptor$3(cache) {
1998
2004
  return {
1999
2005
  type: 'cacheController',
2000
2006
  version: '1.0',
@@ -2063,7 +2069,7 @@ class DefaultPubSubService {
2063
2069
  *
2064
2070
  * @returns default PubSubServiceDescriptor
2065
2071
  */
2066
- function buildServiceDescriptor$1() {
2072
+ function buildServiceDescriptor$2() {
2067
2073
  return {
2068
2074
  type: 'pubSub',
2069
2075
  version: '1.0',
@@ -2071,6 +2077,83 @@ function buildServiceDescriptor$1() {
2071
2077
  };
2072
2078
  }
2073
2079
 
2080
+ /**
2081
+ * Copyright (c) 2022, Salesforce, Inc.,
2082
+ * All rights reserved.
2083
+ * For full license text, see the LICENSE.txt file
2084
+ */
2085
+
2086
+
2087
+ /**
2088
+ * An implementation of StreamingCommand that handles NDJSON streams.
2089
+ */
2090
+ class NDJSONCommand extends StreamingCommand {
2091
+ constructor(services) {
2092
+ super(services);
2093
+ this.services = services;
2094
+ }
2095
+ /**
2096
+ * Decodes the bytes returned by fetch into the correct shape.
2097
+ *
2098
+ * @param byteStream ReadableStream<Uint8Array> returned by fetch
2099
+ * @returns ReadableStream<T> that will be the result of the Command
2100
+ */
2101
+ decodeByteStream(byteStream) {
2102
+ return this.decodeNDJSONStream(byteStream
2103
+ // eslint-disable-next-line no-undef
2104
+ .pipeThrough(new TextDecoderStream())
2105
+ .pipeThrough(new NDJSONParsingStream()));
2106
+ }
2107
+ }
2108
+ /**
2109
+ * A TransformStream that parses NDJSON data according to the NDJSON spec:
2110
+ * https://github.com/ndjson/ndjson-spec
2111
+ */
2112
+ class NDJSONParsingStream extends TransformStream {
2113
+ constructor() {
2114
+ let partialLine = '';
2115
+ super({
2116
+ transform(chunk, controller) {
2117
+ const text = partialLine + chunk;
2118
+ const lines = text.split(/\r?\n/);
2119
+ partialLine = lines.pop() || '';
2120
+ for (const line of lines) {
2121
+ const trimmed = line.trim();
2122
+ if (trimmed === '')
2123
+ continue;
2124
+ try {
2125
+ const parsed = JSON.parse(trimmed);
2126
+ controller.enqueue(parsed);
2127
+ }
2128
+ catch (e) {
2129
+ throw new Error(`Invalid NDJSON line: ${line}`);
2130
+ }
2131
+ }
2132
+ },
2133
+ flush(controller) {
2134
+ const trimmed = partialLine.trim();
2135
+ if (trimmed !== '') {
2136
+ try {
2137
+ const parsed = JSON.parse(trimmed);
2138
+ controller.enqueue(parsed);
2139
+ }
2140
+ catch (e) {
2141
+ throw new Error(`Invalid NDJSON final line: ${partialLine}`);
2142
+ }
2143
+ }
2144
+ },
2145
+ });
2146
+ }
2147
+ }
2148
+
2149
+ function buildServiceDescriptor$1() {
2150
+ return {
2151
+ type: 'NDJSONCommandBaseClass',
2152
+ version: '1.0',
2153
+ service: NDJSONCommand,
2154
+ };
2155
+ }
2156
+
2074
2157
  /**
2075
2158
  * Copyright (c) 2022, Salesforce, Inc.,
2076
2159
  * All rights reserved.
@@ -5606,7 +5689,7 @@ function getEnvironmentSetting(name) {
5606
5689
  }
5607
5690
  return undefined;
5608
5691
  }
5609
- // version: 1.356.0-d412b8de3d
5692
+ // version: 1.358.0-abc73971a1
5610
5693
 
5611
5694
  const forceRecordTransactionsDisabled = getEnvironmentSetting(EnvironmentSettings.ForceRecordTransactionsDisabled);
5612
5695
  //TODO: Some duplication here that can be most likely moved to a util class
@@ -6257,25 +6340,26 @@ function initializeLDS() {
6257
6340
  // Initializes OneStore in LEX
6258
6341
  function initializeOneStore() {
6259
6342
  const loggerService = new ConsoleLogger$1('ERROR');
6260
- const cacheServiceDescriptor = buildServiceDescriptor$3();
6261
- const instrumentationServiceDescriptor = buildServiceDescriptor$4(loggerService);
6343
+ const cacheServiceDescriptor = buildServiceDescriptor$4();
6344
+ const instrumentationServiceDescriptor = buildServiceDescriptor$5(loggerService);
6262
6345
  const services = [
6263
6346
  instrumentationServiceDescriptor,
6264
6347
  buildUnauthorizedFetchServiceDescriptor(),
6265
6348
  buildJwtAuthorizedSfapFetchServiceDescriptor(loggerService),
6266
6349
  buildCopilotFetchServiceDescriptor(loggerService),
6267
6350
  buildAuraNetworkService(),
6268
- buildServiceDescriptor$5(instrumentationServiceDescriptor.service),
6269
- buildServiceDescriptor$2(cacheServiceDescriptor.service),
6270
- buildServiceDescriptor$c(),
6271
- buildServiceDescriptor$8(),
6351
+ buildServiceDescriptor$6(instrumentationServiceDescriptor.service),
6352
+ buildServiceDescriptor$3(cacheServiceDescriptor.service),
6272
6353
  buildServiceDescriptor$d(),
6354
+ buildServiceDescriptor$1(),
6355
+ buildServiceDescriptor$9(),
6356
+ buildServiceDescriptor$e(),
6357
+ buildServiceDescriptor$8(),
6273
6358
  buildServiceDescriptor$7(),
6274
- buildServiceDescriptor$6(),
6359
+ buildServiceDescriptor$c(),
6275
6360
  buildServiceDescriptor$b(),
6276
6361
  buildServiceDescriptor$a(),
6277
- buildServiceDescriptor$9(),
6278
- buildServiceDescriptor$1(),
6362
+ buildServiceDescriptor$2(),
6279
6363
  ];
6280
6364
  setServices(services);
6281
6365
  }
@@ -6298,4 +6382,4 @@ function ldsEngineCreator() {
6298
6382
  }
6299
6383
 
6300
6384
  export { LexRequestStrategy, PdlRequestPriority, buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore, registerRequestStrategy, saveRequestAsPrediction, unregisterRequestStrategy, whenPredictionsReady };
6301
- // version: 1.356.0-5a2e6cd82a
6385
+ // version: 1.358.0-d83368bac0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-aura",
3
- "version": "1.356.0",
3
+ "version": "1.358.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS engine for Aura runtime",
6
6
  "main": "dist/ldsEngineCreator.js",
@@ -34,47 +34,48 @@
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.38.2",
38
- "@luvio/tools-core": "5.38.2",
39
- "@salesforce/lds-adapters-apex": "^1.356.0",
40
- "@salesforce/lds-adapters-uiapi": "^1.356.0",
37
+ "@luvio/service-provisioner": " 5.39.0",
38
+ "@luvio/tools-core": " 5.39.0",
39
+ "@salesforce/lds-adapters-apex": "^1.358.0",
40
+ "@salesforce/lds-adapters-uiapi": "^1.358.0",
41
41
  "@salesforce/lds-adapters-uiapi-lex": "^1.302.0",
42
- "@salesforce/lds-ads-bridge": "^1.356.0",
43
- "@salesforce/lds-aura-storage": "^1.356.0",
44
- "@salesforce/lds-bindings": "^1.356.0",
45
- "@salesforce/lds-instrumentation": "^1.356.0",
46
- "@salesforce/lds-network-aura": "^1.356.0",
47
- "@salesforce/lds-network-fetch": "^1.356.0",
42
+ "@salesforce/lds-ads-bridge": "^1.358.0",
43
+ "@salesforce/lds-aura-storage": "^1.358.0",
44
+ "@salesforce/lds-bindings": "^1.358.0",
45
+ "@salesforce/lds-instrumentation": "^1.358.0",
46
+ "@salesforce/lds-network-aura": "^1.358.0",
47
+ "@salesforce/lds-network-fetch": "^1.358.0",
48
48
  "jwt-encode": "1.0.1"
49
49
  },
50
50
  "dependencies": {
51
- "@luvio/command-aura-network": "5.38.2",
52
- "@luvio/command-aura-normalized-cache-control": "5.38.2",
53
- "@luvio/command-aura-resource-cache-control": "5.38.2",
54
- "@luvio/command-fetch-network": "5.38.2",
55
- "@luvio/command-http-normalized-cache-control": "5.38.2",
56
- "@luvio/command-network": "5.38.2",
57
- "@luvio/command-sse": "5.38.2",
58
- "@luvio/command-streaming": "5.38.2",
51
+ "@luvio/command-aura-network": " 5.39.0",
52
+ "@luvio/command-aura-normalized-cache-control": " 5.39.0",
53
+ "@luvio/command-aura-resource-cache-control": " 5.39.0",
54
+ "@luvio/command-fetch-network": " 5.39.0",
55
+ "@luvio/command-http-normalized-cache-control": " 5.39.0",
56
+ "@luvio/command-ndjson": " 5.39.0",
57
+ "@luvio/command-network": " 5.39.0",
58
+ "@luvio/command-sse": " 5.39.0",
59
+ "@luvio/command-streaming": " 5.39.0",
59
60
  "@luvio/network-adapter-composable": "0.156.7",
60
61
  "@luvio/network-adapter-fetch": "0.156.7",
61
- "@luvio/service-aura-network": "5.38.2",
62
- "@luvio/service-cache": "5.38.2",
63
- "@luvio/service-cache-control": "5.38.2",
64
- "@luvio/service-fetch-network": "5.38.2",
65
- "@luvio/service-instrument-command": "5.38.2",
66
- "@luvio/service-pubsub": "5.38.2",
67
- "@luvio/service-store": "5.38.2",
68
- "@luvio/utils": "5.38.2",
69
- "@salesforce/lds-adapters-uiapi-lex": "^1.356.0"
62
+ "@luvio/service-aura-network": " 5.39.0",
63
+ "@luvio/service-cache": " 5.39.0",
64
+ "@luvio/service-cache-control": " 5.39.0",
65
+ "@luvio/service-fetch-network": " 5.39.0",
66
+ "@luvio/service-instrument-command": " 5.39.0",
67
+ "@luvio/service-pubsub": " 5.39.0",
68
+ "@luvio/service-store": " 5.39.0",
69
+ "@luvio/utils": " 5.39.0",
70
+ "@salesforce/lds-adapters-uiapi-lex": "^1.358.0"
70
71
  },
71
72
  "luvioBundlesize": [
72
73
  {
73
74
  "path": "./dist/ldsEngineCreator.js",
74
75
  "maxSize": {
75
- "none": "235 kB",
76
- "min": "97 kB",
77
- "compressed": "40 kB"
76
+ "none": "238 kB",
77
+ "min": "98 kB",
78
+ "compressed": "41 kB"
78
79
  }
79
80
  }
80
81
  ],