@salesforce/lds-runtime-mobile 1.229.0-dev7 → 1.229.0-dev9

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 (3) hide show
  1. package/dist/main.js +46 -41
  2. package/package.json +16 -16
  3. package/sfdc/main.js +46 -41
package/dist/main.js CHANGED
@@ -17,6 +17,7 @@ import { HttpStatusCode, StoreKeySet, serializeStructuredKey, Reader, deepFreeze
17
17
  import excludeStaleRecordsGate from '@salesforce/gate/lds.graphqlEvalExcludeStaleRecords';
18
18
  import { parseAndVisit, Kind, visit, execute, buildSchema, isObjectType, defaultFieldResolver } from '@luvio/graphql-parser';
19
19
  import { getRecordId18, keyBuilderQuickActionExecutionRepresentation, ingestQuickActionExecutionRepresentation, keyBuilderContentDocumentCompositeRepresentation, getResponseCacheKeysContentDocumentCompositeRepresentation, keyBuilderFromTypeContentDocumentCompositeRepresentation, ingestContentDocumentCompositeRepresentation, keyBuilderRecord, getTypeCacheKeysRecord, keyBuilderFromTypeRecordRepresentation, ingestRecord, RecordRepresentationRepresentationType, ObjectInfoRepresentationType, getRecordAdapterFactory, getObjectInfoAdapterFactory, getObjectInfosAdapterFactory, UiApiNamespace, RecordRepresentationType, RecordRepresentationTTL, RecordRepresentationVersion, getRecordsAdapterFactory } from '@salesforce/lds-adapters-uiapi';
20
+ import ldsIdempotencyWriteDisabled from '@salesforce/gate/lds.idempotencyWriteDisabled';
20
21
  import caseSensitiveUserId from '@salesforce/user/Id';
21
22
  import { idleDetector, getInstrumentation } from 'o11y/client';
22
23
  import ldsUseShortUrlGate from '@salesforce/gate/lds.useShortUrl';
@@ -1139,12 +1140,12 @@ function makeDurable(environment, { durableStore, instrumentation }) {
1139
1140
  }
1140
1141
  return environment.getNode(key, ingestStagingStore);
1141
1142
  };
