@salesforce/lds-runtime-aura 1.351.0 → 1.352.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 +115 -47
  2. package/package.json +31 -30
@@ -40,48 +40,6 @@ import { createStorage, clearStorages } from 'force/ldsStorage';
40
40
  import useHttpInsteadAuraTransport from '@salesforce/gate/lds.useHttpInsteadAuraTransport';
41
41
  import { ThirdPartyTracker } from 'instrumentation:beaconLib';
42
42
 
43
- /**
44
- * Copyright (c) 2022, Salesforce, Inc.,
45
- * All rights reserved.
46
- * For full license text, see the LICENSE.txt file
47
- */
48
-
49
- /**
50
- * BaseCommand is an abstract implementation of SubscribableCommand. It adds the
51
- * notions of typed configuration, request context, and a set of runtime services
52
- * to the contract defined by Command/SubscribableCommand.
53
- */
54
- class BaseCommand {
55
- }
56
-
57
- /**
58
- * Copyright (c) 2022, Salesforce, Inc.,
59
- * All rights reserved.
60
- * For full license text, see the LICENSE.txt file
61
- */
62
-
63
-
64
- /**
65
- * An implementation of BaseCommand that makes network requests but does not try to
66
- * use the store.
67
- */
68
- class NetworkCommand extends BaseCommand {
69
- constructor(services) {
70
- super();
71
- this.services = services;
72
- }
73
- execute() {
74
- return this.fetch();
75
- }
76
- }
77
- function buildServiceDescriptor$d() {
78
- return {
79
- type: 'networkCommandBaseClass',
80
- version: '1.0',
81
- service: NetworkCommand,
82
- };
83
- }
84
-
85
43
  /**
86
44
  * Copyright (c) 2022, Salesforce, Inc.,
87
45
  * All rights reserved.
@@ -89,7 +47,7 @@ function buildServiceDescriptor$d() {
89
47
  */
90
48
 
91
49
 
92
- const { create: create$1, freeze, keys: keys$2 } = Object;
50
+ const { create: create$1, freeze, keys: keys$2, entries: entries$1 } = Object;
93
51
  const { isArray: isArray$2 } = Array;
94
52
  const { stringify: stringify$1, parse } = JSON;
95
53
 
@@ -159,6 +117,26 @@ class Err {
159
117
  }
160
118
  const ok = (value) => new Ok(value);
161
119
  const err = (err) => new Err(err);
120
+ function isSubscribableResult(x) {
121
+ if (typeof x !== 'object' || x === null) {
122
+ return false;
123
+ }
124
+ if ('isOk' in x && typeof x.isOk === 'function') {
125
+ if (x.isOk()) {
126
+ return ('value' in x &&
127
+ typeof x.value === 'object' &&
128
+ x.value !== null &&
129
+ 'subscribe' in x.value &&
130
+ typeof x.value.subscribe === 'function' &&
131
+ 'refresh' in x.value &&
132
+ typeof x.value.refresh === 'function');
133
+ }
134
+ else {
135
+ return 'error' in x;
136
+ }
137
+ }
138
+ return false;
139
+ }
162
140
 
