@salesforce/lds-runtime-aura 1.420.0 → 1.421.1

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.
@@ -34,13 +34,13 @@ import { ThirdPartyTracker } from 'instrumentation:thirdPartyTracker';
34
34
  import { markStart, markEnd, counter, registerCacheStats, perfStart, perfEnd, registerPeriodicLogger, interaction, timer, mark } from 'instrumentation/service';
35
35
  import { instrument as instrument$2, setupLexNetworkAdapter } from 'force/ldsNetworkFetch';
36
36
  import { REFRESH_ADAPTER_EVENT, ADAPTER_UNFULFILLED_ERROR, instrument as instrument$3 } from 'force/ldsBindings';
37
- import { LRUCache, instrumentAdapter, instrumentLuvio, logMessage as logMessage$1, setupInstrumentation as setupInstrumentation$1, logObjectInfoChanged as logObjectInfoChanged$1, updatePercentileHistogramMetric, incrementCounterMetric, incrementGetRecordNotifyChangeAllowCount, incrementGetRecordNotifyChangeDropCount, incrementNotifyRecordUpdateAvailableAllowCount, incrementNotifyRecordUpdateAvailableDropCount, setLdsAdaptersUiapiInstrumentation, logError as logError$2, setLdsNetworkAdapterInstrumentation, incrementStateCreatedCount, executeAsyncActivity, METRIC_KEYS, onIdleDetected } from 'force/ldsInstrumentation';
37
+ import { stateManagerInstrumentation, OperationTypeValue, LRUCache, instrumentAdapter, instrumentLuvio, logMessage as logMessage$1, setupInstrumentation as setupInstrumentation$1, logObjectInfoChanged as logObjectInfoChanged$1, updatePercentileHistogramMetric, incrementCounterMetric, incrementGetRecordNotifyChangeAllowCount, incrementGetRecordNotifyChangeDropCount, incrementNotifyRecordUpdateAvailableAllowCount, incrementNotifyRecordUpdateAvailableDropCount, setLdsAdaptersUiapiInstrumentation, logError as logError$2, setLdsNetworkAdapterInstrumentation, executeAsyncActivity, METRIC_KEYS, onIdleDetected } from 'force/ldsInstrumentation';
38
38
  import { instrument as instrument$4 } from 'force/adsBridge';
39
39
  import { instrument as instrument$5 } from '@lwc/state';
40
40
  import { withRegistration, register, setDefaultLuvio } from 'force/ldsEngine';
41
41
  import applyPredictionRequestLimit from '@salesforce/gate/lds.pdl.applyRequestLimit';
42
42
  import { pageScopedCache } from 'instrumentation/utility';
43
- import { createStorage, clearStorages } from 'force/ldsStorage';
43
+ import { createStorage, clearStorages, setDurableStorageImplementation } from 'force/ldsDurableStorage';
44
44
  import lightningConnectEnabled from '@salesforce/gate/ui.services.LightningConnect.enabled';
45
45
  import bypassAppRestrictionEnabled from '@salesforce/gate/ui.services.LightningConnect.BypassAppRestriction.enabled';
46
46
  import csrfValidationEnabled from '@salesforce/gate/ui.services.LightningConnect.CsrfValidation.enabled';
@@ -49,6 +49,7 @@ import useHttpUiapiOneApp from '@salesforce/gate/lds.useHttpUiapiOneApp';
49
49
  import useHttpUiapiOneRuntime from '@salesforce/gate/lds.useHttpUiapiOneRuntime';
50
50
  import disableCreateContentDocumentAndVersionHTTPLexRuntime from '@salesforce/gate/lds.lex.http.disableCreateContentDocumentAndVersion';
51
51
  import useHotspotLimit from '@salesforce/gate/lds.pdl.useHotspotLimit';
52
+ import { createStorage as createStorage$1, clearStorages as clearStorages$1 } from 'force/ldsStorage';
52
53
 
