@salesforce/lds-runtime-mobile 1.229.0-dev3 → 1.229.0-dev5

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 +31 -12
  2. package/package.json +16 -16
  3. package/sfdc/main.js +31 -12
package/dist/main.js CHANGED
@@ -10215,16 +10215,18 @@ function injectFilter(filterNode, idState, parentPath, isParentPolymorphic, obje
10215
10215
  if (!isIdField) {
10216
10216
  let subSelectionNodes = [];
10217
10217
  let subFieldsHasId = false;
10218
- filterNode.value.fields.forEach((subFieldNode) => {
10219
- // Check if the filter field has the 'Id'
10220
- if (isFieldAnIdField(subFieldNode.name.value, objectInfos[objectInfoName])) {
10221
- subFieldsHasId = true;
10222
- updateIDInfo(subFieldNode, idState, draftFunctions);
10223
- }
10224
- // try injecting the fields within predicate no matter it has relation or not.
10225
- let subResults = injectFilter(subFieldNode, idState, curPath, isPolymorphicField, objectInfos, pathToObjectApiNamesMap, draftFunctions, existingFields ? existingFields[0] : undefined);
10226
- subSelectionNodes = subSelectionNodes.concat(subResults);
10227
- });
10218
+ if (isSpanning) {
10219
+ filterNode.value.fields.forEach((subFieldNode) => {
10220
+ // Check if the filter field has the 'Id'
10221
+ if (isFieldAnIdField(subFieldNode.name.value, objectInfos[objectInfoName])) {
10222
+ subFieldsHasId = true;
10223
+ updateIDInfo(subFieldNode, idState, draftFunctions);
10224
+ }
10225
+ // try injecting the fields within predicate no matter it has relation or not.
10226
+ let subResults = injectFilter(subFieldNode, idState, curPath, isPolymorphicField, objectInfos, pathToObjectApiNamesMap, draftFunctions, existingFields ? existingFields[0] : undefined);
10227
+ subSelectionNodes = subSelectionNodes.concat(subResults);
10228
+ });
10229
+ }
10228
10230
  if (!subFieldsHasId) {
10229
10231
  // Check if the query field has the 'Id'
10230
10232
  const existingIdsInQuery = existingFields &&
@@ -10253,6 +10255,7 @@ function injectFilter(filterNode, idState, parentPath, isParentPolymorphic, obje
10253
10255
  }
10254
10256
  //Inject Conditions: 1. Same field does not exist 2. Same fields has different children. 3. Filter spanning field does not have Id. 4. InLineFragment does not have the '__typename' field
10255
10257
  if (!existingFields ||
10258
+ existingFields.length === 0 ||
10256
10259
  subSelectionNodes.length > 0 ||
10257
10260
  (isSpanning && !subFieldsHasId) ||
10258
10261
  (isInlineFragment && !isTypeNameExisting)) {
@@ -12955,7 +12958,7 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
12955
12958
  // Fulfilled snapshot (this only happens in this code path if
12956
12959
  // the error is network error or 504), otherwise we spread over
12957
12960
  // the non-eval'ed snapshot (which will be either Fulfilled or Stale)
12958
- return nonEvaluatedSnapshot.state === 'Error'
12961
+ const resultSnapshot = nonEvaluatedSnapshot.state === 'Error'
12959
12962
  ? createLocalEvalSnapshot(gqlResult, seenRecords, recordId, rebuildWithLocalEval)
12960
12963
  : {
12961
12964
  ...nonEvaluatedSnapshot,
@@ -12964,6 +12967,22 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
12964
12967
  seenRecords,
12965
12968
  rebuildWithLocalEval,
12966
12969
  };
12970
+ const { refresh, state } = resultSnapshot;
12971
+ if (state !== 'Error' && refresh) {
12972
+ // after refreshing a graphql snapshot, we want to force a rebuild regardless
12973
+ // of if the call failed or not or if the data changed or not because we want
12974
+ // to make sure any potential new drafts are picked up
12975
+ resultSnapshot.refresh = {
12976
+ ...refresh,
12977
+ resolve: (config) => {
12978
+ return refresh.resolve(config).finally(() => {
12979
+ luvio.storePublish(resultSnapshot.recordId, undefined);
12980
+ luvio.storeBroadcast();
12981
+ });
12982
+ },
12983
+ };
12984
+ }
12985
+ return resultSnapshot;
12967
12986
  };
12968
12987
  }
12969
12988
 
@@ -16845,4 +16864,4 @@ register({
16845
16864
  });
16846
16865
 
16847
16866
  export { getRuntime, registerReportObserver, reportGraphqlQueryParseError };
16848
- // version: 1.229.0-dev3-175ac936b
16867
+ // version: 1.229.0-dev5-c763e7f91
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-mobile",
3
- "version": "1.229.0-dev3",
3
+ "version": "1.229.0-dev5",
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-dev3",
36
- "@salesforce/lds-bindings": "1.229.0-dev3",
37
- "@salesforce/lds-instrumentation": "1.229.0-dev3",
38
- "@salesforce/lds-priming": "1.229.0-dev3",
35
+ "@salesforce/lds-adapters-uiapi": "1.229.0-dev5",
36
+ "@salesforce/lds-bindings": "1.229.0-dev5",
37
+ "@salesforce/lds-instrumentation": "1.229.0-dev5",
38
+ "@salesforce/lds-priming": "1.229.0-dev5",
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-dev3",
44
- "@salesforce/lds-drafts": "1.229.0-dev3",
45
- "@salesforce/lds-drafts-adapters-uiapi": "1.229.0-dev3",
46
- "@salesforce/lds-graphql-eval": "1.229.0-dev3",
47
- "@salesforce/lds-network-adapter": "1.229.0-dev3",
48
- "@salesforce/lds-network-nimbus": "1.229.0-dev3",
49
- "@salesforce/lds-store-binary": "1.229.0-dev3",
50
- "@salesforce/lds-store-nimbus": "1.229.0-dev3",
51
- "@salesforce/lds-store-sql": "1.229.0-dev3",
52
- "@salesforce/lds-utils-adapters": "1.229.0-dev3",
53
- "@salesforce/nimbus-plugin-lds": "1.229.0-dev3",
43
+ "@salesforce/lds-adapters-graphql": "1.229.0-dev5",
44
+ "@salesforce/lds-drafts": "1.229.0-dev5",
45
+ "@salesforce/lds-drafts-adapters-uiapi": "1.229.0-dev5",
46
+ "@salesforce/lds-graphql-eval": "1.229.0-dev5",
47
+ "@salesforce/lds-network-adapter": "1.229.0-dev5",
48
+ "@salesforce/lds-network-nimbus": "1.229.0-dev5",
49
+ "@salesforce/lds-store-binary": "1.229.0-dev5",
50
+ "@salesforce/lds-store-nimbus": "1.229.0-dev5",
51
+ "@salesforce/lds-store-sql": "1.229.0-dev5",
52
+ "@salesforce/lds-utils-adapters": "1.229.0-dev5",
53
+ "@salesforce/nimbus-plugin-lds": "1.229.0-dev5",
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
@@ -10215,16 +10215,18 @@ function injectFilter(filterNode, idState, parentPath, isParentPolymorphic, obje
10215
10215
  if (!isIdField) {
10216
10216
  let subSelectionNodes = [];
10217
10217
  let subFieldsHasId = false;
10218
- filterNode.value.fields.forEach((subFieldNode) => {
10219
- // Check if the filter field has the 'Id'
10220
- if (isFieldAnIdField(subFieldNode.name.value, objectInfos[objectInfoName])) {
10221
- subFieldsHasId = true;
10222
- updateIDInfo(subFieldNode, idState, draftFunctions);
10223
- }
10224
- // try injecting the fields within predicate no matter it has relation or not.
10225
- let subResults = injectFilter(subFieldNode, idState, curPath, isPolymorphicField, objectInfos, pathToObjectApiNamesMap, draftFunctions, existingFields ? existingFields[0] : undefined);
10226
- subSelectionNodes = subSelectionNodes.concat(subResults);
10227
- });
10218
+ if (isSpanning) {
10219
+ filterNode.value.fields.forEach((subFieldNode) => {
10220
+ // Check if the filter field has the 'Id'
10221
+ if (isFieldAnIdField(subFieldNode.name.value, objectInfos[objectInfoName])) {
10222
+ subFieldsHasId = true;
10223
+ updateIDInfo(subFieldNode, idState, draftFunctions);
10224
+ }
10225
+ // try injecting the fields within predicate no matter it has relation or not.
10226
+ let subResults = injectFilter(subFieldNode, idState, curPath, isPolymorphicField, objectInfos, pathToObjectApiNamesMap, draftFunctions, existingFields ? existingFields[0] : undefined);
10227
+ subSelectionNodes = subSelectionNodes.concat(subResults);
10228
+ });
10229
+ }
10228
10230
  if (!subFieldsHasId) {
10229
10231
  // Check if the query field has the 'Id'
10230
10232
  const existingIdsInQuery = existingFields &&
@@ -10253,6 +10255,7 @@ function injectFilter(filterNode, idState, parentPath, isParentPolymorphic, obje
10253
10255
  }
10254
10256
  //Inject Conditions: 1. Same field does not exist 2. Same fields has different children. 3. Filter spanning field does not have Id. 4. InLineFragment does not have the '__typename' field
10255
10257
  if (!existingFields ||
10258
+ existingFields.length === 0 ||
10256
10259
  subSelectionNodes.length > 0 ||
10257
10260
  (isSpanning && !subFieldsHasId) ||
10258
10261
  (isInlineFragment && !isTypeNameExisting)) {
@@ -12955,7 +12958,7 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
12955
12958
  // Fulfilled snapshot (this only happens in this code path if
12956
12959
  // the error is network error or 504), otherwise we spread over
12957
12960
  // the non-eval'ed snapshot (which will be either Fulfilled or Stale)
12958
- return nonEvaluatedSnapshot.state === 'Error'
12961
+ const resultSnapshot = nonEvaluatedSnapshot.state === 'Error'
12959
12962
  ? createLocalEvalSnapshot(gqlResult, seenRecords, recordId, rebuildWithLocalEval)
12960
12963
  : {
12961
12964
  ...nonEvaluatedSnapshot,
@@ -12964,6 +12967,22 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
12964
12967
  seenRecords,
12965
12968
  rebuildWithLocalEval,
12966
12969
  };
12970
+ const { refresh, state } = resultSnapshot;
12971
+ if (state !== 'Error' && refresh) {
12972
+ // after refreshing a graphql snapshot, we want to force a rebuild regardless
12973
+ // of if the call failed or not or if the data changed or not because we want
12974
+ // to make sure any potential new drafts are picked up
12975
+ resultSnapshot.refresh = {
12976
+ ...refresh,
12977
+ resolve: (config) => {
12978
+ return refresh.resolve(config).finally(() => {
12979
+ luvio.storePublish(resultSnapshot.recordId, undefined);
12980
+ luvio.storeBroadcast();
12981
+ });
12982
+ },
12983
+ };
12984
+ }
12985
+ return resultSnapshot;
12967
12986
  };
12968
12987
  }
12969
12988
 
@@ -16845,4 +16864,4 @@ register({
16845
16864
  });
16846
16865
 
16847
16866
  export { getRuntime, registerReportObserver, reportGraphqlQueryParseError };
16848
- // version: 1.229.0-dev3-175ac936b
16867
+ // version: 1.229.0-dev5-c763e7f91