@salesforce/lds-runtime-webruntime 1.393.0 → 1.395.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.
@@ -586,12 +586,15 @@ class CacheControlCommand extends BaseCommand {
586
586
  this.services = services;
587
587
  this.keysUsed = /* @__PURE__ */ new Set();
588
588
  this.keysUpdated = void 0;
589
- this.operationType = "query";
589
+ this._isInternalExecution = false;
590
590
  this.lastResult = void 0;
591
591
  this.unsubscribeFromKeysImpl = () => void 0;
592
592
  this.subscriptions = [];
593
593
  this.instantiationTime = Date.now() / 1e3;
594
594
  }
595
+ get isInternalExecution() {
596
+ return this._isInternalExecution;
597
+ }
595
598
  execute(overrides) {
596
599
  this.keysUpdated = void 0;
597
600
  this.unsubscribeFromKeys();
@@ -636,9 +639,6 @@ class CacheControlCommand extends BaseCommand {
636
639
  }
637
640
  return buildSubscribableResult(result, this.buildSubscribe(), () => this.refresh());
638
641
  }
639
- if (this.subscriptions.length > 0) {
640
- this.subscribeToKeysUsed();
641
- }
642
642
  if (returnData === void 0) {
643
643
  if (networkData) {
644
644
  return buildSubscribableResult(
@@ -653,6 +653,9 @@ class CacheControlCommand extends BaseCommand {
653
653
  () => this.refresh()
654
654
  );
655
655
  }
656
+ if (this.subscriptions.length > 0) {
657
+ this.subscribeToKeysUsed();
658
+ }
656
659
  return returnData;
657
660
  });
658
661
  }
@@ -674,6 +677,9 @@ class CacheControlCommand extends BaseCommand {
674
677
  }
675
678
  return resolvedPromiseLike$2(void 0);
676
679
  }