53
54
  /*!
54
55
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -2705,7 +2706,7 @@ function buildServiceDescriptor$d(luvio) {
2705
2706
  },
2706
2707
  };
2707
2708
  }
2708
- // version: 1.420.0-576a1ea316
2709
+ // version: 1.421.1-00b4791b5e
2709
2710
 
2710
2711
  /*!
2711
2712
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -3058,7 +3059,7 @@ function buildServiceDescriptor$9(notifyRecordUpdateAvailable, getNormalizedLuvi
3058
3059
  },
3059
3060
  };
3060
3061
  }
3061
- // version: 1.420.0-576a1ea316
3062
+ // version: 1.421.1-00b4791b5e
3062
3063
 
3063
3064
  /*!
3064
3065
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -4926,6 +4927,59 @@ const TOTAL_ADAPTER_REQUEST_SUCCESS_COUNT = {
4926
4927
  },
4927
4928
  };
4928
4929
 
4930
+ function getOperationType(type) {
4931
+ switch (type) {
4932
+ case 'internal':
4933
+ return OperationTypeValue.Internal;
4934
+ case 'external':
4935
+ return OperationTypeValue.External;
4936
+ case 'uiapi':
4937
+ return OperationTypeValue.UiApi;
4938
+ case 'unknown':
4939
+ return OperationTypeValue.Unknown;
4940
+ default:
4941
+ return OperationTypeValue.Other;
4942
+ }
4943
+ }
4944
+ /**
4945
+ /**
4946
+ * Determines if the given component name represents an external component.
4947
+ * @remarks A component is considered external if its name starts with 'c/'.
4948
+ *
4949
+ * @param componentName - The name of the component to check.
4950
+ * @returns True if the component is external, false otherwise.
4951
+ */
4952
+ function isExternalComponent(componentName = '') {
4953
+ return componentName.startsWith('c/');
4954
+ }
4955
+ function stateCreated(metadata) {
4956
+ const definedBy = metadata.definedBy || 'unknown';
4957
+ const type = getOperationType(metadata.type);
4958
+ stateManagerInstrumentation.incrementStateCreatedCount({
4959
+ type,
4960
+ definedBy,
4961
+ });
4962
+ }
4963
+ function contextConsumed({ stateDefMetadata, componentName, }) {
4964
+ const definedBy = stateDefMetadata?.definedBy || 'unknown';
4965
+ let type = getOperationType(stateDefMetadata?.type || 'unknown');
4966
+ if (type !== OperationTypeValue.External && isExternalComponent(componentName)) {
4967
+ type = OperationTypeValue.External;
4968
+ }
4969
+ stateManagerInstrumentation.incrementStateContextConsumedCount({
4970
+ type,
4971
+ definedBy,
4972
+ });
4973
+ }
4974
+ function stateDefined(metadata) {
4975
+ const definedBy = metadata?.definedBy || 'unknown';
4976
+ const type = getOperationType(metadata?.type || 'unknown');
4977
+ stateManagerInstrumentation.incrementStateDefinedCount({
4978
+ type,
4979
+ definedBy,
4980
+ });
4981
+ }
4982
+
4929
4983
  const { create, keys, hasOwnProperty, entries } = Object;
4930
4984
  const { isArray, from } = Array;
4931
4985
  const { stringify: stringify$1 } = JSON;
@@ -5444,12 +5498,7 @@ function setStateManagerInstrumentationHooks() {
5444
5498
  if (stateManagerInstrumentationHooksInitialized) {
5445
5499
  return;
5446
5500
  }
5447
- instrument$5({
5448
- stateCreated: incrementStateCreatedCount,
5449
- // noop for now.
5450
- stateDefined: () => { },
5451
- contextConsumed: () => { },
5452
- });
5501
+ instrument$5({ stateCreated, stateDefined, contextConsumed });
5453
5502
  stateManagerInstrumentationHooksInitialized = true;
5454
5503
  }
