@salesforce/lds-runtime-aura 1.393.0 → 1.394.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 +130 -15
  2. package/package.json +36 -36
@@ -25,7 +25,7 @@ import useOneStoreGraphql from '@salesforce/gate/lds.oneStoreGraphqlEnabled.ltng
25
25
  import { GetApexWireAdapterFactory, registerPrefetcher as registerPrefetcher$1 } from 'force/ldsAdaptersApex';
26
26
  import { getRecordAvatarsAdapterFactory, getRecordAdapterFactory, coerceFieldIdArray, getRecordsAdapterFactory, getRecordActionsAdapterFactory, getObjectInfosAdapterFactory, coerceObjectIdArray, getObjectInfoAdapterFactory, coerceObjectId, getRelatedListsActionsAdapterFactory, getRelatedListInfoBatchAdapterFactory, getRelatedListInfoAdapterFactory, getRelatedListRecordsBatchAdapterFactory, getRelatedListRecordsAdapterFactory, getListInfoByNameAdapterFactory, getListInfosByObjectNameAdapterFactory, getListRecordsByNameAdapterFactory, getListObjectInfoAdapterFactory, getRelatedListsInfoAdapterFactory, getRelatedListActionsAdapterFactory, getRecordId18Array, instrument, buildRecordRepKeyFromId, configuration, InMemoryRecordRepresentationQueryEvaluator, UiApiNamespace, RecordRepresentationRepresentationType, registerPrefetcher, RecordRepresentationVersion } from 'force/ldsAdaptersUiapi';
27
27
  import { getInstrumentation } from 'o11y/client';
28
- import { buildGraphQLInputExtension, addTypenameToDocument } from 'force/luvioGraphqlNormalization';
28
+ import { findExecutableOperation, buildGraphQLInputExtension, addTypenameToDocument } from 'force/luvioGraphqlNormalization';
29
29
  import { print } from 'force/luvioOnestoreGraphqlParser';
30
30
  import { setServices } from 'force/luvioServiceProvisioner1';
31
31
  import { unstable_loadComponentDefs, dispatchGlobalEvent, executeGlobalControllerRawResponse } from 'aura';
@@ -619,12 +619,15 @@ class CacheControlCommand extends BaseCommand {
619
619
  this.services = services;
620
620
  this.keysUsed = /* @__PURE__ */ new Set();
621
621
  this.keysUpdated = void 0;
622
- this.operationType = "query";
622
+ this._isInternalExecution = false;
623
623
  this.lastResult = void 0;
624
624
  this.unsubscribeFromKeysImpl = () => void 0;
625
625
  this.subscriptions = [];
626
626
  this.instantiationTime = Date.now() / 1e3;
627
627
  }
628
+ get isInternalExecution() {
629
+ return this._isInternalExecution;
630
+ }
628
631
  execute(overrides) {
629
632
  this.keysUpdated = void 0;
630
633
  this.unsubscribeFromKeys();
@@ -669,9 +672,6 @@ class CacheControlCommand extends BaseCommand {
669
672
  }
670
673
  return buildSubscribableResult(result, this.buildSubscribe(), () => this.refresh());
671
674
  }
672
- if (this.subscriptions.length > 0) {
673
- this.subscribeToKeysUsed();
674
- }
675
675
  if (returnData === void 0) {
676
676
  if (networkData) {
677
677
  return buildSubscribableResult(
@@ -686,6 +686,9 @@ class CacheControlCommand extends BaseCommand {
686
686
  () => this.refresh()
687
687
  );
688
688
  }
689
+ if (this.subscriptions.length > 0) {
690
+ this.subscribeToKeysUsed();
691
+ }
689
692
  return returnData;
690
693
  });
691
694
  }
@@ -707,6 +710,9 @@ class CacheControlCommand extends BaseCommand {
707
710
  }
708
711
  return resolvedPromiseLike$2(void 0);
709
712
  }