680
+ get operationType() {
681
+ return "query";
682
+ }
677
683
  subscribeToKeysUsed() {
678
684
  this.unsubscribeFromKeys();
679
685
  const { pubSub } = this.services;
@@ -756,7 +762,7 @@ class CacheControlCommand extends BaseCommand {
756
762
  */
757
763
  buildSubscribe() {
758
764
  return (consumerCallback) => {
759
- if (this.subscriptions.length === 0 && (this.operationType === "query" || this.operationType === "graphql")) {
765
+ if (this.subscriptions.length === 0 && this.operationType === "query") {
760
766
  this.subscribeToKeysUsed();
761
767
  }
762
768
  this.subscriptions.push(consumerCallback);
@@ -769,7 +775,9 @@ class CacheControlCommand extends BaseCommand {
769
775
  };
770
776
  }
771
777
  rerun(overrides) {
778
+ this._isInternalExecution = true;
772
779
  return this.execute(overrides).then((result) => {
780
+ this._isInternalExecution = false;
773
781
  if (result.isErr()) {
774
782
  this.lastResult = { type: "error", error: result.error.failure };
775
783
  this.invokeConsumerCallbacks(err(result.error.failure));
@@ -1231,7 +1239,82 @@ class NetworkCommand extends BaseCommand {
1231
1239
  async afterRequestHooks(_options) {
1232
1240
  }
1233
1241
  }
1234
- class FetchNetworkCommand extends NetworkCommand {
1242
+ function isAbortableCommand(command) {
1243
+ return "isAbortableCommand" in command && command.isAbortableCommand === true;
1244
+ }
1245
+ function hasFetchParams(command) {
1246
+ return command && typeof command === "object" && "fetchParams" in command;
1247
+ }
1248
+ function createAbortableDecorator(command, options) {
1249
+ if (!(options == null ? void 0 : options.signal) || !((options == null ? void 0 : options.signal) instanceof AbortSignal)) {
1250
+ return command;
1251
+ }
1252
+ const { signal } = options;
1253
+ if (isAbortableCommand(command)) {
1254
+ if (process.env.NODE_ENV !== "production") {
1255
+ console.warn(
1256
+ "Command is already abortable. Returning original command to avoid double-wrapping."
1257
+ );
1258
+ }
1259
+ return command;
1260
+ }
1261
+ if (!hasFetchParams(command)) {
1262
+ if (process.env.NODE_ENV !== "production") {
1263
+ console.warn(
1264
+ `Command ${command.constructor.name} does not support fetch operations. AbortSignal will be ignored.`
1265
+ );
1266
+ }
1267
+ return command;
1268
+ }
1269
+ try {
1270
+ return new Proxy(command, {
1271
+ get(target, prop, receiver) {
1272
+ if (prop === "isAbortableCommand") {
1273
+ return true;
1274
+ }
1275
+ if (prop === "signal") {
1276
+ return signal;
1277
+ }
1278
+ if (prop === "fetchParams") {
1279
+ const originalFetchParams = target[prop];
1280
+ const isInternal = target.isInternalExecution === true;
1281
+ if (typeof originalFetchParams === "function") {
1282
+ return function(...args) {
1283
+ const originalReturnValue = originalFetchParams.apply(this, args);
1284
+ if (!isInternal) {
1285
+ const [url, init = {}] = originalReturnValue;
1286
+ return [url, { signal, ...init }];
1287
+ }
1288
+ return originalReturnValue;
1289
+ };
1290
+ } else {
1291
+ if (!isInternal && originalFetchParams && Array.isArray(originalFetchParams)) {
1292
+ const [url, init = {}] = originalFetchParams;
1293
+ return [url, { signal, ...init }];
1294
+ }
1295
+ return originalFetchParams;
1296
+ }
1297
+ }
1298
+ return Reflect.get(target, prop, receiver);
1299
+ },
1300
+ has(target, prop) {
1301
+ if (prop === "isAbortableCommand" || prop === "signal") {
1302
+ return true;
1303
+ }
1304
+ return Reflect.has(target, prop);
1305
+ }
1306
+ });
1307
+ } catch (error) {
1308
+ if (process.env.NODE_ENV !== "production") {
1309
+ console.error(
1310
+ "Failed to create abortable command proxy, returning original command unchanged.",
1311
+ error
1312
+ );
1313
+ }
1314
+ return command;
1315
+ }
1316
+ }
1317
+ const _FetchNetworkCommand = class _FetchNetworkCommand extends NetworkCommand {
1235
1318
  constructor(services) {
1236
1319
  super(services);
1237
1320
  this.services = services;
@@ -1269,7 +1352,11 @@ class FetchNetworkCommand extends NetworkCommand {
1269
1352
  (reason) => err$1(toError(reason))
1270
1353
  );
1271
1354
  }
1272
- }
1355
+ };
1356
+ _FetchNetworkCommand.availableDecorators = {
1357
+ abortable: createAbortableDecorator
1358
+ };
1359
+ let FetchNetworkCommand = _FetchNetworkCommand;
1273
1360
  function buildServiceDescriptor$e() {
1274
1361
  return {
1275
1362
  type: "fetchNetworkCommandBaseClass",
@@ -2181,11 +2268,11 @@ class CacheController {
2181
2268
  yield* this.services.cacheInclusionPolicy.findAndModify(query, cacheUpdate);
2182
2269
  }
2183
2270
  }
2184
- function buildServiceDescriptor$8(cache, cacheInclusionPolicy) {
2271
+ function buildServiceDescriptor$8(cache, cacheInclusionPolicy, instrumentation) {
2185
2272
  return {
2186
2273
  type: "cacheController",
2187
2274
  version: "1.0",
2188
- service: new CacheController({ cache, cacheInclusionPolicy })
2275
+ service: new CacheController({ cache, cacheInclusionPolicy, instrumentation })
2189
2276
  };
2190
2277
  }
2191
2278
 
@@ -3457,6 +3544,17 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
3457
3544
  this.documentRootType = documentRootType;
3458
3545
  this.services = services;
3459
3546
  }
3547
+ get operationType() {
3548
+ const operationResult = findExecutableOperation(this.config);
3549
+ if (operationResult.isErr()) {
3550
+ return "mutation";
3551
+ }
3552
+ const operationType = operationResult.value.operation.toString();
3553
+ if (operationType === "mutation" || operationType === "query") {
3554
+ return operationType;
3555
+ }
3556
+ return "mutation";
3557
+ }
3460
3558
  buildResultType() {
3461
3559
  return this.documentRootType;
3462
3560
  }
@@ -3581,6 +3679,9 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
3581
3679
  }
3582
3680
  // Any changes to this method should most likely be duplicated in the https command as well
3583
3681
  handleCacheControllerResult(result, requestRunner) {
3682
+ if (this.operationType === "mutation") {
3683
+ return super.handleCacheControllerResult(result, requestRunner);
3684
+ }
3584
3685
  const { networkError, returnData } = requestRunner;
3585
3686
  return this.publishUpdatedKeys().then(() => {
3586
3687
  if (networkError || returnData === void 0 || returnData.isErr() || result.isErr()) {
@@ -3616,6 +3717,17 @@ class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheContro
3616
3717
  buildResultType() {
3617
3718
  return this.documentRootType;
3618
3719
  }
3720
+ get operationType() {
3721
+ const operationResult = findExecutableOperation(this.config);
3722
+ if (operationResult.isErr()) {
3723
+ return "mutation";
3724
+ }
3725
+ const operationType = operationResult.value.operation.toString();
3726
+ if (operationType === "mutation" || operationType === "query") {
3727
+ return operationType;
3728
+ }
3729
+ return "mutation";
3730
+ }
3619
3731
  buildQuery() {
3620
3732
  const extensionResult = buildGraphQLInputExtension(this.config);
3621
3733
  if (extensionResult.isErr()) {
@@ -3685,6 +3797,9 @@ class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheContro
3685
3797
  }
3686
3798
  // Any changes to this method should most likely be duplicated in the aura command as well
3687
3799
  handleCacheControllerResult(result, requestRunner) {
3800
+ if (this.operationType === "mutation") {
3801
+ return super.handleCacheControllerResult(result, requestRunner);
3802
+ }
3688
3803
  const { networkError, returnData } = requestRunner;
3689
3804
  return this.publishUpdatedKeys().then(() => {
3690
3805
  if (networkError || returnData === void 0 || returnData.isErr() || result.isErr()) {
@@ -3810,7 +3925,7 @@ function buildServiceDescriptor$2(luvio) {
3810
3925
  },
3811
3926
  };
3812
3927
  }
3813
- // version: 1.393.0-94e6d2aef3
3928
+ // version: 1.395.0-81b62e57cb
3814
3929
 
3815
3930
  /**
3816
3931
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -3836,7 +3951,7 @@ function buildServiceDescriptor$1(notifyRecordUpdateAvailable, getNormalizedLuvi
3836
3951
  },
3837
3952
  };
3838
3953
  }
3839
- // version: 1.393.0-94e6d2aef3
3954
+ // version: 1.395.0-81b62e57cb
3840
3955
 
3841
3956
  /*!
3842
3957
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -4437,7 +4552,7 @@ const services = [
4437
4552
  buildJwtAuthorizedSfapFetchServiceDescriptor(loggerService),
4438
4553
  buildCopilotFetchServiceDescriptor(loggerService),
4439
4554
  buildServiceDescriptor$b(instrumentationServiceDescriptor.service),
4440
- buildServiceDescriptor$8(cacheServiceDescriptor.service, inMemoryCacheInclusionPolicyServiceDescriptor.service),
4555
+ buildServiceDescriptor$8(cacheServiceDescriptor.service, inMemoryCacheInclusionPolicyServiceDescriptor.service, instrumentationServiceDescriptor.service),
4441
4556
  buildServiceDescriptor$i(),
4442
4557
  buildServiceDescriptor$3(),
4443
4558
  buildServiceDescriptor$e(),
@@ -4456,4 +4571,4 @@ const services = [
4456
4571
  buildServiceDescriptor$1({}, {}),
4457
4572
  ];
4458
4573
  setServices(services);
4459
- // version: 1.393.0-fe4eaa97f2
4574
+ // version: 1.395.0-2bc84082ba
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-webruntime",
3
- "version": "1.393.0",
3
+ "version": "1.395.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS engine for Webruntime runtime",
6
6
  "main": "dist/ldsWebruntimeOneStoreInit.js",
@@ -35,35 +35,35 @@
35
35
  "ready": "yarn build && jest --collectCoverage && yarn test:size && yarn release:corejar"
36
36
  },
37
37
  "devDependencies": {
38
- "@luvio/service-provisioner": "5.62.0",
39
- "@luvio/tools-core": "5.62.0",
38
+ "@luvio/service-provisioner": "5.64.2",
39
+ "@luvio/tools-core": "5.64.2",
40
40
  "jwt-encode": "1.0.1"
41
41
  },
42
42
  "dependencies": {
43
- "@luvio/command-aura-network": "5.62.0",
44
- "@luvio/command-aura-normalized-cache-control": "5.62.0",
45
- "@luvio/command-aura-resource-cache-control": "5.62.0",
46
- "@luvio/command-fetch-network": "5.62.0",
47
- "@luvio/command-http-normalized-cache-control": "5.62.0",
48
- "@luvio/command-ndjson": "5.62.0",
49
- "@luvio/command-network": "5.62.0",
50
- "@luvio/command-sse": "5.62.0",
51
- "@luvio/command-streaming": "5.62.0",
52
- "@luvio/jwt-manager": "5.62.0",
43
+ "@luvio/command-aura-network": "5.64.2",
44
+ "@luvio/command-aura-normalized-cache-control": "5.64.2",
45
+ "@luvio/command-aura-resource-cache-control": "5.64.2",
46
+ "@luvio/command-fetch-network": "5.64.2",
47
+ "@luvio/command-http-normalized-cache-control": "5.64.2",
48
+ "@luvio/command-ndjson": "5.64.2",
49
+ "@luvio/command-network": "5.64.2",
50
+ "@luvio/command-sse": "5.64.2",
51
+ "@luvio/command-streaming": "5.64.2",
52
+ "@luvio/jwt-manager": "5.64.2",
53
53
  "@luvio/network-adapter-composable": "0.158.7",
54
54
  "@luvio/network-adapter-fetch": "0.158.7",
55
- "@luvio/service-aura-network": "5.62.0",
56
- "@luvio/service-cache": "5.62.0",
57
- "@luvio/service-cache-control": "5.62.0",
58
- "@luvio/service-cache-inclusion-policy": "5.62.0",
59
- "@luvio/service-fetch-network": "5.62.0",
60
- "@luvio/service-instrument-command": "5.62.0",
61
- "@luvio/service-pubsub": "5.62.0",
62
- "@luvio/service-store": "5.62.0",
63
- "@luvio/utils": "5.62.0",
64
- "@salesforce/lds-adapters-uiapi-lex": "^1.393.0",
65
- "@salesforce/lds-luvio-service": "^1.393.0",
66
- "@salesforce/lds-luvio-uiapi-records-service": "^1.393.0"
55
+ "@luvio/service-aura-network": "5.64.2",
56
+ "@luvio/service-cache": "5.64.2",
57
+ "@luvio/service-cache-control": "5.64.2",
58
+ "@luvio/service-cache-inclusion-policy": "5.64.2",
59
+ "@luvio/service-fetch-network": "5.64.2",
60
+ "@luvio/service-instrument-command": "5.64.2",
61
+ "@luvio/service-pubsub": "5.64.2",
62
+ "@luvio/service-store": "5.64.2",
63
+ "@luvio/utils": "5.64.2",
64
+ "@salesforce/lds-adapters-uiapi-lex": "^1.395.0",
65
+ "@salesforce/lds-luvio-service": "^1.395.0",
66
+ "@salesforce/lds-luvio-uiapi-records-service": "^1.395.0"
67
67
  },
68
68
  "luvioBundlesize": [
69
69
  {