5455
5504
  /**
@@ -5646,7 +5695,7 @@ function getEnvironmentSetting(name) {
5646
5695
  }
5647
5696
  return undefined;
5648
5697
  }
5649
- // version: 1.420.0-576a1ea316
5698
+ // version: 1.421.1-00b4791b5e
5650
5699
 
5651
5700
  const environmentHasAura = typeof window !== 'undefined' && typeof window.$A !== 'undefined';
5652
5701
  const defaultConfig = {
@@ -6348,11 +6397,12 @@ function createActionEndMark(responseStatus, responseStatusText, serverTiming, u
6348
6397
  mark('actions', 'finishStart', ctx);
6349
6398
  mark('actions', 'finishEnd', ctx);
6350
6399
  }
6400
+ const seenResources = new WeakSet();
6351
6401
  function createTransportEndMark(responseStatus, responseStatusText, url, context, errorMessage) {
6352
6402
  if (context && context.instrumentationId) {
6353
6403
  const endMark = markEnd('transport', 'request', { auraXHRId: context.instrumentationId });
6354
- if (performance && performance.getEntriesByName) {
6355
- const resources = performance.getEntriesByName(url);
6404
+ if (performance) {
6405
+ const resources = getFetchResourcesByUrlPrefix(url);
6356
6406
  let resource;
6357
6407
  if (resources.length) {
6358
6408
  if (resources.length === 1) {
@@ -6361,10 +6411,11 @@ function createTransportEndMark(responseStatus, responseStatusText, url, context
6361
6411
  }
6362
6412
  else {
6363
6413
  // otherwise we need to guess based on the start time
6364
- resource = findCorrectResource(resources, context);
6414
+ resource = findCorrectResource(resources, url, context);
6365
6415
  }
6366
6416
  if (resource) {
6367
6417
  setResourceTimings(context.instrumentationId, responseStatus, responseStatusText, endMark, resource);
6418
+ seenResources.add(resource);
6368
6419
  }
6369
6420
  }
6370
6421
  else if (errorMessage) {
@@ -6429,7 +6480,38 @@ function getServerTiming(serverTiming) {
6429
6480
  }
6430
6481
  return 0;
6431
6482
  }
6432
- function findCorrectResource(resources, context) {
6483
+ function getFetchResourcesByUrlPrefix(url) {
6484
+ const exactMatches = performance.getEntriesByName(url);
6485
+ // first check for exact url matches, otherwise match based on base url
6486
+ if (exactMatches.length) {
6487
+ return exactMatches;
6488
+ }
6489
+ return performance
6490
+ .getEntriesByType('resource')
6491
+ .filter((entry) => entry.initiatorType === 'fetch')
6492
+ .filter((entry) => entry.name === url || entry.name.startsWith(url + '?'));
6493
+ }
6494
+ function findCorrectResource(resources, url, context) {
6495
+ // first check params, then check time
6496
+ const matchingResources = [];
6497
+ if (context.queryParams) {
6498
+ const urlWithParams = buildUrlWithParams(url, context.queryParams);
6499
+ for (let entry in resources) {
6500
+ const resource = resources[entry];
6501
+ if (resource.name === urlWithParams && !seenResources.has(resource)) {
6502
+ matchingResources.push(resource);
6503
+ }
6504
+ }
6505
+ }
6506
+ if (matchingResources.length === 1) {
6507
+ return matchingResources[0];
6508
+ }
6509
+ else if (matchingResources.length > 1) {
6510
+ resources = matchingResources;
6511
+ }
6512
+ // this means that we have multiple of the same request, and so we will fall back to timing. But this is only a best estimate,
6513
+ // since the urls are the only real way to differentiate between resources. This could also mean that there was an issue finding
6514
+ // the params, in which case we might as well fall back to timing as well.
6433
6515
  if (context && context.startTime) {
6434
6516
  let likelyResource = {
6435
6517
  index: 0,
@@ -6445,6 +6527,15 @@ function findCorrectResource(resources, context) {
6445
6527
  }
6446
6528
  return undefined;
6447
6529
  }
6530
+ function buildUrlWithParams(baseUrl, queryParams) {
6531
+ const parts = [];
6532
+ for (const [key, value] of Object.entries(queryParams)) {
6533
+ const values = Array.isArray(value) ? value : [value];
6534
+ const serialized = values.map((v) => encodeURIComponent(String(v))).join(',');
6535
+ parts.push(`${key}=${serialized}`);
6536
+ }
6537
+ return parts.length ? `${baseUrl}?${parts.join('&')}` : baseUrl;
6538
+ }
6448
6539
  function getResponseStatusText(responseCode) {
6449
6540
  if (responseCode.startsWith('2')) {
6450
6541
  return 'SUCCESS';
@@ -6605,19 +6696,19 @@ const UIAPI_PATHS = [
6605
6696
  // getObjectInfo
6606
6697
  '/ui-api/object-info/{objectApiName}',
6607
6698
  // getObjectInfos
6608
- // '/ui-api/object-info/batch/{objectApiNames}',
6699
+ '/ui-api/object-info/batch/{objectApiNames}',
6609
6700
  // getPicklistValuesByRecordType
6610
- // '/ui-api/object-info/{objectApiName}/picklist-values/{recordTypeId}',
6701
+ '/ui-api/object-info/{objectApiName}/picklist-values/{recordTypeId}',
6611
6702
  // getDuplicates
6612
- // '/ui-api/predupe',
6703
+ '/ui-api/predupe',
6613
6704
  // getRecord
6614
- // '/ui-api/records/{recordId}',
6705
+ '/ui-api/records/{recordId}',
6615
6706
  // getRecordUi
6616
- // '/ui-api/record-ui/{recordIds}',
6707
+ '/ui-api/record-ui/{recordIds}',
6617
6708
  // getRelatedListInfo
6618
- // '/ui-api/related-list-info/{parentObjectApiName}/{relatedListId}',
6709
+ '/ui-api/related-list-info/{parentObjectApiName}/{relatedListId}',
6619
6710
  // getRelatedListRecords
6620
- // '/ui-api/related-list-records/{parentRecordId}/{relatedListId}',
6711
+ '/ui-api/related-list-records/{parentRecordId}/{relatedListId}',
6621
6712
  ];
6622
6713
  /**
6623
6714
  * Single content documents version URL enabled/disabled by killswitch.
@@ -10427,6 +10518,10 @@ function buildPredictorForContext(context) {
10427
10518
  };
10428
10519
  }
10429
10520
  function initializeLDS() {
10521
+ setDurableStorageImplementation({
10522
+ createStorage: createStorage$1,
10523
+ clearStorages: clearStorages$1,
10524
+ });
10430
10525
  const storeOptions = {
10431
10526
  scheduler: () => { },
10432
10527
  };
@@ -10553,4 +10648,4 @@ function ldsEngineCreator() {
10553
10648
  }
10554
10649
 
10555
10650
  export { LexRequestStrategy, PdlPrefetcherEventType, PdlRequestPriority, buildPredictorForContext, configService, ldsEngineCreator as default, initializeLDS, initializeOneStore, notifyUpdateAvailableFactory, registerRequestStrategy, saveRequestAsPrediction, subscribeToPrefetcherEvents, unregisterRequestStrategy, whenPredictionsReady };
10556
- // version: 1.420.0-fc658f6118
10651
+ // version: 1.421.1-4ac91ce6d0
@@ -0,0 +1,4 @@
1
+ import type { StateDefMetadata, ContextConsumedMetadata } from '@lwc/state';
2
+ export declare function stateCreated(metadata: StateDefMetadata): void;
3
+ export declare function contextConsumed({ stateDefMetadata, componentName, }: ContextConsumedMetadata): void;
4
+ export declare function stateDefined(metadata?: StateDefMetadata): void;
@@ -1,6 +1,6 @@
1
1
  import { type PrefetchStorage } from '.';
2
2
  import { InMemoryPrefetchStorage } from './in-memory-prefetch-storage';
3
- import { type AuraStorage, type AuraStorageConfig } from '@salesforce/lds-aura-storage';
3
+ import { type Storage, type StorageConfig } from '@salesforce/lds-durable-storage';
4
4
  export declare const DEFAULT_STORAGE_OPTIONS: {
5
5
  name: string;
6
6
  persistent: boolean;
@@ -11,7 +11,7 @@ export declare const DEFAULT_STORAGE_OPTIONS: {
11
11
  debugLogging: boolean;
12
12
  version: number;
13
13
  };
14
- export type StorageOptions = Partial<AuraStorageConfig> & {
14
+ export type StorageOptions = Partial<StorageConfig> & {
15
15
  onPredictionsReadyCallback?: () => void;
16
16
  };
17
17
  export declare function buildAuraPrefetchStorage(options?: StorageOptions): PrefetchStorage;
@@ -19,7 +19,7 @@ export declare function buildAuraLocalStoragePrefetchStorage(options?: StorageOp
19
19
  export declare class AuraPrefetchStorage implements PrefetchStorage {
20
20
  private auraStorage;
21
21
  private inMemoryStorage;
22
- constructor(auraStorage: AuraStorage, inMemoryStorage: InMemoryPrefetchStorage, onPredictionsReadyCallback?: () => void);
22
+ constructor(auraStorage: Storage, inMemoryStorage: InMemoryPrefetchStorage, onPredictionsReadyCallback?: () => void);
23
23
  set<T>(key: string, value: T): Promise<void>;
24
24
  get<T>(key: string): T | undefined;
25
25
  }
@@ -1,11 +1,11 @@
1
- import { type AuraStorageConfig } from '@salesforce/lds-aura-storage';
1
+ import { type StorageConfig } from '@salesforce/lds-durable-storage';
2
2
  import { type CacheInclusionPolicyServiceDescriptor, type CacheQuery, type CacheUpdate, DurableCacheInclusionPolicy } from '@conduit-client/service-cache-inclusion-policy/v1';
3
3
  import type { Cache, CacheEntry, Key } from '@conduit-client/service-cache/v1';
4
4
  import type { DeepReadonly } from '@conduit-client/utils';
5
5
  /**
6
6
  * Configuration options for AuraDurableCacheInclusionPolicy
7
7
  */
