@salesforce/lds-runtime-mobile 1.283.0 → 1.284.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.
package/dist/main.js CHANGED
@@ -11325,7 +11325,7 @@ function injectParentRelationships(selections, parentNode, parentPath, ancestors
11325
11325
  * @param objectInfos
11326
11326
  * @returns
11327
11327
  */
11328
- function injectFieldsForDisplayValue(topNode, parentNode, objectInfos) {
11328
+ function injectFieldsForDisplayValue(topNode, apiName, objectInfos) {
11329
11329
  const { selectionSet } = topNode;
11330
11330
  if (selectionSet === undefined)
11331
11331
  return [];
@@ -11339,13 +11339,8 @@ function injectFieldsForDisplayValue(topNode, parentNode, objectInfos) {
11339
11339
  displayValue = node;
11340
11340
  break;
11341
11341
  }
11342
- if (isInlineFragmentNode(node)) {
11343
- const name = node.typeCondition !== undefined ? node.typeCondition.name : parentNode.name;
11344
- displayValueNameFields = injectFieldsForDisplayValue(node, { ...parentNode, name }, objectInfos);
11345
- }
11346
11342
  }
11347
11343
  if (displayValue !== undefined) {
11348
- const apiName = parentNode.name.value;
11349
11344
  const objectInfo = objectInfos[apiName];
11350
11345
  if (objectInfo !== undefined &&
11351
11346
  objectInfo.nameFields !== undefined &&
@@ -11412,19 +11407,24 @@ function injectFields(selections, parentNode, parentPath, ancestors, objectInfos
11412
11407
  // example: TimeSheetId { value }
11413
11408
  relatedIdForChildRelationship.push(createFieldNode(injectedParentFieldName, FieldValueNodeSelectionSet));
11414
11409
  }
11415
- displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, {
11416
- ...parent,
11417
- name: {
11418
- ...parent.name,
11419
- value: targetRelationship.childObjectApiName,
11420
- },
11421
- }, objectInfos));
11410
+ displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, targetRelationship.childObjectApiName, objectInfos));
11422
11411
  }
11423
11412
  }
11424
11413
  }
11425
- displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, parent, objectInfos));
11414
+ else {
11415
+ let apiName = parent.name.value;
11416
+ if (pathToObjectApiNamesMap[parentPath] !== undefined &&
11417
+ pathToObjectApiNamesMap[parentPath].length === 1) {
11418
+ apiName = pathToObjectApiNamesMap[parentPath][0];
11419
+ }
11420
+ displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, apiName, objectInfos));
11421
+ }
11426
11422
  }
11427
11423
  }
