@salesforce/lds-runtime-mobile 1.426.1 → 1.428.0-dev1

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.
package/dist/main.js CHANGED
@@ -30,6 +30,7 @@ import graphqlPartialEmitParity from '@salesforce/gate/lmr.graphqlPartialEmitPar
30
30
  import { pdpEventSchema } from 'o11y_schema/sf_pdp';
31
31
  import { instrument as instrument$1 } from '@salesforce/lds-bindings';
32
32
  import ldsAdapterO11yLoggingGate from '@salesforce/gate/lmr.ldsAdapterO11yLogging';
33
+ import { entityFetchedMetadataSchema } from 'o11y_schema/sf_lightningsdk';
33
34
  import LOCALE from '@salesforce/i18n/locale';
34
35
  import CURRENCY from '@salesforce/i18n/currency';
35
36
  import TIMEZONE from '@salesforce/i18n/timeZone';
@@ -52374,6 +52375,7 @@ function instrumentAdapter(adapter, metadata) {
52374
52375
  });
52375
52376
  }
52376
52377
  },
52378
+ cacheMissObserver: logCacheMissObservability,
52377
52379
  });
52378
52380
  }
52379
52381
  function setupMobileInstrumentation(luvio, store) {
@@ -52392,6 +52394,101 @@ function registerReportObserver(reportObserver) {
52392
52394
  }
52393
52395
  };
52394
52396
  }
52397
+ /**
52398
+ * Extracts object name from the first field in fields or optionalFields array
52399
+ * @param record Object with fields and/or optionalFields arrays
52400
+ * @returns Object name (e.g., "Account" from "Account.Name") or undefined
52401
+ */
52402
+ function extractObjectNameFromFields(record) {
52403
+ const firstField = record.fields?.[0] || record.optionalFields?.[0];
52404
+ if (firstField) {
52405
+ const objectName = firstField.split('.')[0];
52406
+ return objectName || undefined;
52407
+ }
52408
+ return undefined;
52409
+ }
52410
+ /**
52411
+ * Extracts apiName from adapter config based on adapter type
52412
+ * @param adapterName The name of the adapter
52413
+ * @param config The adapter configuration
52414
+ * @param completedNetworkRequests Network requests for fallback extraction from response
52415
+ * @returns API name string or 'unknown'
52416
+ */
52417
+ function extractApiNameFromConfig(adapterName, config, completedNetworkRequests) {
52418
+ let apiName = 'unknown';
52419
+ // Parse config once to avoid repeated JSONParse calls
52420
+ const parsedConfig = typeof config === 'string' ? parse$5(config) : config;
52421
+ // Extract apiName based on adapter type
52422
+ switch (adapterName) {
52423
+ case 'getRecord':
52424
+ // getRecord config has fields/optionalFields like "Account.Name"
52425
+ // Extract apiName from first field in config
52426
+ const objectName = extractObjectNameFromFields(parsedConfig);
52427
+ if (objectName) {
52428
+ apiName = objectName;
52429
+ }
52430
+ else {
52431
+ // Fallback to response body when config uses layoutTypes instead of fields
52432
+ for (const request of completedNetworkRequests) {
52433
+ const response = request.response;
52434
+ if (response?.body?.apiName) {
52435
+ apiName = response.body.apiName;
52436
+ break;
52437
+ }
52438
+ }
52439
+ }
52440
+ break;
52441
+ case 'getRecords':
52442
+ // getRecords config has records array with fields/optionalFields like "Account.Name"
52443
+ // Extract apiNames from first field of each record to determine record type
52444
+ if (parsedConfig?.records && isArray$3(parsedConfig.records)) {
52445
+ const apiNames = new Set();
52446
+ for (const record of parsedConfig.records) {
52447
+ const recordObjectName = extractObjectNameFromFields(record);
52448
+ if (recordObjectName) {
52449
+ apiNames.add(recordObjectName);
52450
+ }
52451
+ }
52452
+ if (apiNames.size > 0) {
52453
+ apiName = Array.from(apiNames).sort().join(',');
52454
+ }
52455
+ }
52456
+ break;
52457
+ case 'getObjectInfo':
52458
+ case 'getPicklistValues':
52459
+ case 'getPicklistValuesByRecordType':
52460
+ case 'getLayout':
52461
+ // All of these adapters have a single objectApiName field
52462
+ if (parsedConfig?.objectApiName) {
52463
+ apiName = parsedConfig.objectApiName;
52464
+ }
52465
+ break;
52466
+ case 'getObjectInfos':
52467
+ // getObjectInfos has objectApiNames array (plural)
52468
+ if (parsedConfig?.objectApiNames && isArray$3(parsedConfig.objectApiNames)) {
52469
+ apiName = parsedConfig.objectApiNames.sort().join(',');
52470
+ }
52471
+ break;
52472
+ }
52473
+ return apiName;
52474
+ }
52475
+ function logCacheMissObservability(report) {
52476
+ const { snapshotState, adapterName, config } = report;
52477
+ // Check for offline conditions (short-circuits on first match)
52478
+ const isOffline = report.completedNetworkRequests.some((request) => {
52479
+ const response = request.response;
52480
+ return response?.errorType === 'networkAdapterError' || response?.status === 504;
52481
+ });
52482
+ // Extract apiName from config based on adapter type
52483
+ const apiName = extractApiNameFromConfig(adapterName, config, report.completedNetworkRequests);
52484
+ const wasSuccessful = snapshotState === 'Fulfilled' || snapshotState === 'Stale';
52485
+ ldsInstrumentation.log(entityFetchedMetadataSchema, {
52486
+ apiName: apiName,
52487
+ adapterName: adapterName,
52488
+ isOffline: isOffline,
52489
+ wasSuccessful: wasSuccessful,
52490
+ });
52491
+ }
52395
52492
 
