@salesforce/lds-runtime-mobile 1.229.0-dev1 → 1.229.0-dev2

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 +16 -16
  3. package/sfdc/main.js +26 -16
package/dist/main.js CHANGED
@@ -4260,8 +4260,8 @@ function rootRecordQuery(selection, input) {
4260
4260
  // If there is no metadata for this query or it somehow lacks a timestamp
4261
4261
  // skip setting the root timestamp
4262
4262
  if (queryMetadata !== undefined && queryMetadata.ingestionTimestamp !== undefined) {
4263
- // subtract 10ms from timestamp to account for ingestion processing time
4264
- input.rootTimestamp = queryMetadata.ingestionTimestamp - 10;
4263
+ // subtract 1000ms from timestamp to account for ingestion processing time
4264
+ input.rootTimestamp = queryMetadata.ingestionTimestamp - 1000;
4265
4265
  }
4266
4266
  }
4267
4267
  return recordQuery(selection, alias, apiName, [], input);
@@ -9099,8 +9099,8 @@ async function fetchIngestionTimeStampFromDatabase(apiName, info, args, query) {
9099
9099
  const results = await query(sql, [key]);
9100
9100
  const [timestamp] = results.rows.map((row) => row[0]);
9101
9101
  if (timestamp !== null && typeof timestamp === 'number') {
9102
- //go back 10 ms to adjust for margin of error when top level query is stored and when raml objects are stored
9103
- ingestionTimestamp = timestamp - 10;
9102
+ //go back 1000 ms to adjust for margin of error when top level query is stored and when raml objects are stored
9103
+ ingestionTimestamp = timestamp - 1000;
9104
9104
  }
9105
9105
  }
9106
9106
  return ingestionTimestamp;
