@salesforce/lds-runtime-mobile 1.131.0-dev12 → 1.131.0-dev14

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 +26 -16
  2. package/package.json +15 -15
  3. package/sfdc/main.js +26 -16
package/dist/main.js CHANGED
@@ -4160,8 +4160,8 @@ function rootRecordQuery(selection, input) {
4160
4160
  // If there is no metadata for this query or it somehow lacks a timestamp
4161
4161
  // skip setting the root timestamp
4162
4162
  if (queryMetadata !== undefined && queryMetadata.ingestionTimestamp !== undefined) {
4163
- // subtract 10ms from timestamp to account for ingestion processing time
4164
- input.rootTimestamp = queryMetadata.ingestionTimestamp - 10;
4163
+ // subtract 1000ms from timestamp to account for ingestion processing time
4164
+ input.rootTimestamp = queryMetadata.ingestionTimestamp - 1000;
4165
4165
  }
4166
4166
  }
4167
4167
  return recordQuery(selection, alias, apiName, [], input);
@@ -8786,8 +8786,8 @@ async function fetchIngestionTimeStampFromDatabase(apiName, info, args, query) {
8786
8786
  const results = await query(sql, [key]);
8787
8787
  const [timestamp] = results.rows.map((row) => row[0]);
8788
8788
  if (timestamp !== null && typeof timestamp === 'number') {
8789
- //go back 10 ms to adjust for margin of error when top level query is stored and when raml objects are stored
8790
- ingestionTimestamp = timestamp - 10;
8789
+ //go back 1000 ms to adjust for margin of error when top level query is stored and when raml objects are stored
8790
+ ingestionTimestamp = timestamp - 1000;
8791
8791
  }
8792
8792
  }
8793
8793
  return ingestionTimestamp;