1142
- const wrapNormalizedGraphNode = function (normalized) {
1143
+ const wrapNormalizedGraphNode = function (normalized, key) {
1143
1144
  validateNotDisposed();
1144
1145
  if (ingestStagingStore === null) {
1145
1146
  ingestStagingStore = buildIngestStagingStore(environment);
1146
1147
  }
1147
- return environment.wrapNormalizedGraphNode(normalized, ingestStagingStore);
1148
+ return environment.wrapNormalizedGraphNode(normalized, key, ingestStagingStore);
1148
1149
  };
1149
1150
  const rebuildSnapshot = function (snapshot, onRebuild) {
1150
1151
  validateNotDisposed();
@@ -5950,7 +5951,12 @@ class AbstractResourceRequestActionHandler {
5950
5951
  // the luvio store redirect table, during which a new draft might be enqueued
5951
5952
  // which would not see a necessary mapping.
5952
5953
  this.ephemeralRedirects = {};
5954
+ // determined by Server setup.
5953
5955
  this.isIdempotencySupported = true;
5956
+ // idempotency write flag set by lds
5957
+ this.isLdsIdempotencyWriteDisabled = ldsIdempotencyWriteDisabled.isOpen({
5958
+ fallback: false,
5959
+ });
5954
5960
  }
5955
5961
  enqueue(data) {
5956
5962
  return this.draftQueue.enqueue(this.handlerId, data);
@@ -6310,7 +6316,7 @@ class AbstractResourceRequestActionHandler {
6310
6316
  return [action.targetId];
6311
6317
  }
6312
6318
  hasIdempotencySupport() {
6313
- return this.isIdempotencySupported;
6319
+ return this.isIdempotencySupported && !this.isLdsIdempotencyWriteDisabled;
6314
6320
  }
6315
6321
  async ingestResponses(responses, action) {
6316
6322
  const luvio = this.getLuvio();
@@ -11765,34 +11771,42 @@ function applyReferenceLinksToDraft(record, draftMetadata) {
11765
11771
  }
11766
11772
  const { dataType, relationshipName, referenceToInfos } = fieldInfo;
11767
11773
  const draftFieldValue = record.fields[draftField].value;
11768
- if (dataType === 'Reference' && relationshipName !== null && draftFieldValue !== null) {
11769
- if (typeof draftFieldValue !== 'string') {
11770
- throw Error('reference field value is not a string');
11774
+ if (dataType === 'Reference' && relationshipName !== null) {
11775
+ if (draftFieldValue === null) {
11776
+ recordFields[relationshipName] = {
11777
+ displayValue: null,
11778
+ value: null,
11779
+ };
11771
11780
  }
11772
- const key = getRecordKeyForId(luvio, draftFieldValue);
11773
- const referencedRecord = referencedRecords.get(key);
11774
- recordFields[relationshipName] = {
11775
- displayValue: null,
11776
- value: createLink(key),
11777
- };
11778
- // for custom objects, we select the 'Name' field
11779
- // otherwise we check the object info for name fields.
11780
- //if there are multiple we select 'Name' if it exists, otherwise the first one
11781
- if (referencedRecord !== undefined && referenceToInfos.length > 0) {
11782
- let nameField;
11783
- const referenceToInfo = referenceToInfos[0];
11784
- const nameFields = referenceToInfo.nameFields;
11785
- if (nameFields.length !== 0) {
11786
- nameField = nameFields.find((x) => x === 'Name');
11787
- if (nameField === undefined) {
11788
- nameField = nameFields[0];
11789
- }
11781
+ else {
11782
+ if (typeof draftFieldValue !== 'string') {
11783
+ throw Error('reference field value is not a string');
11790
11784
  }
11791
- if (nameField !== undefined) {
11792
- const nameFieldRef = referencedRecord.fields[nameField];
11793
- if (nameFieldRef) {
11794
- recordFields[relationshipName].displayValue =
11795
- (_a = nameFieldRef.displayValue) !== null && _a !== void 0 ? _a : nameFieldRef.value;
11785
+ const key = getRecordKeyForId(luvio, draftFieldValue);
11786
+ const referencedRecord = referencedRecords.get(key);
11787
+ recordFields[relationshipName] = {
11788
+ displayValue: null,
11789
+ value: createLink(key),
11790
+ };
11791
+ // for custom objects, we select the 'Name' field
11792
+ // otherwise we check the object info for name fields.
11793
+ //if there are multiple we select 'Name' if it exists, otherwise the first one
11794
+ if (referencedRecord !== undefined && referenceToInfos.length > 0) {
11795
+ let nameField;
11796
+ const referenceToInfo = referenceToInfos[0];
11797
+ const nameFields = referenceToInfo.nameFields;
11798
+ if (nameFields.length !== 0) {
11799
+ nameField = nameFields.find((x) => x === 'Name');
11800
+ if (nameField === undefined) {
11801
+ nameField = nameFields[0];
11802
+ }
11803
+ }
11804
+ if (nameField !== undefined) {
11805
+ const nameFieldRef = referencedRecord.fields[nameField];
11806
+ if (nameFieldRef) {
11807
+ recordFields[relationshipName].displayValue =
11808
+ (_a = nameFieldRef.displayValue) !== null && _a !== void 0 ? _a : nameFieldRef.value;
11809
+ }
11796
11810
  }
11797
11811
  }
11798
11812
  }
@@ -12085,17 +12099,8 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
12085
12099
  };
12086
12100
  for (const fieldName of keys$3(recordWithSpanningRefLinks.fields)) {
12087
12101
  const fieldKey = buildRecordFieldStoreKey(key, fieldName);
12088
- if (this.collectedFields[fieldKey] !== undefined) {
12089
- const fieldData = recordWithSpanningRefLinks.fields[fieldName];
12090
- normalizedRecord.fields[fieldName] = { __ref: fieldKey };
12091
- publishData(fieldKey, fieldData);
12092
- }
12093
- else if (recordWithSpanningRefLinks.fields[fieldName] &&
12094
- recordWithSpanningRefLinks.fields[fieldName].value &&
12095
- recordWithSpanningRefLinks.fields[fieldName].value.__ref !== undefined) {
12096
- normalizedRecord.fields[fieldName] = { __ref: fieldKey };
12097
- publishData(fieldKey, recordWithSpanningRefLinks.fields[fieldName]);
12098
- }
12102
+ normalizedRecord.fields[fieldName] = { __ref: fieldKey };
12103
+ publishData(fieldKey, recordWithSpanningRefLinks.fields[fieldName]);
12099
12104
  }
12100
12105
  // publish the normalized record
12101
12106
  publishData(key, normalizedRecord);
@@ -16921,4 +16926,4 @@ register({
16921
16926
  });
16922
16927
 
16923
16928
  export { getRuntime, registerReportObserver, reportGraphqlQueryParseError };
16924
- // version: 1.229.0-dev7-157e3a4db
16929
+ // version: 1.229.0-dev9-dd96b5901
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-mobile",
3
- "version": "1.229.0-dev7",
3
+ "version": "1.229.0-dev9",
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.229.0-dev7",
36
- "@salesforce/lds-bindings": "1.229.0-dev7",
37
- "@salesforce/lds-instrumentation": "1.229.0-dev7",
38
- "@salesforce/lds-priming": "1.229.0-dev7",
35
+ "@salesforce/lds-adapters-uiapi": "1.229.0-dev9",
36
+ "@salesforce/lds-bindings": "1.229.0-dev9",
37
+ "@salesforce/lds-instrumentation": "1.229.0-dev9",
38
+ "@salesforce/lds-priming": "1.229.0-dev9",
39
39
  "@salesforce/user": "0.0.21",
40
40
  "o11y": "244.0.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@salesforce/lds-adapters-graphql": "1.229.0-dev7",
44
- "@salesforce/lds-drafts": "1.229.0-dev7",
45
- "@salesforce/lds-drafts-adapters-uiapi": "1.229.0-dev7",
46
- "@salesforce/lds-graphql-eval": "1.229.0-dev7",
47
- "@salesforce/lds-network-adapter": "1.229.0-dev7",
48
- "@salesforce/lds-network-nimbus": "1.229.0-dev7",
49
- "@salesforce/lds-store-binary": "1.229.0-dev7",
50
- "@salesforce/lds-store-nimbus": "1.229.0-dev7",
51
- "@salesforce/lds-store-sql": "1.229.0-dev7",
52
- "@salesforce/lds-utils-adapters": "1.229.0-dev7",
53
- "@salesforce/nimbus-plugin-lds": "1.229.0-dev7",
43
+ "@salesforce/lds-adapters-graphql": "1.229.0-dev9",
44
+ "@salesforce/lds-drafts": "1.229.0-dev9",
45
+ "@salesforce/lds-drafts-adapters-uiapi": "1.229.0-dev9",
46
+ "@salesforce/lds-graphql-eval": "1.229.0-dev9",
47
+ "@salesforce/lds-network-adapter": "1.229.0-dev9",
48
+ "@salesforce/lds-network-nimbus": "1.229.0-dev9",
49
+ "@salesforce/lds-store-binary": "1.229.0-dev9",
50
+ "@salesforce/lds-store-nimbus": "1.229.0-dev9",
51
+ "@salesforce/lds-store-sql": "1.229.0-dev9",
52
+ "@salesforce/lds-utils-adapters": "1.229.0-dev9",
53
+ "@salesforce/nimbus-plugin-lds": "1.229.0-dev9",
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
@@ -17,6 +17,7 @@ import { HttpStatusCode, StoreKeySet, serializeStructuredKey, Reader, deepFreeze
17
17
  import excludeStaleRecordsGate from '@salesforce/gate/lds.graphqlEvalExcludeStaleRecords';
18
18
  import { parseAndVisit, Kind, visit, execute, buildSchema, isObjectType, defaultFieldResolver } from 'force/ldsGraphqlParser';
19
19
  import { getRecordId18, keyBuilderQuickActionExecutionRepresentation, ingestQuickActionExecutionRepresentation, keyBuilderContentDocumentCompositeRepresentation, getResponseCacheKeysContentDocumentCompositeRepresentation, keyBuilderFromTypeContentDocumentCompositeRepresentation, ingestContentDocumentCompositeRepresentation, keyBuilderRecord, getTypeCacheKeysRecord, keyBuilderFromTypeRecordRepresentation, ingestRecord, RecordRepresentationRepresentationType, ObjectInfoRepresentationType, getRecordAdapterFactory, getObjectInfoAdapterFactory, getObjectInfosAdapterFactory, UiApiNamespace, RecordRepresentationType, RecordRepresentationTTL, RecordRepresentationVersion, getRecordsAdapterFactory } from 'force/ldsAdaptersUiapi';
20
+ import ldsIdempotencyWriteDisabled from '@salesforce/gate/lds.idempotencyWriteDisabled';
20
21
  import caseSensitiveUserId from '@salesforce/user/Id';
21
22
  import { idleDetector, getInstrumentation } from 'o11y/client';
22
23
  import ldsUseShortUrlGate from '@salesforce/gate/lds.useShortUrl';
@@ -1139,12 +1140,12 @@ function makeDurable(environment, { durableStore, instrumentation }) {
1139
1140
  }
1140
1141
  return environment.getNode(key, ingestStagingStore);
1141
1142
  };
1142
- const wrapNormalizedGraphNode = function (normalized) {
1143
+ const wrapNormalizedGraphNode = function (normalized, key) {
1143
1144
  validateNotDisposed();
1144
1145
  if (ingestStagingStore === null) {
1145
1146
  ingestStagingStore = buildIngestStagingStore(environment);
1146
1147
  }
1147
- return environment.wrapNormalizedGraphNode(normalized, ingestStagingStore);
1148
+ return environment.wrapNormalizedGraphNode(normalized, key, ingestStagingStore);
1148
1149
  };
1149
1150
  const rebuildSnapshot = function (snapshot, onRebuild) {
1150
1151
  validateNotDisposed();
@@ -5950,7 +5951,12 @@ class AbstractResourceRequestActionHandler {
5950
5951
  // the luvio store redirect table, during which a new draft might be enqueued
5951
5952
  // which would not see a necessary mapping.
5952
5953
  this.ephemeralRedirects = {};
5954
+ // determined by Server setup.
5953
5955
  this.isIdempotencySupported = true;
5956
+ // idempotency write flag set by lds
5957
+ this.isLdsIdempotencyWriteDisabled = ldsIdempotencyWriteDisabled.isOpen({
5958
+ fallback: false,
5959
+ });
5954
5960
  }
5955
5961
  enqueue(data) {
5956
5962
  return this.draftQueue.enqueue(this.handlerId, data);
@@ -6310,7 +6316,7 @@ class AbstractResourceRequestActionHandler {
6310
6316
  return [action.targetId];
6311
6317
  }
6312
6318
  hasIdempotencySupport() {
6313
- return this.isIdempotencySupported;
6319
+ return this.isIdempotencySupported && !this.isLdsIdempotencyWriteDisabled;
6314
6320
  }
6315
6321
  async ingestResponses(responses, action) {
6316
6322
  const luvio = this.getLuvio();
@@ -11765,34 +11771,42 @@ function applyReferenceLinksToDraft(record, draftMetadata) {
11765
11771
  }
11766
11772
  const { dataType, relationshipName, referenceToInfos } = fieldInfo;
11767
11773
  const draftFieldValue = record.fields[draftField].value;
11768
- if (dataType === 'Reference' && relationshipName !== null && draftFieldValue !== null) {
11769
- if (typeof draftFieldValue !== 'string') {
11770
- throw Error('reference field value is not a string');
11774
+ if (dataType === 'Reference' && relationshipName !== null) {
11775
+ if (draftFieldValue === null) {
11776
+ recordFields[relationshipName] = {
11777
+ displayValue: null,
11778
+ value: null,
11779
+ };
11771
11780
  }
11772
- const key = getRecordKeyForId(luvio, draftFieldValue);
11773
- const referencedRecord = referencedRecords.get(key);
11774
- recordFields[relationshipName] = {
11775
- displayValue: null,
11776
- value: createLink(key),
11777
- };
11778
- // for custom objects, we select the 'Name' field
11779
- // otherwise we check the object info for name fields.
11780
- //if there are multiple we select 'Name' if it exists, otherwise the first one
11781
- if (referencedRecord !== undefined && referenceToInfos.length > 0) {
11782
- let nameField;
11783
- const referenceToInfo = referenceToInfos[0];
11784
- const nameFields = referenceToInfo.nameFields;
11785
- if (nameFields.length !== 0) {
11786
- nameField = nameFields.find((x) => x === 'Name');
11787
- if (nameField === undefined) {
11788
- nameField = nameFields[0];
11789
- }
11781
+ else {
11782
+ if (typeof draftFieldValue !== 'string') {
11783
+ throw Error('reference field value is not a string');
11790
11784
  }
11791
- if (nameField !== undefined) {
11792
- const nameFieldRef = referencedRecord.fields[nameField];
11793
- if (nameFieldRef) {
11794
- recordFields[relationshipName].displayValue =
11795
- (_a = nameFieldRef.displayValue) !== null && _a !== void 0 ? _a : nameFieldRef.value;
11785
+ const key = getRecordKeyForId(luvio, draftFieldValue);
11786
+ const referencedRecord = referencedRecords.get(key);
11787
+ recordFields[relationshipName] = {
11788
+ displayValue: null,
11789
+ value: createLink(key),
11790
+ };
11791
+ // for custom objects, we select the 'Name' field
11792
+ // otherwise we check the object info for name fields.
11793
+ //if there are multiple we select 'Name' if it exists, otherwise the first one
11794
+ if (referencedRecord !== undefined && referenceToInfos.length > 0) {
11795
+ let nameField;
11796
+ const referenceToInfo = referenceToInfos[0];
11797
+ const nameFields = referenceToInfo.nameFields;
11798
+ if (nameFields.length !== 0) {
11799
+ nameField = nameFields.find((x) => x === 'Name');
11800
+ if (nameField === undefined) {
11801
+ nameField = nameFields[0];
11802
+ }
11803
+ }
11804
+ if (nameField !== undefined) {
11805
+ const nameFieldRef = referencedRecord.fields[nameField];
11806
+ if (nameFieldRef) {
11807
+ recordFields[relationshipName].displayValue =
11808
+ (_a = nameFieldRef.displayValue) !== null && _a !== void 0 ? _a : nameFieldRef.value;
11809
+ }
11796
11810
  }
11797
11811
  }
11798
11812
  }
@@ -12085,17 +12099,8 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
12085
12099
  };
12086
12100
  for (const fieldName of keys$3(recordWithSpanningRefLinks.fields)) {
12087
12101
  const fieldKey = buildRecordFieldStoreKey(key, fieldName);
12088
- if (this.collectedFields[fieldKey] !== undefined) {
12089
- const fieldData = recordWithSpanningRefLinks.fields[fieldName];
12090
- normalizedRecord.fields[fieldName] = { __ref: fieldKey };
12091
- publishData(fieldKey, fieldData);
12092
- }
12093
- else if (recordWithSpanningRefLinks.fields[fieldName] &&
12094
- recordWithSpanningRefLinks.fields[fieldName].value &&
12095
- recordWithSpanningRefLinks.fields[fieldName].value.__ref !== undefined) {
12096
- normalizedRecord.fields[fieldName] = { __ref: fieldKey };
12097
- publishData(fieldKey, recordWithSpanningRefLinks.fields[fieldName]);
12098
- }
12102
+ normalizedRecord.fields[fieldName] = { __ref: fieldKey };
12103
+ publishData(fieldKey, recordWithSpanningRefLinks.fields[fieldName]);
12099
12104
  }
12100
12105
  // publish the normalized record
12101
12106
  publishData(key, normalizedRecord);
@@ -16921,4 +16926,4 @@ register({
16921
16926
  });
16922
16927
 
16923
16928
  export { getRuntime, registerReportObserver, reportGraphqlQueryParseError };
16924
- // version: 1.229.0-dev7-157e3a4db
16929
+ // version: 1.229.0-dev9-dd96b5901