52396
52493
  const { keys: keys$1, create: create$1, assign, entries: entries$1, values } = Object;
52397
52494
  const { stringify: stringify$3, parse: parse$3 } = JSON;
@@ -57049,14 +57146,15 @@ class CacheControlCommand extends BaseCommand {
57049
57146
  return "query";
57050
57147
  }
57051
57148
  /**
57052
- * Subscribes to cache update and invalidation events for reactive updates
57149
+ * Subscribes to cache update, invalidation, and eviction events for reactive updates
57053
57150
  *
57054
57151
  * This method sets up subscriptions to listen for changes that affect the data returned
57055
57152
  * by this Command.
57056
57153
  *
57057
- * By default, it subscribes to two types of events on the PubSub service:
57154
+ * By default, it subscribes to three types of events on the PubSub service:
57058
57155
  * - 'cacheUpdate': Triggers a rebuild with the original instantiation time
57059
- * - 'cacheInvalidation': Triggers a full refresh without time constraints
57156
+ * - 'cacheInvalidation': Triggers a full refresh without time constraints (data marked stale)
57157
+ * - 'cacheEviction': Triggers a full refresh without time constraints (data removed from cache)
57060
57158
  *
57061
57159
  * This method can be extended by subclasses to add additional subscriptions.
57062
57160
  *
@@ -57081,7 +57179,13 @@ class CacheControlCommand extends BaseCommand {
57081
57179
  callback: () => this.rerun().then(() => void 0),
57082
57180
  keys: this.keysUsed
57083
57181
  });
57084
- this.unsubscribers.push(rebuildUnsubscribe, refreshUnsubscribe);
57182
+ const evictionUnsubscribe = pubSub.subscribe({
57183
+ type: "cacheEviction",
57184
+ predicate: (event) => setOverlaps(event.data, this.keysUsed),
57185
+ callback: () => this.rerun().then(() => void 0),
57186
+ keys: this.keysUsed
57187
+ });
57188
+ this.unsubscribers.push(rebuildUnsubscribe, refreshUnsubscribe, evictionUnsubscribe);
57085
57189
  }
57086
57190
  /**
57087
57191
  * Unsubscribes from all stored subscriptions
@@ -58779,7 +58883,7 @@ function buildServiceDescriptor$b(luvio) {
58779
58883
  },
58780
58884
  };
58781
58885
  }
58782
- // version: 1.426.1-9fe18ee3ae
58886
+ // version: 1.428.0-dev1-52205c6c54
58783
58887
 
58784
58888
  /**
58785
58889
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -58805,7 +58909,7 @@ function buildServiceDescriptor$a(notifyRecordUpdateAvailable, getNormalizedLuvi
58805
58909
  },
58806
58910
  };
58807
58911
  }
58808
- // version: 1.426.1-9fe18ee3ae
58912
+ // version: 1.428.0-dev1-52205c6c54
58809
58913
 
58810
58914
  /*!
58811
58915
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -61465,4 +61569,4 @@ register({
61465
61569
  });
61466
61570
 
61467
61571
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, ingest$1o as ingestDenormalizedRecordRepresentation, initializeOneStore, registerReportObserver, reportGraphqlQueryParseError };
61468
- // version: 1.426.1-37e68ccef8
61572
+ // version: 1.428.0-dev1-c95a813572
@@ -0,0 +1 @@
1
+ export declare const entityFetchedMetadataSchema: {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-mobile",
3
- "version": "1.426.1",
3
+ "version": "1.428.0-dev1",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS runtime for mobile/hybrid environments.",
6
6
  "main": "dist/main.js",
@@ -32,44 +32,44 @@
32
32
  "release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-mobile"
33
33
  },
34
34
  "dependencies": {
35
- "@conduit-client/service-bindings-imperative": "3.17.3",
36
- "@conduit-client/service-bindings-lwc": "3.17.3",
37
- "@conduit-client/service-provisioner": "3.17.3",
38
- "@salesforce/lds-adapters-uiapi": "^1.426.1",
39
- "@salesforce/lds-bindings": "^1.426.1",
40
- "@salesforce/lds-instrumentation": "^1.426.1",
41
- "@salesforce/lds-luvio-service": "^1.426.1",
42
- "@salesforce/lds-luvio-uiapi-records-service": "^1.426.1",
35
+ "@conduit-client/service-bindings-imperative": "3.18.0",
36
+ "@conduit-client/service-bindings-lwc": "3.18.0",
37
+ "@conduit-client/service-provisioner": "3.18.0",
38
+ "@salesforce/lds-adapters-uiapi": "^1.428.0-dev1",
39
+ "@salesforce/lds-bindings": "^1.428.0-dev1",
40
+ "@salesforce/lds-instrumentation": "^1.428.0-dev1",
41
+ "@salesforce/lds-luvio-service": "^1.428.0-dev1",
42
+ "@salesforce/lds-luvio-uiapi-records-service": "^1.428.0-dev1",
43
43
  "@salesforce/user": "0.0.21",
44
44
  "o11y": "250.7.0",
45
45
  "o11y_schema": "256.126.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@conduit-client/command-aura-network": "3.17.3",
49
- "@conduit-client/command-aura-normalized-cache-control": "3.17.3",
50
- "@conduit-client/command-aura-resource-cache-control": "3.17.3",
51
- "@conduit-client/command-fetch-network": "3.17.3",
52
- "@conduit-client/command-http-normalized-cache-control": "3.17.3",
53
- "@conduit-client/command-network": "3.17.3",
54
- "@conduit-client/service-cache": "3.17.3",
55
- "@conduit-client/service-cache-control": "3.17.3",
56
- "@conduit-client/service-cache-inclusion-policy": "3.17.3",
57
- "@conduit-client/service-fetch-network": "3.17.3",
58
- "@conduit-client/service-instrument-command": "3.17.3",
59
- "@conduit-client/service-instrumentation": "3.17.3",
60
- "@conduit-client/service-pubsub": "3.17.3",
61
- "@conduit-client/service-store": "3.17.3",
62
- "@conduit-client/utils": "3.17.3",
63
- "@salesforce/lds-adapters-graphql": "^1.426.1",
64
- "@salesforce/lds-drafts": "^1.426.1",
65
- "@salesforce/lds-durable-records": "^1.426.1",
66
- "@salesforce/lds-network-adapter": "^1.426.1",
67
- "@salesforce/lds-network-nimbus": "^1.426.1",
68
- "@salesforce/lds-store-binary": "^1.426.1",
69
- "@salesforce/lds-store-nimbus": "^1.426.1",
70
- "@salesforce/lds-store-sql": "^1.426.1",
71
- "@salesforce/lds-utils-adapters": "^1.426.1",
72
- "@salesforce/nimbus-plugin-lds": "^1.426.1",
48
+ "@conduit-client/command-aura-network": "3.18.0",
49
+ "@conduit-client/command-aura-normalized-cache-control": "3.18.0",
50
+ "@conduit-client/command-aura-resource-cache-control": "3.18.0",
51
+ "@conduit-client/command-fetch-network": "3.18.0",
52
+ "@conduit-client/command-http-normalized-cache-control": "3.18.0",
53
+ "@conduit-client/command-network": "3.18.0",
54
+ "@conduit-client/service-cache": "3.18.0",
55
+ "@conduit-client/service-cache-control": "3.18.0",
56
+ "@conduit-client/service-cache-inclusion-policy": "3.18.0",
57
+ "@conduit-client/service-fetch-network": "3.18.0",
58
+ "@conduit-client/service-instrument-command": "3.18.0",
59
+ "@conduit-client/service-instrumentation": "3.18.0",
60
+ "@conduit-client/service-pubsub": "3.18.0",
61
+ "@conduit-client/service-store": "3.18.0",
62
+ "@conduit-client/utils": "3.18.0",
63
+ "@salesforce/lds-adapters-graphql": "^1.428.0-dev1",
64
+ "@salesforce/lds-drafts": "^1.428.0-dev1",
65
+ "@salesforce/lds-durable-records": "^1.428.0-dev1",
66
+ "@salesforce/lds-network-adapter": "^1.428.0-dev1",
67
+ "@salesforce/lds-network-nimbus": "^1.428.0-dev1",
68
+ "@salesforce/lds-store-binary": "^1.428.0-dev1",
69
+ "@salesforce/lds-store-nimbus": "^1.428.0-dev1",
70
+ "@salesforce/lds-store-sql": "^1.428.0-dev1",
71
+ "@salesforce/lds-utils-adapters": "^1.428.0-dev1",
72
+ "@salesforce/nimbus-plugin-lds": "^1.428.0-dev1",
73
73
  "babel-plugin-dynamic-import-node": "^2.3.3",
74
74
  "wait-for-expect": "^3.0.2"
75
75
  },
package/sfdc/main.js CHANGED
@@ -30,6 +30,7 @@ import graphqlPartialEmitParity from '@salesforce/gate/lmr.graphqlPartialEmitPar
30
30
  import { pdpEventSchema } from 'o11y_schema/sf_pdp';
31
31
  import { instrument as instrument$1 } from 'force/ldsBindings';
32
32
  import ldsAdapterO11yLoggingGate from '@salesforce/gate/lmr.ldsAdapterO11yLogging';
33
+ import { entityFetchedMetadataSchema } from 'o11y_schema/sf_lightningsdk';
33
34
  import LOCALE from '@salesforce/i18n/locale';
34
35
  import CURRENCY from '@salesforce/i18n/currency';
35
36
  import TIMEZONE from '@salesforce/i18n/timeZone';
@@ -52374,6 +52375,7 @@ function instrumentAdapter(adapter, metadata) {
52374
52375
  });
52375
52376
  }
52376
52377
  },
52378
+ cacheMissObserver: logCacheMissObservability,
52377
52379
  });
52378
52380
  }
52379
52381
  function setupMobileInstrumentation(luvio, store) {
@@ -52392,6 +52394,101 @@ function registerReportObserver(reportObserver) {
52392
52394
  }
52393
52395
  };
52394
52396
  }
52397
+ /**
52398
+ * Extracts object name from the first field in fields or optionalFields array
52399
+ * @param record Object with fields and/or optionalFields arrays
52400
+ * @returns Object name (e.g., "Account" from "Account.Name") or undefined
52401
+ */
52402
+ function extractObjectNameFromFields(record) {
52403
+ const firstField = record.fields?.[0] || record.optionalFields?.[0];
52404
+ if (firstField) {
52405
+ const objectName = firstField.split('.')[0];
52406
+ return objectName || undefined;
52407
+ }
52408
+ return undefined;
52409
+ }
52410
+ /**
52411
+ * Extracts apiName from adapter config based on adapter type
52412
+ * @param adapterName The name of the adapter
52413
+ * @param config The adapter configuration
52414
+ * @param completedNetworkRequests Network requests for fallback extraction from response
52415
+ * @returns API name string or 'unknown'
52416
+ */
52417
+ function extractApiNameFromConfig(adapterName, config, completedNetworkRequests) {
52418
+ let apiName = 'unknown';
52419
+ // Parse config once to avoid repeated JSONParse calls
52420
+ const parsedConfig = typeof config === 'string' ? parse$5(config) : config;
52421
+ // Extract apiName based on adapter type
52422
+ switch (adapterName) {
52423
+ case 'getRecord':
52424
+ // getRecord config has fields/optionalFields like "Account.Name"
52425
+ // Extract apiName from first field in config
52426
+ const objectName = extractObjectNameFromFields(parsedConfig);
52427
+ if (objectName) {
52428
+ apiName = objectName;
52429
+ }
52430
+ else {
52431
+ // Fallback to response body when config uses layoutTypes instead of fields
52432
+ for (const request of completedNetworkRequests) {
52433
+ const response = request.response;
52434
+ if (response?.body?.apiName) {
52435
+ apiName = response.body.apiName;
52436
+ break;
52437
+ }
52438
+ }
52439
+ }
52440
+ break;
52441
+ case 'getRecords':
52442
+ // getRecords config has records array with fields/optionalFields like "Account.Name"
52443
+ // Extract apiNames from first field of each record to determine record type
52444
+ if (parsedConfig?.records && isArray$3(parsedConfig.records)) {
52445
+ const apiNames = new Set();
52446
+ for (const record of parsedConfig.records) {
52447
+ const recordObjectName = extractObjectNameFromFields(record);
52448
+ if (recordObjectName) {
52449
+ apiNames.add(recordObjectName);
52450
+ }
52451
+ }
52452
+ if (apiNames.size > 0) {
52453
+ apiName = Array.from(apiNames).sort().join(',');
52454
+ }
52455
+ }
52456
+ break;
52457
+ case 'getObjectInfo':
52458
+ case 'getPicklistValues':
52459
+ case 'getPicklistValuesByRecordType':
52460
+ case 'getLayout':
52461
+ // All of these adapters have a single objectApiName field
52462
+ if (parsedConfig?.objectApiName) {
52463
+ apiName = parsedConfig.objectApiName;
52464
+ }
52465
+ break;
52466
+ case 'getObjectInfos':
52467
+ // getObjectInfos has objectApiNames array (plural)
52468
+ if (parsedConfig?.objectApiNames && isArray$3(parsedConfig.objectApiNames)) {
52469
+ apiName = parsedConfig.objectApiNames.sort().join(',');
52470
+ }
52471
+ break;
52472
+ }
52473
+ return apiName;
52474
+ }
52475
+ function logCacheMissObservability(report) {
52476
+ const { snapshotState, adapterName, config } = report;
52477
+ // Check for offline conditions (short-circuits on first match)
52478
+ const isOffline = report.completedNetworkRequests.some((request) => {
52479
+ const response = request.response;
52480
+ return response?.errorType === 'networkAdapterError' || response?.status === 504;
52481
+ });
52482
+ // Extract apiName from config based on adapter type
52483
+ const apiName = extractApiNameFromConfig(adapterName, config, report.completedNetworkRequests);
52484
+ const wasSuccessful = snapshotState === 'Fulfilled' || snapshotState === 'Stale';
52485
+ ldsInstrumentation.log(entityFetchedMetadataSchema, {
52486
+ apiName: apiName,
52487
+ adapterName: adapterName,
52488
+ isOffline: isOffline,
52489
+ wasSuccessful: wasSuccessful,
52490
+ });
52491
+ }
52395
52492
 