11424
+ else if (isInlineFragmentNode(parentNode) && parentNode.typeCondition !== undefined) {
11425
+ const { typeCondition: { name: { value: apiName }, }, } = parentNode;
11426
+ displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, apiName, objectInfos));
11427
+ }
11428
11428
  return [
11429
11429
  ...rootQueryIdField,
11430
11430
  ...flat(parentRelaltionships),
@@ -13109,6 +13109,9 @@ function normalizeRecordFields(key, entry) {
13109
13109
  * Transforms a record for storage in the durable store. The transformation involves denormalizing
13110
13110
  * scalar fields and persisting link metadata to transform back into a normalized representation
13111
13111
  *
13112
+ * If the record contains pending fields this will return undefined as pending records do not get persisted
13113
+ * to the durable store. There should be a refresh operation outbound that will bring in the updated record.
13114
+ *
13112
13115
  * @param normalizedRecord Record containing normalized field links
13113
13116
  * @param recordStore a store containing referenced record fields
13114
13117
  */
@@ -13123,7 +13126,9 @@ function buildDurableRecordRepresentation(normalizedRecord, records, pendingEntr
13123
13126
  // pending fields get filtered out of the durable store
13124
13127
  const { pending } = field;
13125
13128
  if (pending === true) {
13126
- continue;
13129
+ // do not write records with pending fields to the durable store
13130
+ // there should be a refresh operation outbound that will bring in the updated record
13131
+ return undefined;
13127
13132
  }
13128
13133
  const { __ref } = field;
13129
13134
  if (__ref !== undefined) {
@@ -13289,10 +13294,12 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
13289
13294
  };
13290
13295
  }
13291
13296
  const denormalizedRecord = buildDurableRecordRepresentation(record, storeRecords, recordEntries, store);
13292
- putEntries[recordKey] = {
13293
- data: denormalizedRecord,
13294
- metadata,
13295
- };
13297
+ if (denormalizedRecord !== undefined) {
13298
+ putEntries[recordKey] = {
13299
+ data: denormalizedRecord,
13300
+ metadata,
13301
+ };
13302
+ }
13296
13303
  }
13297
13304
  else {
13298
13305
  putEntries[key] = value;
@@ -16868,17 +16875,6 @@ const NimbusBinaryStore = {
16868
16875
  },
16869
16876
  };
16870
16877
 
16871
- function setupInspection(luvio) {
16872
- if (__nimbus.plugins.LdsInspectorPlugin !== undefined) {
16873
- // when inspection is enabled, make luvio available as a global
16874
- // eslint-disable-next-line no-undef
16875
- globalThis.luvio = luvio;
16876
- registerReportObserver((report) => {
16877
- __nimbus.plugins.LdsInspectorPlugin.sendAdapterReport(stringify$1(report));
16878
- });
16879
- }
16880
- }
16881
-
16882
16878
  /**
16883
16879
  * Copyright (c) 2022, Salesforce, Inc.,
16884
16880
  * All rights reserved.
@@ -18002,6 +17998,21 @@ function primingSessionFactory(config) {
18002
17998
  return instrumentPrimingSession(session);
18003
17999
  }
18004
18000
 
18001
+ // so eslint doesn't complain about nimbus
18002
+ /* global __nimbus */
18003
+ function setupObserver() {
18004
+ if (__nimbus.plugins.LdsObserverPlugin !== undefined) {
18005
+ registerReportObserver((report) => {
18006
+ __nimbus.plugins.LdsObserverPlugin.logAdapterExecution({
18007
+ name: report.adapterName,
18008
+ serializedConfig: stringify$1(report.config),
18009
+ status: report.result,
18010
+ duration: report.executionTime,
18011
+ });
18012
+ });
18013
+ }
18014
+ }
18015
+
18005
18016
  // so eslint doesn't complain about nimbus
18006
18017
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
18007
18018
  /* global __nimbus */
@@ -18096,8 +18107,8 @@ function getRuntime() {
18096
18107
  lazyGetRecords = getRecordsAdapterFactory(lazyLuvio);
18097
18108
  // Currently instruments store runtime perf
18098
18109
  setupMobileInstrumentation(lazyLuvio, store);
18099
- // If the inspection nimbus plugin is configured, inspection is enabled otherwise this is a no-op
18100
- setupInspection(lazyLuvio);
18110
+ // If the observer nimbus plugin is configured, observation is enabled otherwise this is a no-op
18111
+ setupObserver();
18101
18112
  // set storeEval function for lds-adapters-graghql to use
18102
18113
  withRegistration('@salesforce/lds-adapters-graphql', (registration) => {
18103
18114
  const { configuration: { setStoreEval, setDraftFunctions }, } = registration;
@@ -18170,4 +18181,4 @@ register({
18170
18181
  });
18171
18182
 
18172
18183
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
18173
- // version: 1.283.0-a330da944
18184
+ // version: 1.284.0-a7e8dc51c
@@ -0,0 +1 @@
1
+ export declare function setupObserver(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-mobile",
3
- "version": "1.283.0",
3
+ "version": "1.284.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS runtime for mobile/hybrid environments.",
6
6
  "main": "dist/main.js",
@@ -32,25 +32,25 @@
32
32
  "release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-mobile"
33
33
  },
34
34
  "dependencies": {
35
- "@salesforce/lds-adapters-uiapi": "^1.283.0",
36
- "@salesforce/lds-bindings": "^1.283.0",
37
- "@salesforce/lds-instrumentation": "^1.283.0",
38
- "@salesforce/lds-priming": "^1.283.0",
35
+ "@salesforce/lds-adapters-uiapi": "^1.284.0",
36
+ "@salesforce/lds-bindings": "^1.284.0",
37
+ "@salesforce/lds-instrumentation": "^1.284.0",
38
+ "@salesforce/lds-priming": "^1.284.0",
39
39
  "@salesforce/user": "0.0.21",
40
40
  "o11y": "244.0.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@salesforce/lds-adapters-graphql": "^1.283.0",
44
- "@salesforce/lds-drafts": "^1.283.0",
45
- "@salesforce/lds-drafts-adapters-uiapi": "^1.283.0",
46
- "@salesforce/lds-graphql-eval": "^1.283.0",
47
- "@salesforce/lds-network-adapter": "^1.283.0",
48
- "@salesforce/lds-network-nimbus": "^1.283.0",
49
- "@salesforce/lds-store-binary": "^1.283.0",
50
- "@salesforce/lds-store-nimbus": "^1.283.0",
51
- "@salesforce/lds-store-sql": "^1.283.0",
52
- "@salesforce/lds-utils-adapters": "^1.283.0",
53
- "@salesforce/nimbus-plugin-lds": "^1.283.0",
43
+ "@salesforce/lds-adapters-graphql": "^1.284.0",
44
+ "@salesforce/lds-drafts": "^1.284.0",
45
+ "@salesforce/lds-drafts-adapters-uiapi": "^1.284.0",
46
+ "@salesforce/lds-graphql-eval": "^1.284.0",
47
+ "@salesforce/lds-network-adapter": "^1.284.0",
48
+ "@salesforce/lds-network-nimbus": "^1.284.0",
49
+ "@salesforce/lds-store-binary": "^1.284.0",
50
+ "@salesforce/lds-store-nimbus": "^1.284.0",
51
+ "@salesforce/lds-store-sql": "^1.284.0",
52
+ "@salesforce/lds-utils-adapters": "^1.284.0",
53
+ "@salesforce/nimbus-plugin-lds": "^1.284.0",
54
54
  "babel-plugin-dynamic-import-node": "^2.3.3",
55
55
  "wait-for-expect": "^3.0.2"
56
56
  },
package/sfdc/main.js CHANGED
@@ -11325,7 +11325,7 @@ function injectParentRelationships(selections, parentNode, parentPath, ancestors
11325
11325
  * @param objectInfos
11326
11326
  * @returns
11327
11327
  */
11328
- function injectFieldsForDisplayValue(topNode, parentNode, objectInfos) {
11328
+ function injectFieldsForDisplayValue(topNode, apiName, objectInfos) {
11329
11329
  const { selectionSet } = topNode;
11330
11330
  if (selectionSet === undefined)
11331
11331
  return [];
@@ -11339,13 +11339,8 @@ function injectFieldsForDisplayValue(topNode, parentNode, objectInfos) {
11339
11339
  displayValue = node;
11340
11340
  break;
11341
11341
  }
11342
- if (isInlineFragmentNode(node)) {
11343
- const name = node.typeCondition !== undefined ? node.typeCondition.name : parentNode.name;
11344
- displayValueNameFields = injectFieldsForDisplayValue(node, { ...parentNode, name }, objectInfos);
11345
- }
11346
11342
  }
11347
11343
  if (displayValue !== undefined) {
11348
- const apiName = parentNode.name.value;
11349
11344
  const objectInfo = objectInfos[apiName];
11350
11345
  if (objectInfo !== undefined &&
11351
11346
  objectInfo.nameFields !== undefined &&
@@ -11412,19 +11407,24 @@ function injectFields(selections, parentNode, parentPath, ancestors, objectInfos
11412
11407
  // example: TimeSheetId { value }
11413
11408
  relatedIdForChildRelationship.push(createFieldNode(injectedParentFieldName, FieldValueNodeSelectionSet));
11414
11409
  }
11415
- displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, {
11416
- ...parent,
11417
- name: {
11418
- ...parent.name,
11419
- value: targetRelationship.childObjectApiName,
11420
- },
11421
- }, objectInfos));
11410
+ displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, targetRelationship.childObjectApiName, objectInfos));
11422
11411
  }
11423
11412
  }
11424
11413
  }
11425
- displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, parent, objectInfos));
11414
+ else {
11415
+ let apiName = parent.name.value;
11416
+ if (pathToObjectApiNamesMap[parentPath] !== undefined &&
11417
+ pathToObjectApiNamesMap[parentPath].length === 1) {
11418
+ apiName = pathToObjectApiNamesMap[parentPath][0];
11419
+ }
11420
+ displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, apiName, objectInfos));
11421
+ }
11426
11422
  }