713
+ get operationType() {
714
+ return "query";
715
+ }
710
716
  subscribeToKeysUsed() {
711
717
  this.unsubscribeFromKeys();
712
718
  const { pubSub } = this.services;
@@ -789,7 +795,7 @@ class CacheControlCommand extends BaseCommand {
789
795
  */
790
796
  buildSubscribe() {
791
797
  return (consumerCallback) => {
792
- if (this.subscriptions.length === 0 && (this.operationType === "query" || this.operationType === "graphql")) {
798
+ if (this.subscriptions.length === 0 && this.operationType === "query") {
793
799
  this.subscribeToKeysUsed();
794
800
  }
795
801
  this.subscriptions.push(consumerCallback);
@@ -802,7 +808,9 @@ class CacheControlCommand extends BaseCommand {
802
808
  };
803
809
  }
804
810
  rerun(overrides) {
811
+ this._isInternalExecution = true;
805
812
  return this.execute(overrides).then((result) => {
813
+ this._isInternalExecution = false;
806
814
  if (result.isErr()) {
807
815
  this.lastResult = { type: "error", error: result.error.failure };
808
816
  this.invokeConsumerCallbacks(err(result.error.failure));
@@ -1264,7 +1272,82 @@ class NetworkCommand extends BaseCommand {
1264
1272
  async afterRequestHooks(_options) {
1265
1273
  }
1266
1274
  }
1267
- class FetchNetworkCommand extends NetworkCommand {
1275
+ function isAbortableCommand(command) {
1276
+ return "isAbortableCommand" in command && command.isAbortableCommand === true;
1277
+ }
1278
+ function hasFetchParams(command) {
1279
+ return command && typeof command === "object" && "fetchParams" in command;
1280
+ }
1281
+ function createAbortableDecorator(command, options) {
1282
+ if (!(options == null ? void 0 : options.signal) || !((options == null ? void 0 : options.signal) instanceof AbortSignal)) {
1283
+ return command;
1284
+ }
1285
+ const { signal } = options;
1286
+ if (isAbortableCommand(command)) {
1287
+ if (process.env.NODE_ENV !== "production") {
1288
+ console.warn(
1289
+ "Command is already abortable. Returning original command to avoid double-wrapping."
1290
+ );
1291
+ }
1292
+ return command;
1293
+ }
1294
+ if (!hasFetchParams(command)) {
1295
+ if (process.env.NODE_ENV !== "production") {
1296
+ console.warn(
1297
+ `Command ${command.constructor.name} does not support fetch operations. AbortSignal will be ignored.`
1298
+ );
1299
+ }
1300
+ return command;
1301
+ }
1302
+ try {
1303
+ return new Proxy(command, {
1304
+ get(target, prop, receiver) {
1305
+ if (prop === "isAbortableCommand") {
1306
+ return true;
1307
+ }
1308
+ if (prop === "signal") {
1309
+ return signal;
1310
+ }
1311
+ if (prop === "fetchParams") {
1312
+ const originalFetchParams = target[prop];
1313
+ const isInternal = target.isInternalExecution === true;
1314
+ if (typeof originalFetchParams === "function") {
1315
+ return function(...args) {
1316
+ const originalReturnValue = originalFetchParams.apply(this, args);
1317
+ if (!isInternal) {
1318
+ const [url, init = {}] = originalReturnValue;
1319
+ return [url, { signal, ...init }];
1320
+ }
1321
+ return originalReturnValue;
1322
+ };
1323
+ } else {
1324
+ if (!isInternal && originalFetchParams && Array.isArray(originalFetchParams)) {
1325
+ const [url, init = {}] = originalFetchParams;
1326
+ return [url, { signal, ...init }];
1327
+ }
1328
+ return originalFetchParams;
1329
+ }
1330
+ }
1331
+ return Reflect.get(target, prop, receiver);
1332
+ },
1333
+ has(target, prop) {
1334
+ if (prop === "isAbortableCommand" || prop === "signal") {
1335
+ return true;
1336
+ }
1337
+ return Reflect.has(target, prop);
1338
+ }
1339
+ });
1340
+ } catch (error) {
1341
+ if (process.env.NODE_ENV !== "production") {
1342
+ console.error(
1343
+ "Failed to create abortable command proxy, returning original command unchanged.",
1344
+ error
1345
+ );
1346
+ }
1347
+ return command;
1348
+ }
1349
+ }
1350
+ const _FetchNetworkCommand = class _FetchNetworkCommand extends NetworkCommand {
1268
1351
  constructor(services) {
1269
1352
  super(services);
1270
1353
  this.services = services;
@@ -1302,7 +1385,11 @@ class FetchNetworkCommand extends NetworkCommand {
1302
1385
  (reason) => err$1(toError(reason))
1303
1386
  );
1304
1387
  }
1305
- }
1388
+ };
1389
+ _FetchNetworkCommand.availableDecorators = {
1390
+ abortable: createAbortableDecorator
1391
+ };
1392
+ let FetchNetworkCommand = _FetchNetworkCommand;
1306
1393
  function buildServiceDescriptor$e() {
1307
1394
  return {
1308
1395
  type: "fetchNetworkCommandBaseClass",
@@ -2214,11 +2301,11 @@ class CacheController {
2214
2301
  yield* this.services.cacheInclusionPolicy.findAndModify(query, cacheUpdate);
2215
2302
  }
2216
2303
  }
2217
- function buildServiceDescriptor$8(cache, cacheInclusionPolicy) {
2304
+ function buildServiceDescriptor$8(cache, cacheInclusionPolicy, instrumentation) {
2218
2305
  return {
2219
2306
  type: "cacheController",
2220
2307
  version: "1.0",
2221
- service: new CacheController({ cache, cacheInclusionPolicy })
2308
+ service: new CacheController({ cache, cacheInclusionPolicy, instrumentation })
2222
2309
  };
2223
2310
  }
2224
2311
 
@@ -2437,7 +2524,7 @@ function buildServiceDescriptor$5(luvio) {
2437
2524
  },
2438
2525
  };
2439
2526
  }
2440
- // version: 1.393.0-94e6d2aef3
2527
+ // version: 1.394.0-db58817a4e
2441
2528
 
2442
2529
  /*!
2443
2530
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -2451,6 +2538,17 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
2451
2538
  this.documentRootType = documentRootType;
2452
2539
  this.services = services;
2453
2540
  }
2541
+ get operationType() {
2542
+ const operationResult = findExecutableOperation(this.config);
2543
+ if (operationResult.isErr()) {
2544
+ return "mutation";
2545
+ }
2546
+ const operationType = operationResult.value.operation.toString();
2547
+ if (operationType === "mutation" || operationType === "query") {
2548
+ return operationType;
2549
+ }
2550
+ return "mutation";
2551
+ }
2454
2552
  buildResultType() {
2455
2553
  return this.documentRootType;
2456
2554
  }
@@ -2575,6 +2673,9 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
2575
2673
  }
2576
2674
  // Any changes to this method should most likely be duplicated in the https command as well
2577
2675
  handleCacheControllerResult(result, requestRunner) {
2676
+ if (this.operationType === "mutation") {
2677
+ return super.handleCacheControllerResult(result, requestRunner);
2678
+ }
2578
2679
  const { networkError, returnData } = requestRunner;
2579
2680
  return this.publishUpdatedKeys().then(() => {
2580
2681
  if (networkError || returnData === void 0 || returnData.isErr() || result.isErr()) {
@@ -2610,6 +2711,17 @@ class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheContro
2610
2711
  buildResultType() {
2611
2712
  return this.documentRootType;
2612
2713
  }
2714
+ get operationType() {
2715
+ const operationResult = findExecutableOperation(this.config);
2716
+ if (operationResult.isErr()) {
2717
+ return "mutation";
2718
+ }
2719
+ const operationType = operationResult.value.operation.toString();
2720
+ if (operationType === "mutation" || operationType === "query") {
2721
+ return operationType;
2722
+ }
2723
+ return "mutation";
2724
+ }
2613
2725
  buildQuery() {
2614
2726
  const extensionResult = buildGraphQLInputExtension(this.config);
2615
2727
  if (extensionResult.isErr()) {
@@ -2679,6 +2791,9 @@ class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheContro
2679
2791
  }
2680
2792
  // Any changes to this method should most likely be duplicated in the aura command as well
2681
2793
  handleCacheControllerResult(result, requestRunner) {
2794
+ if (this.operationType === "mutation") {
2795
+ return super.handleCacheControllerResult(result, requestRunner);
2796
+ }
2682
2797
  const { networkError, returnData } = requestRunner;
2683
2798
  return this.publishUpdatedKeys().then(() => {
2684
2799
  if (networkError || returnData === void 0 || returnData.isErr() || result.isErr()) {
@@ -2747,7 +2862,7 @@ function buildServiceDescriptor$1(notifyRecordUpdateAvailable, getNormalizedLuvi
2747
2862
  },
2748
2863
  };
2749
2864
  }
2750
- // version: 1.393.0-94e6d2aef3
2865
+ // version: 1.394.0-db58817a4e
2751
2866
 
2752
2867
  /*!
2753
2868
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -6249,7 +6364,7 @@ function getEnvironmentSetting(name) {
6249
6364
  }
6250
6365
  return undefined;
6251
6366
  }
6252
- // version: 1.393.0-94e6d2aef3
6367
+ // version: 1.394.0-db58817a4e
6253
6368
 
6254
6369
  const forceRecordTransactionsDisabled = getEnvironmentSetting(EnvironmentSettings.ForceRecordTransactionsDisabled);
6255
6370
  //TODO: Some duplication here that can be most likely moved to a util class
@@ -7268,7 +7383,7 @@ function initializeOneStore(luvio) {
7268
7383
  buildCopilotFetchServiceDescriptor(loggerService),
7269
7384
  buildAuraNetworkService(),
7270
7385
  buildServiceDescriptor$b(instrumentationServiceDescriptor.service),
7271
- buildServiceDescriptor$8(cacheServiceDescriptor.service, inMemoryCacheInclusionPolicyServiceDescriptor.service),
7386
+ buildServiceDescriptor$8(cacheServiceDescriptor.service, inMemoryCacheInclusionPolicyServiceDescriptor.service, instrumentationServiceDescriptor.service),
7272
7387
  buildServiceDescriptor$i(),
7273
7388
  buildServiceDescriptor$6(),
7274
7389
  buildServiceDescriptor$e(),
@@ -7305,4 +7420,4 @@ function ldsEngineCreator() {
7305
7420
  }
7306
7421
 
7307
7422
  export { LexRequestStrategy, PdlRequestPriority, buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore, notifyUpdateAvailableFactory, registerRequestStrategy, saveRequestAsPrediction, unregisterRequestStrategy, whenPredictionsReady };
7308
- // version: 1.393.0-fe4eaa97f2
7423
+ // version: 1.394.0-9f5a21c62e
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-aura",
3
- "version": "1.393.0",
3
+ "version": "1.394.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,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.62.0",
38
- "@luvio/tools-core": "5.62.0",
39
- "@salesforce/lds-adapters-apex": "^1.393.0",
40
- "@salesforce/lds-adapters-uiapi": "^1.393.0",
41
- "@salesforce/lds-ads-bridge": "^1.393.0",
42
- "@salesforce/lds-aura-storage": "^1.393.0",
43
- "@salesforce/lds-bindings": "^1.393.0",
44
- "@salesforce/lds-instrumentation": "^1.393.0",
45
- "@salesforce/lds-network-aura": "^1.393.0",
46
- "@salesforce/lds-network-fetch": "^1.393.0",
37
+ "@luvio/service-provisioner": "5.64.2",
38
+ "@luvio/tools-core": "5.64.2",
39
+ "@salesforce/lds-adapters-apex": "^1.394.0",
40
+ "@salesforce/lds-adapters-uiapi": "^1.394.0",
41
+ "@salesforce/lds-ads-bridge": "^1.394.0",
42
+ "@salesforce/lds-aura-storage": "^1.394.0",
43
+ "@salesforce/lds-bindings": "^1.394.0",
44
+ "@salesforce/lds-instrumentation": "^1.394.0",
45
+ "@salesforce/lds-network-aura": "^1.394.0",
46
+ "@salesforce/lds-network-fetch": "^1.394.0",
47
47
  "jwt-encode": "1.0.1"
48
48
  },
49
49
  "dependencies": {
50
- "@luvio/command-aura-graphql-normalized-cache-control": "5.62.0",
51
- "@luvio/command-aura-network": "5.62.0",
52
- "@luvio/command-aura-normalized-cache-control": "5.62.0",
53
- "@luvio/command-aura-resource-cache-control": "5.62.0",
54
- "@luvio/command-fetch-network": "5.62.0",
55
- "@luvio/command-http-graphql-normalized-cache-control": "5.62.0",
56
- "@luvio/command-http-normalized-cache-control": "5.62.0",
57
- "@luvio/command-ndjson": "5.62.0",
58
- "@luvio/command-network": "5.62.0",
59
- "@luvio/command-sse": "5.62.0",
60
- "@luvio/command-streaming": "5.62.0",
50
+ "@luvio/command-aura-graphql-normalized-cache-control": "5.64.2",
51
+ "@luvio/command-aura-network": "5.64.2",
52
+ "@luvio/command-aura-normalized-cache-control": "5.64.2",
53
+ "@luvio/command-aura-resource-cache-control": "5.64.2",
54
+ "@luvio/command-fetch-network": "5.64.2",
55
+ "@luvio/command-http-graphql-normalized-cache-control": "5.64.2",
56
+ "@luvio/command-http-normalized-cache-control": "5.64.2",
57
+ "@luvio/command-ndjson": "5.64.2",
58
+ "@luvio/command-network": "5.64.2",
59
+ "@luvio/command-sse": "5.64.2",
60
+ "@luvio/command-streaming": "5.64.2",
61
61
  "@luvio/network-adapter-composable": "0.158.7",
62
62
  "@luvio/network-adapter-fetch": "0.158.7",
63
- "@luvio/service-aura-network": "5.62.0",
64
- "@luvio/service-cache": "5.62.0",
65
- "@luvio/service-cache-control": "5.62.0",
66
- "@luvio/service-cache-inclusion-policy": "5.62.0",
67
- "@luvio/service-feature-flags": "5.62.0",
68
- "@luvio/service-fetch-network": "5.62.0",
69
- "@luvio/service-instrument-command": "5.62.0",
70
- "@luvio/service-pubsub": "5.62.0",
71
- "@luvio/service-store": "5.62.0",
72
- "@luvio/utils": "5.62.0",
63
+ "@luvio/service-aura-network": "5.64.2",
64
+ "@luvio/service-cache": "5.64.2",
65
+ "@luvio/service-cache-control": "5.64.2",
66
+ "@luvio/service-cache-inclusion-policy": "5.64.2",
67
+ "@luvio/service-feature-flags": "5.64.2",
68
+ "@luvio/service-fetch-network": "5.64.2",
69
+ "@luvio/service-instrument-command": "5.64.2",
70
+ "@luvio/service-pubsub": "5.64.2",
71
+ "@luvio/service-store": "5.64.2",
72
+ "@luvio/utils": "5.64.2",
73
73
  "@lwc/state": "^0.23.0",
74
- "@salesforce/lds-adapters-onestore-graphql": "^1.393.0",
75
- "@salesforce/lds-adapters-uiapi-lex": "^1.393.0",
76
- "@salesforce/lds-luvio-service": "^1.393.0",
77
- "@salesforce/lds-luvio-uiapi-records-service": "^1.393.0"
74
+ "@salesforce/lds-adapters-onestore-graphql": "^1.394.0",
75
+ "@salesforce/lds-adapters-uiapi-lex": "^1.394.0",
76
+ "@salesforce/lds-luvio-service": "^1.394.0",
77
+ "@salesforce/lds-luvio-uiapi-records-service": "^1.394.0"
78
78
  },
79
79
  "luvioBundlesize": [
80
80
  {