8
- export type DurableCacheConfig = Partial<AuraStorageConfig>;
8
+ export type DurableCacheConfig = Partial<StorageConfig>;
9
9
  /**
10
10
  * Durable cache inclusion policy that uses AuraStorage for persistent L2 cache
11
11
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-aura",
3
- "version": "1.420.0",
3
+ "version": "1.421.1",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS engine for Aura runtime",
6
6
  "main": "dist/ldsEngineCreator.js",
@@ -34,50 +34,52 @@
34
34
  "release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-aura"
35
35
  },
36
36
  "devDependencies": {
37
- "@conduit-client/service-provisioner": "3.14.0",
38
- "@conduit-client/tools-core": "3.14.0",
39
- "@salesforce/lds-adapters-apex": "^1.420.0",
40
- "@salesforce/lds-adapters-uiapi": "^1.420.0",
41
- "@salesforce/lds-ads-bridge": "^1.420.0",
42
- "@salesforce/lds-aura-storage": "^1.420.0",
43
- "@salesforce/lds-bindings": "^1.420.0",
44
- "@salesforce/lds-instrumentation": "^1.420.0",
45
- "@salesforce/lds-network-aura": "^1.420.0",
46
- "@salesforce/lds-network-fetch": "^1.420.0",
37
+ "@conduit-client/service-provisioner": "3.15.1",
38
+ "@conduit-client/tools-core": "3.15.1",
39
+ "@salesforce/lds-adapters-apex": "^1.421.1",
40
+ "@salesforce/lds-adapters-uiapi": "^1.421.1",
41
+ "@salesforce/lds-ads-bridge": "^1.421.1",
42
+ "@salesforce/lds-aura-storage": "^1.421.1",
43
+ "@salesforce/lds-bindings": "^1.421.1",
44
+ "@salesforce/lds-durable-storage": "^1.420.0",
45
+ "@salesforce/lds-instrumentation": "^1.421.1",
46
+ "@salesforce/lds-network-aura": "^1.421.1",
47
+ "@salesforce/lds-network-fetch": "^1.421.1",
47
48
  "jwt-encode": "1.0.1"
48
49
  },
49
50
  "dependencies": {
50
- "@conduit-client/command-aura-graphql-normalized-cache-control": "3.14.0",
51
- "@conduit-client/command-aura-network": "3.14.0",
52
- "@conduit-client/command-aura-normalized-cache-control": "3.14.0",
53
- "@conduit-client/command-aura-resource-cache-control": "3.14.0",
54
- "@conduit-client/command-fetch-network": "3.14.0",
55
- "@conduit-client/command-http-graphql-normalized-cache-control": "3.14.0",
56
- "@conduit-client/command-http-normalized-cache-control": "3.14.0",
57
- "@conduit-client/command-ndjson": "3.14.0",
58
- "@conduit-client/command-network": "3.14.0",
59
- "@conduit-client/command-sse": "3.14.0",
60
- "@conduit-client/command-streaming": "3.14.0",
61
- "@conduit-client/service-aura-network": "3.14.0",
62
- "@conduit-client/service-bindings-imperative": "3.14.0",
63
- "@conduit-client/service-bindings-lwc": "3.14.0",
64
- "@conduit-client/service-cache": "3.14.0",
65
- "@conduit-client/service-cache-control": "3.14.0",
66
- "@conduit-client/service-cache-inclusion-policy": "3.14.0",
67
- "@conduit-client/service-config": "3.14.0",
68
- "@conduit-client/service-feature-flags": "3.14.0",
69
- "@conduit-client/service-fetch-network": "3.14.0",
70
- "@conduit-client/service-instrument-command": "3.14.0",
71
- "@conduit-client/service-pubsub": "3.14.0",
72
- "@conduit-client/service-store": "3.14.0",
73
- "@conduit-client/utils": "3.14.0",
51
+ "@conduit-client/command-aura-graphql-normalized-cache-control": "3.15.1",
52
+ "@conduit-client/command-aura-network": "3.15.1",
53
+ "@conduit-client/command-aura-normalized-cache-control": "3.15.1",
54
+ "@conduit-client/command-aura-resource-cache-control": "3.15.1",
55
+ "@conduit-client/command-fetch-network": "3.15.1",
56
+ "@conduit-client/command-http-graphql-normalized-cache-control": "3.15.1",
57
+ "@conduit-client/command-http-normalized-cache-control": "3.15.1",
58
+ "@conduit-client/command-ndjson": "3.15.1",
59
+ "@conduit-client/command-network": "3.15.1",
60
+ "@conduit-client/command-sse": "3.15.1",
61
+ "@conduit-client/command-streaming": "3.15.1",
62
+ "@conduit-client/service-aura-network": "3.15.1",
63
+ "@conduit-client/service-bindings-imperative": "3.15.1",
64
+ "@conduit-client/service-bindings-lwc": "3.15.1",
65
+ "@conduit-client/service-cache": "3.15.1",
66
+ "@conduit-client/service-cache-control": "3.15.1",
67
+ "@conduit-client/service-cache-inclusion-policy": "3.15.1",
68
+ "@conduit-client/service-config": "3.15.1",
69
+ "@conduit-client/service-feature-flags": "3.15.1",
70
+ "@conduit-client/service-fetch-network": "3.15.1",
71
+ "@conduit-client/service-instrument-command": "3.15.1",
72
+ "@conduit-client/service-pubsub": "3.15.1",
73
+ "@conduit-client/service-store": "3.15.1",
74
+ "@conduit-client/utils": "3.15.1",
74
75
  "@luvio/network-adapter-composable": "0.160.3",
75
76
  "@luvio/network-adapter-fetch": "0.160.3",
76
- "@lwc/state": "^0.26.0",
77
- "@salesforce/lds-adapters-onestore-graphql": "^1.420.0",
77
+ "@lwc/state": "^0.28.0",
78
+ "@salesforce/lds-adapters-onestore-graphql": "^1.421.1",
78
79
  "@salesforce/lds-adapters-uiapi-lex": "^1.415.0",
79
- "@salesforce/lds-luvio-service": "^1.420.0",
80
- "@salesforce/lds-luvio-uiapi-records-service": "^1.420.0"
80
+ "@salesforce/lds-durable-storage": "^1.421.1",
81
+ "@salesforce/lds-luvio-service": "^1.421.1",
82
+ "@salesforce/lds-luvio-uiapi-records-service": "^1.421.1"
81
83
  },
82
84
  "luvioBundlesize": [
83
85
  {
@@ -85,7 +87,7 @@
85
87
  "maxSize": {
86
88
  "none": "370 kB",
87
89
  "min": "190 kB",
88
- "compressed": "60.8 kB"
90
+ "compressed": "60.9 kB"
89
91
  }
90
92
  }
91
93
  ],