52396
52493
  const { keys: keys$1, create: create$1, assign, entries: entries$1, values } = Object;
52397
52494
  const { stringify: stringify$3, parse: parse$3 } = JSON;
@@ -57049,14 +57146,15 @@ class CacheControlCommand extends BaseCommand {
57049
57146
  return "query";
57050
57147
  }
57051
57148
  /**
57052
- * Subscribes to cache update and invalidation events for reactive updates
57149
+ * Subscribes to cache update, invalidation, and eviction events for reactive updates
57053
57150
  *
57054
57151
  * This method sets up subscriptions to listen for changes that affect the data returned
57055
57152
  * by this Command.
57056
57153
  *
57057
- * By default, it subscribes to two types of events on the PubSub service:
57154
+ * By default, it subscribes to three types of events on the PubSub service:
57058
57155
  * - 'cacheUpdate': Triggers a rebuild with the original instantiation time
57059
- * - 'cacheInvalidation': Triggers a full refresh without time constraints
57156
+ * - 'cacheInvalidation': Triggers a full refresh without time constraints (data marked stale)
57157
+ * - 'cacheEviction': Triggers a full refresh without time constraints (data removed from cache)
57060
57158
  *
57061
57159
  * This method can be extended by subclasses to add additional subscriptions.
57062
57160
  *
@@ -57081,7 +57179,13 @@ class CacheControlCommand extends BaseCommand {
57081
57179
  callback: () => this.rerun().then(() => void 0),
57082
57180
  keys: this.keysUsed
57083
57181
  });
57084
- this.unsubscribers.push(rebuildUnsubscribe, refreshUnsubscribe);
57182
+ const evictionUnsubscribe = pubSub.subscribe({
57183
+ type: "cacheEviction",
57184
+ predicate: (event) => setOverlaps(event.data, this.keysUsed),
57185
+ callback: () => this.rerun().then(() => void 0),
57186
+ keys: this.keysUsed
57187
+ });
57188
+ this.unsubscribers.push(rebuildUnsubscribe, refreshUnsubscribe, evictionUnsubscribe);
57085
57189
  }
57086
57190
  /**
57087
57191
  * Unsubscribes from all stored subscriptions
@@ -58779,7 +58883,7 @@ function buildServiceDescriptor$b(luvio) {
58779
58883
  },
58780
58884
  };
58781
58885
  }
58782
- // version: 1.426.1-9fe18ee3ae
58886
+ // version: 1.428.0-dev1-52205c6c54
58783
58887
 
58784
58888
  /**
58785
58889
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -58805,7 +58909,7 @@ function buildServiceDescriptor$a(notifyRecordUpdateAvailable, getNormalizedLuvi
58805
58909
  },
58806
58910
  };
58807
58911
  }
58808
- // version: 1.426.1-9fe18ee3ae
58912
+ // version: 1.428.0-dev1-52205c6c54
58809
58913
 
58810
58914
  /*!
58811
58915
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -61465,4 +61569,4 @@ register({
61465
61569
  });
61466
61570
 
61467
61571
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, ingest$1o as ingestDenormalizedRecordRepresentation, initializeOneStore, registerReportObserver, reportGraphqlQueryParseError };
61468
- // version: 1.426.1-37e68ccef8
61572
+ // version: 1.428.0-dev1-c95a813572
@@ -0,0 +1 @@
1
+ export declare const entityFetchedMetadataSchema: {};