@@ -9187,26 +9187,20 @@ function generateRecordQueries(objectInfos) {
9187
9187
  let recordConnections = ``;
9188
9188
  const polymorphicFieldTypeNames = new Set();
9189
9189
  let typedScalars = new Set();
9190
+ let parentRelationshipFields = new Set();
9190
9191
  for (const objectInfo of values(objectInfos)) {
9191
9192
  const { apiName, childRelationships } = objectInfo;
9192
9193
  let fields = ``;
9193
9194
  typedScalars.add(`${apiName}_Filter`);
9194
9195
  typedScalars.add(`${apiName}_OrderBy`);
9195
- for (const childRelationship of childRelationships) {
9196
- const { childObjectApiName } = childRelationship;
9197
- // Only add the relationship if there is relevant objectinfos for it,
9198
- // otherwise we'd be defining types we cannot satisfy and aren't referenced in
9199
- // the query.
9200
- if (objectInfos[childObjectApiName] !== undefined) {
9201
- fields += `${childRelationship.relationshipName}(first: Int, where: ${childObjectApiName}_Filter, orderBy: ${childObjectApiName}_OrderBy, scope: SupportedScopes): ${childObjectApiName}Connection \n`;
9202
- typedScalars.add(`${childObjectApiName}_Filter`);
9203
- typedScalars.add(`${childObjectApiName}_OrderBy`);
9204
- }
9205
- }
9206
9196
  for (const field of values(objectInfo.fields)) {
9207
9197
  if (!fieldsStaticallyAdded.includes(field.apiName)) {
9208
9198
  fields += `${field.apiName}: ${dataTypeToType(field.dataType, field.apiName)}\n`;
9209
9199
  }
9200
+ //handles parent relationship
9201
+ if (field.relationshipName === null) {
9202
+ continue;
9203
+ }
9210
9204
  // For spanning parent relationships with no union types
9211
9205
  if (field.referenceToInfos.length === 1) {
9212
9206
  const [relation] = field.referenceToInfos;
@@ -9214,11 +9208,13 @@ function generateRecordQueries(objectInfos) {
9214
9208
  // otherwise we'd be defining types we cannot satisfy and aren't referenced in
9215
9209
  // the query.
9216
9210
  if (objectInfos[relation.apiName] !== undefined) {
9211
+ parentRelationshipFields.add(field.relationshipName);
9217
9212
  fields += `${field.relationshipName}: ${relation.apiName}\n`;
9218
9213
  }
9219
9214
  // For polymorphic field, its type is 'Record' inteface. The concrete entity type name is saved for field resolving of next phase
9220
9215
  }
9221
9216
  else if (field.referenceToInfos.length > 1) {
9217
+ parentRelationshipFields.add(field.relationshipName);
9222
9218
  fields += `${field.relationshipName}: Record\n`;
9223
9219
  for (const relation of field.referenceToInfos) {
9224
9220
  if (objectInfos[relation.apiName] !== undefined) {
@@ -9227,6 +9223,20 @@ function generateRecordQueries(objectInfos) {
9227
9223
  }
9228
9224
  }
9229
9225
  }
9226
+ // handles child relationship
9227
+ for (const childRelationship of childRelationships) {
9228
+ const { childObjectApiName } = childRelationship;
9229
+ // Only add the relationship if there is relevant objectinfos for it,
9230
+ // otherwise we'd be defining types we cannot satisfy and aren't referenced in
9231
+ // the query.
9232
+ // If one field has both parent relationship and child relationship with the same name, the child relationship is ignored. This is how the server GQL has implemented as date of 08/07/2023
9233
+ if (objectInfos[childObjectApiName] !== undefined &&
9234
+ !parentRelationshipFields.has(childRelationship.relationshipName)) {
9235
+ fields += `${childRelationship.relationshipName}(first: Int, where: ${childObjectApiName}_Filter, orderBy: ${childObjectApiName}_OrderBy, scope: SupportedScopes): ${childObjectApiName}Connection \n`;
9236
+ typedScalars.add(`${childObjectApiName}_Filter`);
9237
+ typedScalars.add(`${childObjectApiName}_OrderBy`);
9238
+ }
9239
+ }
9230
9240
  recordQueries += `${apiName}(first: Int, where: ${apiName}_Filter, orderBy: ${apiName}_OrderBy, scope: SupportedScopes): ${apiName}Connection\n`;
9231
9241
  const isServiceAppointment = apiName === 'ServiceAppointment';
9232
9242
  recordConnections += /* GraphQL */ `
@@ -16200,4 +16210,4 @@ register({
16200
16210
  });
16201
16211
 
16202
16212
  export { getRuntime, registerReportObserver, reportGraphqlQueryParseError };
16203
- // version: 1.131.0-dev12-f6948e56d
16213
+ // version: 1.131.0-dev14-98d776146
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-mobile",
3
- "version": "1.131.0-dev12",
3
+ "version": "1.131.0-dev14",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS runtime for mobile/hybrid environments.",
6
6
  "main": "dist/main.js",
@@ -32,24 +32,24 @@
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.131.0-dev12",
36
- "@salesforce/lds-bindings": "1.131.0-dev12",
37
- "@salesforce/lds-instrumentation": "1.131.0-dev12",
38
- "@salesforce/lds-priming": "1.131.0-dev12",
35
+ "@salesforce/lds-adapters-uiapi": "1.131.0-dev14",
36
+ "@salesforce/lds-bindings": "1.131.0-dev14",
37
+ "@salesforce/lds-instrumentation": "1.131.0-dev14",
38
+ "@salesforce/lds-priming": "1.131.0-dev14",
39
39
  "@salesforce/user": "0.0.12",
40
40
  "o11y": "244.0.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@salesforce/lds-adapters-graphql": "1.131.0-dev12",
44
- "@salesforce/lds-drafts": "1.131.0-dev12",
45
- "@salesforce/lds-drafts-adapters-uiapi": "1.131.0-dev12",
46
- "@salesforce/lds-graphql-eval": "1.131.0-dev12",
47
- "@salesforce/lds-network-adapter": "1.131.0-dev12",
48
- "@salesforce/lds-network-nimbus": "1.131.0-dev12",
49
- "@salesforce/lds-store-binary": "1.131.0-dev12",
50
- "@salesforce/lds-store-sql": "1.131.0-dev12",
51
- "@salesforce/lds-utils-adapters": "1.131.0-dev12",
52
- "@salesforce/nimbus-plugin-lds": "1.131.0-dev12",
43
+ "@salesforce/lds-adapters-graphql": "1.131.0-dev14",
44
+ "@salesforce/lds-drafts": "1.131.0-dev14",
45
+ "@salesforce/lds-drafts-adapters-uiapi": "1.131.0-dev14",
46
+ "@salesforce/lds-graphql-eval": "1.131.0-dev14",
47
+ "@salesforce/lds-network-adapter": "1.131.0-dev14",
48
+ "@salesforce/lds-network-nimbus": "1.131.0-dev14",
49
+ "@salesforce/lds-store-binary": "1.131.0-dev14",
50
+ "@salesforce/lds-store-sql": "1.131.0-dev14",
51
+ "@salesforce/lds-utils-adapters": "1.131.0-dev14",
52
+ "@salesforce/nimbus-plugin-lds": "1.131.0-dev14",
53
53
  "babel-plugin-dynamic-import-node": "^2.3.3",
54
54
  "wait-for-expect": "^3.0.2"
55
55
  },
package/sfdc/main.js CHANGED
@@ -4160,8 +4160,8 @@ function rootRecordQuery(selection, input) {
4160
4160
  // If there is no metadata for this query or it somehow lacks a timestamp
4161
4161
  // skip setting the root timestamp
4162
4162
  if (queryMetadata !== undefined && queryMetadata.ingestionTimestamp !== undefined) {
4163
- // subtract 10ms from timestamp to account for ingestion processing time
4164
- input.rootTimestamp = queryMetadata.ingestionTimestamp - 10;
4163
+ // subtract 1000ms from timestamp to account for ingestion processing time
4164
+ input.rootTimestamp = queryMetadata.ingestionTimestamp - 1000;
4165
4165
  }
4166
4166
  }
4167
4167
  return recordQuery(selection, alias, apiName, [], input);
@@ -8786,8 +8786,8 @@ async function fetchIngestionTimeStampFromDatabase(apiName, info, args, query) {
8786
8786
  const results = await query(sql, [key]);
8787
8787
  const [timestamp] = results.rows.map((row) => row[0]);
8788
8788
  if (timestamp !== null && typeof timestamp === 'number') {
8789
- //go back 10 ms to adjust for margin of error when top level query is stored and when raml objects are stored
8790
- ingestionTimestamp = timestamp - 10;
8789
+ //go back 1000 ms to adjust for margin of error when top level query is stored and when raml objects are stored
8790
+ ingestionTimestamp = timestamp - 1000;
8791
8791
  }
8792
8792
  }
8793
8793
  return ingestionTimestamp;
@@ -9187,26 +9187,20 @@ function generateRecordQueries(objectInfos) {
9187
9187
  let recordConnections = ``;
9188
9188
  const polymorphicFieldTypeNames = new Set();
9189
9189
  let typedScalars = new Set();
9190
+ let parentRelationshipFields = new Set();
9190
9191
  for (const objectInfo of values(objectInfos)) {
9191
9192
  const { apiName, childRelationships } = objectInfo;
9192
9193
  let fields = ``;
9193
9194
  typedScalars.add(`${apiName}_Filter`);
9194
9195
  typedScalars.add(`${apiName}_OrderBy`);
9195
- for (const childRelationship of childRelationships) {
9196
- const { childObjectApiName } = childRelationship;
9197
- // Only add the relationship if there is relevant objectinfos for it,
9198
- // otherwise we'd be defining types we cannot satisfy and aren't referenced in
9199
- // the query.
9200
- if (objectInfos[childObjectApiName] !== undefined) {
9201
- fields += `${childRelationship.relationshipName}(first: Int, where: ${childObjectApiName}_Filter, orderBy: ${childObjectApiName}_OrderBy, scope: SupportedScopes): ${childObjectApiName}Connection \n`;
9202
- typedScalars.add(`${childObjectApiName}_Filter`);
9203
- typedScalars.add(`${childObjectApiName}_OrderBy`);
9204
- }
9205
- }
9206
9196
  for (const field of values(objectInfo.fields)) {
9207
9197
  if (!fieldsStaticallyAdded.includes(field.apiName)) {
9208
9198
  fields += `${field.apiName}: ${dataTypeToType(field.dataType, field.apiName)}\n`;
9209
9199
  }
9200
+ //handles parent relationship
9201
+ if (field.relationshipName === null) {
9202
+ continue;
9203
+ }
9210
9204
  // For spanning parent relationships with no union types
9211
9205
  if (field.referenceToInfos.length === 1) {
9212
9206
  const [relation] = field.referenceToInfos;
@@ -9214,11 +9208,13 @@ function generateRecordQueries(objectInfos) {
9214
9208
  // otherwise we'd be defining types we cannot satisfy and aren't referenced in
9215
9209
  // the query.
9216
9210
  if (objectInfos[relation.apiName] !== undefined) {
9211
+ parentRelationshipFields.add(field.relationshipName);
9217
9212
  fields += `${field.relationshipName}: ${relation.apiName}\n`;
9218
9213
  }
9219
9214
  // For polymorphic field, its type is 'Record' inteface. The concrete entity type name is saved for field resolving of next phase
9220
9215
  }
9221
9216
  else if (field.referenceToInfos.length > 1) {
9217
+ parentRelationshipFields.add(field.relationshipName);
9222
9218
  fields += `${field.relationshipName}: Record\n`;
9223
9219
  for (const relation of field.referenceToInfos) {
9224
9220
  if (objectInfos[relation.apiName] !== undefined) {
@@ -9227,6 +9223,20 @@ function generateRecordQueries(objectInfos) {
9227
9223
  }
9228
9224
  }
9229
9225
  }
9226
+ // handles child relationship
9227
+ for (const childRelationship of childRelationships) {
9228
+ const { childObjectApiName } = childRelationship;
9229
+ // Only add the relationship if there is relevant objectinfos for it,
9230
+ // otherwise we'd be defining types we cannot satisfy and aren't referenced in
9231
+ // the query.
9232
+ // If one field has both parent relationship and child relationship with the same name, the child relationship is ignored. This is how the server GQL has implemented as date of 08/07/2023
9233
+ if (objectInfos[childObjectApiName] !== undefined &&
9234
+ !parentRelationshipFields.has(childRelationship.relationshipName)) {
9235
+ fields += `${childRelationship.relationshipName}(first: Int, where: ${childObjectApiName}_Filter, orderBy: ${childObjectApiName}_OrderBy, scope: SupportedScopes): ${childObjectApiName}Connection \n`;
9236
+ typedScalars.add(`${childObjectApiName}_Filter`);
9237
+ typedScalars.add(`${childObjectApiName}_OrderBy`);
9238
+ }
9239
+ }
9230
9240
  recordQueries += `${apiName}(first: Int, where: ${apiName}_Filter, orderBy: ${apiName}_OrderBy, scope: SupportedScopes): ${apiName}Connection\n`;
9231
9241
  const isServiceAppointment = apiName === 'ServiceAppointment';
9232
9242
  recordConnections += /* GraphQL */ `
@@ -16200,4 +16210,4 @@ register({
16200
16210
  });
16201
16211
 
16202
16212
  export { getRuntime, registerReportObserver, reportGraphqlQueryParseError };
16203
- // version: 1.131.0-dev12-f6948e56d
16213
+ // version: 1.131.0-dev14-98d776146