11427
11423
  }
11424
+ else if (isInlineFragmentNode(parentNode) && parentNode.typeCondition !== undefined) {
11425
+ const { typeCondition: { name: { value: apiName }, }, } = parentNode;
11426
+ displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, apiName, objectInfos));
11427
+ }
11428
11428
  return [
11429
11429
  ...rootQueryIdField,
11430
11430
  ...flat(parentRelaltionships),
@@ -13109,6 +13109,9 @@ function normalizeRecordFields(key, entry) {
13109
13109
  * Transforms a record for storage in the durable store. The transformation involves denormalizing
13110
13110
  * scalar fields and persisting link metadata to transform back into a normalized representation
13111
13111
  *
13112
+ * If the record contains pending fields this will return undefined as pending records do not get persisted
13113
+ * to the durable store. There should be a refresh operation outbound that will bring in the updated record.
13114
+ *
13112
13115
  * @param normalizedRecord Record containing normalized field links
13113
13116
  * @param recordStore a store containing referenced record fields
13114
13117
  */
@@ -13123,7 +13126,9 @@ function buildDurableRecordRepresentation(normalizedRecord, records, pendingEntr
13123
13126
  // pending fields get filtered out of the durable store
13124
13127
  const { pending } = field;
13125
13128
  if (pending === true) {
13126
- continue;
13129
+ // do not write records with pending fields to the durable store
13130
+ // there should be a refresh operation outbound that will bring in the updated record
13131
+ return undefined;
13127
13132
  }
13128
13133
  const { __ref } = field;
13129
13134
  if (__ref !== undefined) {
@@ -13289,10 +13294,12 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
13289
13294
  };
13290
13295
  }
13291
13296
  const denormalizedRecord = buildDurableRecordRepresentation(record, storeRecords, recordEntries, store);
13292
- putEntries[recordKey] = {
13293
- data: denormalizedRecord,
13294
- metadata,
13295
- };
13297
+ if (denormalizedRecord !== undefined) {
13298
+ putEntries[recordKey] = {
13299
+ data: denormalizedRecord,
13300
+ metadata,
13301
+ };
13302
+ }
13296
13303
  }
13297
13304
  else {
13298
13305
  putEntries[key] = value;
@@ -16868,17 +16875,6 @@ const NimbusBinaryStore = {
16868
16875
  },
16869
16876
  };
16870
16877
 
16871
- function setupInspection(luvio) {
16872
- if (__nimbus.plugins.LdsInspectorPlugin !== undefined) {
16873
- // when inspection is enabled, make luvio available as a global
16874
- // eslint-disable-next-line no-undef
16875
- globalThis.luvio = luvio;
16876
- registerReportObserver((report) => {
16877
- __nimbus.plugins.LdsInspectorPlugin.sendAdapterReport(stringify$1(report));
16878
- });
16879
- }
16880
- }
16881
-
16882
16878
  /**
16883
16879
  * Copyright (c) 2022, Salesforce, Inc.,
16884
16880
  * All rights reserved.
@@ -18002,6 +17998,21 @@ function primingSessionFactory(config) {
18002
17998
  return instrumentPrimingSession(session);
18003
17999
  }
18004
18000
 
18001
+ // so eslint doesn't complain about nimbus
18002
+ /* global __nimbus */
18003
+ function setupObserver() {
18004
+ if (__nimbus.plugins.LdsObserverPlugin !== undefined) {
18005
+ registerReportObserver((report) => {
18006
+ __nimbus.plugins.LdsObserverPlugin.logAdapterExecution({
18007
+ name: report.adapterName,
18008
+ serializedConfig: stringify$1(report.config),
18009
+ status: report.result,
18010
+ duration: report.executionTime,
18011
+ });
18012
+ });
18013
+ }
18014
+ }
18015
+
18005
18016
  // so eslint doesn't complain about nimbus
18006
18017
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
18007
18018
  /* global __nimbus */
@@ -18096,8 +18107,8 @@ function getRuntime() {
18096
18107
  lazyGetRecords = getRecordsAdapterFactory(lazyLuvio);
18097
18108
  // Currently instruments store runtime perf
18098
18109
  setupMobileInstrumentation(lazyLuvio, store);
18099
- // If the inspection nimbus plugin is configured, inspection is enabled otherwise this is a no-op
18100
- setupInspection(lazyLuvio);
18110
+ // If the observer nimbus plugin is configured, observation is enabled otherwise this is a no-op
18111
+ setupObserver();
18101
18112
  // set storeEval function for lds-adapters-graghql to use
18102
18113
  withRegistration('@salesforce/lds-adapters-graphql', (registration) => {
18103
18114
  const { configuration: { setStoreEval, setDraftFunctions }, } = registration;
@@ -18170,4 +18181,4 @@ register({
18170
18181
  });
18171
18182
 
18172
18183
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
18173
- // version: 1.283.0-a330da944
18184
+ // version: 1.284.0-a7e8dc51c
@@ -0,0 +1 @@
1
+ export declare function setupObserver(): void;
@@ -1,2 +0,0 @@
1
- import type { Luvio } from '@luvio/engine';
2
- export declare function setupInspection(luvio: Luvio): void;
@@ -1,2 +0,0 @@
1
- import type { Luvio } from '@luvio/engine';
2
- export declare function setupInspection(luvio: Luvio): void;