@@ -9149,26 +9149,20 @@ function generateRecordQueries(objectInfos) {
9149
9149
  let recordConnections = ``;
9150
9150
  const polymorphicFieldTypeNames = new Set();
9151
9151
  let typedScalars = new Set();
9152
+ let parentRelationshipFields = new Set();
9152
9153
  for (const objectInfo of values$1(objectInfos)) {
9153
9154
  const { apiName, childRelationships } = objectInfo;
9154
9155
  let fields = ``;
9155
9156
  typedScalars.add(`${apiName}_Filter`);
9156
9157
  typedScalars.add(`${apiName}_OrderBy`);
9157
- for (const childRelationship of childRelationships) {
9158
- const { childObjectApiName } = childRelationship;
9159
- // Only add the relationship if there is relevant objectinfos for it,
9160
- // otherwise we'd be defining types we cannot satisfy and aren't referenced in
9161
- // the query.
9162
- if (objectInfos[childObjectApiName] !== undefined) {
9163
- fields += `${childRelationship.relationshipName}(first: Int, where: ${childObjectApiName}_Filter, orderBy: ${childObjectApiName}_OrderBy, scope: SupportedScopes): ${childObjectApiName}Connection \n`;
9164
- typedScalars.add(`${childObjectApiName}_Filter`);
9165
- typedScalars.add(`${childObjectApiName}_OrderBy`);
9166
- }
9167
- }
9168
9158
  for (const field of values$1(objectInfo.fields)) {
9169
9159
  if (!fieldsStaticallyAdded.includes(field.apiName)) {
9170
9160
  fields += `${field.apiName}: ${dataTypeToType(field.dataType, field.apiName)}\n`;
9171
9161
  }
9162
+ //handles parent relationship
9163
+ if (field.relationshipName === null) {
9164
+ continue;
9165
+ }
9172
9166
  // For spanning parent relationships with no union types
9173
9167
  if (field.referenceToInfos.length === 1) {
9174
9168
  const [relation] = field.referenceToInfos;
@@ -9176,11 +9170,13 @@ function generateRecordQueries(objectInfos) {
9176
9170
  // otherwise we'd be defining types we cannot satisfy and aren't referenced in
9177
9171
  // the query.
9178
9172
  if (objectInfos[relation.apiName] !== undefined) {
9173
+ parentRelationshipFields.add(field.relationshipName);
9179
9174
  fields += `${field.relationshipName}: ${relation.apiName}\n`;
9180
9175
  }
9181
9176
  // For polymorphic field, its type is 'Record' inteface. The concrete entity type name is saved for field resolving of next phase
9182
9177
  }
9183
9178
  else if (field.referenceToInfos.length > 1) {
9179
+ parentRelationshipFields.add(field.relationshipName);
9184
9180
  fields += `${field.relationshipName}: Record\n`;
9185
9181
  for (const relation of field.referenceToInfos) {
9186
9182
  if (objectInfos[relation.apiName] !== undefined) {
@@ -9189,6 +9185,20 @@ function generateRecordQueries(objectInfos) {
9189
9185
  }
9190
9186
  }
9191
9187
  }
9188
+ // handles child relationship
9189
+ for (const childRelationship of childRelationships) {
9190
+ const { childObjectApiName } = childRelationship;
9191
+ // Only add the relationship if there is relevant objectinfos for it,
9192
+ // otherwise we'd be defining types we cannot satisfy and aren't referenced in
9193
+ // the query.
9194
+ // 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
9195
+ if (objectInfos[childObjectApiName] !== undefined &&
9196
+ !parentRelationshipFields.has(childRelationship.relationshipName)) {
9197
+ fields += `${childRelationship.relationshipName}(first: Int, where: ${childObjectApiName}_Filter, orderBy: ${childObjectApiName}_OrderBy, scope: SupportedScopes): ${childObjectApiName}Connection \n`;
9198
+ typedScalars.add(`${childObjectApiName}_Filter`);
9199
+ typedScalars.add(`${childObjectApiName}_OrderBy`);
9200
+ }
9201
+ }
9192
9202
  recordQueries += `${apiName}(first: Int, where: ${apiName}_Filter, orderBy: ${apiName}_OrderBy, scope: SupportedScopes): ${apiName}Connection\n`;
9193
9203
  const isServiceAppointment = apiName === 'ServiceAppointment';
9194
9204
  recordConnections += /* GraphQL */ `
@@ -16761,4 +16771,4 @@ register({
16761
16771
  });
16762
16772
 
16763
16773
  export { getRuntime, registerReportObserver, reportGraphqlQueryParseError };
16764
- // version: 1.229.0-dev1-f69d054a9
16774
+ // version: 1.229.0-dev2-e9832aaff
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-mobile",
3
- "version": "1.229.0-dev1",
3
+ "version": "1.229.0-dev2",
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-dev1",
36
- "@salesforce/lds-bindings": "1.229.0-dev1",
37
- "@salesforce/lds-instrumentation": "1.229.0-dev1",
38
- "@salesforce/lds-priming": "1.229.0-dev1",
35
+ "@salesforce/lds-adapters-uiapi": "1.229.0-dev2",
36
+ "@salesforce/lds-bindings": "1.229.0-dev2",
37
+ "@salesforce/lds-instrumentation": "1.229.0-dev2",
38
+ "@salesforce/lds-priming": "1.229.0-dev2",
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-dev1",
44
- "@salesforce/lds-drafts": "1.229.0-dev1",
45
- "@salesforce/lds-drafts-adapters-uiapi": "1.229.0-dev1",
46
- "@salesforce/lds-graphql-eval": "1.229.0-dev1",
47
- "@salesforce/lds-network-adapter": "1.229.0-dev1",
48
- "@salesforce/lds-network-nimbus": "1.229.0-dev1",
49
- "@salesforce/lds-store-binary": "1.229.0-dev1",
50
- "@salesforce/lds-store-nimbus": "1.229.0-dev1",
51
- "@salesforce/lds-store-sql": "1.229.0-dev1",
52
- "@salesforce/lds-utils-adapters": "1.229.0-dev1",
53
- "@salesforce/nimbus-plugin-lds": "1.229.0-dev1",
43
+ "@salesforce/lds-adapters-graphql": "1.229.0-dev2",
44
+ "@salesforce/lds-drafts": "1.229.0-dev2",
45
+ "@salesforce/lds-drafts-adapters-uiapi": "1.229.0-dev2",
46
+ "@salesforce/lds-graphql-eval": "1.229.0-dev2",
47
+ "@salesforce/lds-network-adapter": "1.229.0-dev2",
48
+ "@salesforce/lds-network-nimbus": "1.229.0-dev2",
49
+ "@salesforce/lds-store-binary": "1.229.0-dev2",
50
+ "@salesforce/lds-store-nimbus": "1.229.0-dev2",
51
+ "@salesforce/lds-store-sql": "1.229.0-dev2",
52
+ "@salesforce/lds-utils-adapters": "1.229.0-dev2",
53
+ "@salesforce/nimbus-plugin-lds": "1.229.0-dev2",
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
@@ -4260,8 +4260,8 @@ function rootRecordQuery(selection, input) {
4260
4260
  // If there is no metadata for this query or it somehow lacks a timestamp
4261
4261
  // skip setting the root timestamp
4262
4262
  if (queryMetadata !== undefined && queryMetadata.ingestionTimestamp !== undefined) {
4263
- // subtract 10ms from timestamp to account for ingestion processing time
4264
- input.rootTimestamp = queryMetadata.ingestionTimestamp - 10;
4263
+ // subtract 1000ms from timestamp to account for ingestion processing time
4264
+ input.rootTimestamp = queryMetadata.ingestionTimestamp - 1000;
4265
4265
  }
4266
4266
  }
4267
4267
  return recordQuery(selection, alias, apiName, [], input);
@@ -9099,8 +9099,8 @@ async function fetchIngestionTimeStampFromDatabase(apiName, info, args, query) {
9099
9099
  const results = await query(sql, [key]);
9100
9100
  const [timestamp] = results.rows.map((row) => row[0]);
9101
9101
  if (timestamp !== null && typeof timestamp === 'number') {
9102
- //go back 10 ms to adjust for margin of error when top level query is stored and when raml objects are stored
9103
- ingestionTimestamp = timestamp - 10;
9102
+ //go back 1000 ms to adjust for margin of error when top level query is stored and when raml objects are stored
9103
+ ingestionTimestamp = timestamp - 1000;
9104
9104
  }
9105
9105
  }
9106
9106
  return ingestionTimestamp;
@@ -9149,26 +9149,20 @@ function generateRecordQueries(objectInfos) {
9149
9149
  let recordConnections = ``;
9150
9150
  const polymorphicFieldTypeNames = new Set();
9151
9151
  let typedScalars = new Set();
9152
+ let parentRelationshipFields = new Set();
9152
9153
  for (const objectInfo of values$1(objectInfos)) {
9153
9154
  const { apiName, childRelationships } = objectInfo;
9154
9155
  let fields = ``;
9155
9156
  typedScalars.add(`${apiName}_Filter`);
9156
9157
  typedScalars.add(`${apiName}_OrderBy`);
9157
- for (const childRelationship of childRelationships) {
9158
- const { childObjectApiName } = childRelationship;
9159
- // Only add the relationship if there is relevant objectinfos for it,
9160
- // otherwise we'd be defining types we cannot satisfy and aren't referenced in
9161
- // the query.
9162
- if (objectInfos[childObjectApiName] !== undefined) {
9163
- fields += `${childRelationship.relationshipName}(first: Int, where: ${childObjectApiName}_Filter, orderBy: ${childObjectApiName}_OrderBy, scope: SupportedScopes): ${childObjectApiName}Connection \n`;
9164
- typedScalars.add(`${childObjectApiName}_Filter`);
9165
- typedScalars.add(`${childObjectApiName}_OrderBy`);
9166
- }
9167
- }
9168
9158
  for (const field of values$1(objectInfo.fields)) {
9169
9159
  if (!fieldsStaticallyAdded.includes(field.apiName)) {
9170
9160
  fields += `${field.apiName}: ${dataTypeToType(field.dataType, field.apiName)}\n`;
9171
9161
  }
9162
+ //handles parent relationship
9163
+ if (field.relationshipName === null) {
9164
+ continue;
9165
+ }
9172
9166
  // For spanning parent relationships with no union types
9173
9167
  if (field.referenceToInfos.length === 1) {
9174
9168
  const [relation] = field.referenceToInfos;
@@ -9176,11 +9170,13 @@ function generateRecordQueries(objectInfos) {
9176
9170
  // otherwise we'd be defining types we cannot satisfy and aren't referenced in
9177
9171
  // the query.
9178
9172
  if (objectInfos[relation.apiName] !== undefined) {
9173
+ parentRelationshipFields.add(field.relationshipName);
9179
9174
  fields += `${field.relationshipName}: ${relation.apiName}\n`;
9180
9175
  }
9181
9176
  // For polymorphic field, its type is 'Record' inteface. The concrete entity type name is saved for field resolving of next phase
9182
9177
  }
9183
9178
  else if (field.referenceToInfos.length > 1) {
9179
+ parentRelationshipFields.add(field.relationshipName);
9184
9180
  fields += `${field.relationshipName}: Record\n`;
9185
9181
  for (const relation of field.referenceToInfos) {
9186
9182
  if (objectInfos[relation.apiName] !== undefined) {
@@ -9189,6 +9185,20 @@ function generateRecordQueries(objectInfos) {
9189
9185
  }
9190
9186
  }
9191
9187
  }
9188
+ // handles child relationship
9189
+ for (const childRelationship of childRelationships) {
9190
+ const { childObjectApiName } = childRelationship;
9191
+ // Only add the relationship if there is relevant objectinfos for it,
9192
+ // otherwise we'd be defining types we cannot satisfy and aren't referenced in
9193
+ // the query.
9194
+ // 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
9195
+ if (objectInfos[childObjectApiName] !== undefined &&
9196
+ !parentRelationshipFields.has(childRelationship.relationshipName)) {
9197
+ fields += `${childRelationship.relationshipName}(first: Int, where: ${childObjectApiName}_Filter, orderBy: ${childObjectApiName}_OrderBy, scope: SupportedScopes): ${childObjectApiName}Connection \n`;
9198
+ typedScalars.add(`${childObjectApiName}_Filter`);
9199
+ typedScalars.add(`${childObjectApiName}_OrderBy`);
9200
+ }
9201
+ }
9192
9202
  recordQueries += `${apiName}(first: Int, where: ${apiName}_Filter, orderBy: ${apiName}_OrderBy, scope: SupportedScopes): ${apiName}Connection\n`;
9193
9203
  const isServiceAppointment = apiName === 'ServiceAppointment';
9194
9204
  recordConnections += /* GraphQL */ `
@@ -16761,4 +16771,4 @@ register({
16761
16771
  });
16762
16772
 
16763
16773
  export { getRuntime, registerReportObserver, reportGraphqlQueryParseError };
16764
- // version: 1.229.0-dev1-f69d054a9
16774
+ // version: 1.229.0-dev2-e9832aaff