163
141
  /**
164
142
  * Returns a PromiseLike object that resolves with the specified result.
@@ -358,6 +336,88 @@ var HttpStatusCode$2;
358
336
  HttpStatusCode[HttpStatusCode["GatewayTimeout"] = 504] = "GatewayTimeout";
359
337
  })(HttpStatusCode$2 || (HttpStatusCode$2 = {}));
360
338
 
339
+ /**
340
+ * Copyright (c) 2022, Salesforce, Inc.,
341
+ * All rights reserved.
342
+ * For full license text, see the LICENSE.txt file
343
+ */
344
+
345
+ /**
346
+ * BaseCommand is an abstract implementation of SubscribableCommand. It adds the
347
+ * notions of typed configuration, request context, and a set of runtime services
348
+ * to the contract defined by Command/SubscribableCommand.
349
+ */
350
+ class BaseCommand {
351
+ }
352
+
353
+ /**
354
+ * Copyright (c) 2022, Salesforce, Inc.,
355
+ * All rights reserved.
356
+ * For full license text, see the LICENSE.txt file
357
+ */
358
+
359
+
360
+ /**
361
+ * An implementation of BaseCommand that makes network requests but does not try to
362
+ * use the store.
363
+ */
364
+ class NetworkCommand extends BaseCommand {
365
+ constructor(services) {
366
+ super();
367
+ this.services = services;
368
+ this.subscriptions = [];
369
+ this.exposeSubscribeAndRefresh = false;
370
+ }
371
+ execute() {
372
+ const result = this.fetch();
373
+ if (this.exposeSubscribeAndRefresh) {
374
+ return this.fetchSubscribableResult(result);
375
+ }
376
+ return result;
377
+ }
378
+ fetchSubscribableResult(res) {
379
+ return res.then((networkResult) => {
380
+ if (networkResult.isErr()) {
381
+ return err(networkResult.error);
382
+ }
383
+ else {
384
+ const data = networkResult.value;
385
+ return ok({
386
+ data,
387
+ subscribe: (cb) => {
388
+ this.subscriptions.push(cb);
389
+ return () => {
390
+ this.subscriptions = this.subscriptions.filter((cb2) => cb2 !== cb);
391
+ };
392
+ },
393
+ refresh: () => this.refresh(),
394
+ });
395
+ }
396
+ });
397
+ }
398
+ refresh() {
399
+ return this.execute().then((newResult) => {
400
+ if (newResult.isOk()) {
401
+ if (isSubscribableResult(newResult)) {
402
+ const value = newResult.value;
403
+ this.subscriptions.forEach((cb) => {
404
+ cb(ok(value.data));
405
+ });
406
+ }
407
+ return ok(undefined);
408
+ }
409
+ return err(newResult.error);
410
+ });
411
+ }
412
+ }
413
+ function buildServiceDescriptor$d() {
414
+ return {
415
+ type: 'networkCommandBaseClass',
416
+ version: '1.0',
417
+ service: NetworkCommand,
418
+ };
419
+ }
420
+
361
421
  /**
362
422
  * Copyright (c) 2022, Salesforce, Inc.,
363
423
  * All rights reserved.
@@ -454,6 +514,14 @@ class CacheControlCommand extends BaseCommand {
454
514
  writeToCache: (networkResult) => this.writeToCacheAndPublish(cache, networkResult),
455
515
  };
456
516
  }
517
+ refresh() {
518
+ return this.execute({ cacheControlConfig: { type: 'no-cache' } }).then((res) => {
519
+ if (res.isOk()) {
520
+ return ok(undefined);
521
+ }
522
+ return err(res.error);
523
+ });
524
+ }
457
525
  // TODO: This is added as a temporary measure for ensuring that cache write events are
458
526
  // published to pubSub. A follow-up will be required to find the right home for this logic.
459
527
  writeToCacheAndPublish(cache, networkResult) {
@@ -482,6 +550,7 @@ class CacheControlCommand extends BaseCommand {
482
550
  return ok({
483
551
  data,
484
552
  subscribe: this.buildSubscribe(),
553
+ refresh: () => this.refresh(),
485
554
  });
486
555
  }
487
556
  return ok(undefined);
@@ -1596,8 +1665,7 @@ class CacheControlStrategy {
1596
1665
  return [
1597
1666
  (cacheControlMetadata) => cacheControlMetadata.type === 'max-age' &&
1598
1667
  this.config.now > cacheControlMetadata.generatedTime + cacheControlMetadata.maxAge,
1599
- (cacheControlMetadata) => cacheControlMetadata.type === 'no-cache' ||
1600
- cacheControlMetadata.type === 'no-store',
1668
+ (cacheControlMetadata) => cacheControlMetadata.type === 'no-store',
1601
1669
  ];
1602
1670
  }
1603
1671
  }
@@ -5454,7 +5522,7 @@ function getEnvironmentSetting(name) {
5454
5522
  }
5455
5523
  return undefined;
5456
5524
  }
5457
- // version: 1.351.0-6576e8aaf1
5525
+ // version: 1.352.0-abe5da40fa
5458
5526
 
5459
5527
  const forceRecordTransactionsDisabled = getEnvironmentSetting(EnvironmentSettings.ForceRecordTransactionsDisabled);
5460
5528
  //TODO: Some duplication here that can be most likely moved to a util class
@@ -6146,4 +6214,4 @@ function ldsEngineCreator() {
6146
6214
  }
6147
6215
 
6148
6216
  export { LexRequestStrategy, PdlRequestPriority, buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore, registerRequestStrategy, saveRequestAsPrediction, unregisterRequestStrategy, whenPredictionsReady };
6149
- // version: 1.351.0-0449b64264
6217
+ // version: 1.352.0-9307541b03
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-aura",
3
- "version": "1.351.0",
3
+ "version": "1.352.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS engine for Aura runtime",
6
6
  "main": "dist/ldsEngineCreator.js",
@@ -34,46 +34,47 @@
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.33.0",
38
- "@salesforce/lds-adapters-apex": "^1.351.0",
39
- "@salesforce/lds-adapters-uiapi": "^1.351.0",
37
+ "@luvio/service-provisioner": "5.36.0",
38
+ "@luvio/tools-core": "5.36.0",
39
+ "@salesforce/lds-adapters-apex": "^1.352.0",
40
+ "@salesforce/lds-adapters-uiapi": "^1.352.0",
40
41
  "@salesforce/lds-adapters-uiapi-lex": "^1.302.0",
41
- "@salesforce/lds-ads-bridge": "^1.351.0",
42
- "@salesforce/lds-aura-storage": "^1.351.0",
43
- "@salesforce/lds-bindings": "^1.351.0",
44
- "@salesforce/lds-instrumentation": "^1.351.0",
45
- "@salesforce/lds-network-aura": "^1.351.0",
46
- "@salesforce/lds-network-fetch": "^1.351.0",
42
+ "@salesforce/lds-ads-bridge": "^1.352.0",
43
+ "@salesforce/lds-aura-storage": "^1.352.0",
44
+ "@salesforce/lds-bindings": "^1.352.0",
45
+ "@salesforce/lds-instrumentation": "^1.352.0",
46
+ "@salesforce/lds-network-aura": "^1.352.0",
47
+ "@salesforce/lds-network-fetch": "^1.352.0",
47
48
  "jwt-encode": "1.0.1"
48
49
  },
49
50
  "dependencies": {
50
- "@luvio/command-aura-network": "5.33.0",
51
- "@luvio/command-aura-normalized-cache-control": "5.33.0",
52
- "@luvio/command-aura-resource-cache-control": "5.33.0",
53
- "@luvio/command-fetch-network": "5.33.0",
54
- "@luvio/command-http-normalized-cache-control": "5.33.0",
55
- "@luvio/command-network": "5.33.0",
56
- "@luvio/command-sse": "5.33.0",
57
- "@luvio/command-streaming": "5.33.0",
51
+ "@luvio/command-aura-network": "5.36.0",
52
+ "@luvio/command-aura-normalized-cache-control": "5.36.0",
53
+ "@luvio/command-aura-resource-cache-control": "5.36.0",
54
+ "@luvio/command-fetch-network": "5.36.0",
55
+ "@luvio/command-http-normalized-cache-control": "5.36.0",
56
+ "@luvio/command-network": "5.36.0",
57
+ "@luvio/command-sse": "5.36.0",
58
+ "@luvio/command-streaming": "5.36.0",
58
59
  "@luvio/network-adapter-composable": "0.156.7",
59
60
  "@luvio/network-adapter-fetch": "0.156.7",
60
- "@luvio/service-aura-network": "5.33.0",
61
- "@luvio/service-cache": "5.33.0",
62
- "@luvio/service-cache-control": "5.33.0",
63
- "@luvio/service-fetch-network": "5.33.0",
64
- "@luvio/service-instrument-command": "5.33.0",
65
- "@luvio/service-pubsub": "5.33.0",
66
- "@luvio/service-store": "5.33.0",
67
- "@luvio/utils": "5.33.0",
68
- "@salesforce/lds-adapters-uiapi-lex": "^1.351.0"
61
+ "@luvio/service-aura-network": "5.36.0",
62
+ "@luvio/service-cache": "5.36.0",
63
+ "@luvio/service-cache-control": "5.36.0",
64
+ "@luvio/service-fetch-network": "5.36.0",
65
+ "@luvio/service-instrument-command": "5.36.0",
66
+ "@luvio/service-pubsub": "5.36.0",
67
+ "@luvio/service-store": "5.36.0",
68
+ "@luvio/utils": "5.36.0",
69
+ "@salesforce/lds-adapters-uiapi-lex": "^1.352.0"
69
70
  },
70
71
  "luvioBundlesize": [
71
72
  {
72
73
  "path": "./dist/ldsEngineCreator.js",
73
74
  "maxSize": {
74
- "none": "229.5 kB",
75
- "min": "94.7 kB",
76
- "compressed": "39.5 kB"
75
+ "none": "232 kB",
76
+ "min": "96 kB",
77
+ "compressed": "39.7 kB"
77
78
  }
78
79
  }
79
80
  ],