@salesforce/lds-runtime-mobile 1.310.0 → 1.311.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.
Files changed (3) hide show
  1. package/dist/main.js +35 -14
  2. package/package.json +18 -18
  3. package/sfdc/main.js +35 -14
package/dist/main.js CHANGED
@@ -10787,6 +10787,11 @@ function singlePredicateToSql(predicate, defaultAlias, isChildNotPredicate = fal
10787
10787
  let { alias, leftPath, operator, value, dataType, isCaseSensitive } = predicate;
10788
10788
  let binding = [];
10789
10789
  let boundValue = extractPredicateValue(value, dataType);
10790
+ // using != does not include null values
10791
+ // using IS NOT predicate will include null values as null also is not the value
10792
+ if (operator === '!=') {
10793
+ operator = 'IS NOT';
10794
+ }
10790
10795
  // Handles boolean type field
10791
10796
  if (dataType === 'Boolean') {
10792
10797
  if (boundValue === null) {
@@ -10802,13 +10807,8 @@ function singlePredicateToSql(predicate, defaultAlias, isChildNotPredicate = fal
10802
10807
  boundValue = 0;
10803
10808
  }
10804
10809
  }
10805
- if (boundValue === null) {
10806
- if (operator === '=') {
10807
- operator = 'IS';
10808
- }
10809
- else if (operator === '!=') {
10810
- operator = 'IS NOT';
10811
- }
10810
+ if (boundValue === null && operator === '=') {
10811
+ operator = 'IS';
10812
10812
  }
10813
10813
  alias = !alias ? defaultAlias : alias;
10814
10814
  let sql;
@@ -10960,7 +10960,13 @@ function extractPredicateValue(value, dataType) {
10960
10960
  return value;
10961
10961
  }
10962
10962
  if (typeof value !== 'object') {
10963
- if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
10963
+ // GraphQL server treats empty string value as null
10964
+ if (typeof value === 'string' && value.length === 0) {
10965
+ return null;
10966
+ }
10967
+ else if (typeof value === 'string' ||
10968
+ typeof value === 'number' ||
10969
+ typeof value === 'boolean') {
10964
10970
  return value;
10965
10971
  }
10966
10972
  else {
@@ -18274,7 +18280,11 @@ class PrimingSession extends EventEmitter {
18274
18280
  const unavailableTypes = apiNames.filter((x) => !objectInfoMap[x]);
18275
18281
  const availableTypes = apiNames.filter((x) => objectInfoMap[x]);
18276
18282
  const unavilableBatches = batches.filter((x) => unavailableTypes.includes(x.type));
18277
- const availableBatches = batches.filter((x) => !unavailableTypes.includes(x.type));
18283
+ const availableBatches = batches
18284
+ .filter((x) => !unavailableTypes.includes(x.type))
18285
+ .map((x) => {
18286
+ return { ...x, objectInfo: objectInfoMap[x.type] };
18287
+ });
18278
18288
  const unavailableIds = unavilableBatches.reduce((acc, x) => {
18279
18289
  acc.push(...x.ids);
18280
18290
  return acc;
@@ -18296,7 +18306,7 @@ const requiredFieldMap = {
18296
18306
  Id: 'Id',
18297
18307
  LastModifiedById: 'LastModifiedById { value }',
18298
18308
  LastModifiedDate: 'LastModifiedDate { value }',
18299
- RecordTypeId: 'RecordTypeId { value }',
18309
+ RecordTypeId: 'RecordTypeId(fallback: true) { value }',
18300
18310
  SystemModstamp: 'SystemModstamp { value }',
18301
18311
  WeakEtag: 'WeakEtag',
18302
18312
  };
@@ -18363,9 +18373,10 @@ class RecordLoaderGraphQL {
18363
18373
  missingIds: batchInput.ids,
18364
18374
  };
18365
18375
  }
18376
+ const objectInfo = batchInput.objectInfo;
18366
18377
  const seenRecords = new Set(batchInput.ids);
18367
18378
  const records = data.uiapi.query[batchInput.type].edges.map((edge) => {
18368
- const record = this.generateDurableRecordRepresentation(edge.node);
18379
+ const record = this.generateDurableRecordRepresentation(edge.node, objectInfo);
18369
18380
  seenRecords.delete(record.id);
18370
18381
  return record;
18371
18382
  });
@@ -18416,7 +18427,7 @@ class RecordLoaderGraphQL {
18416
18427
  }
18417
18428
  `;
18418
18429
  }
18419
- generateDurableRecordRepresentation(node) {
18430
+ generateDurableRecordRepresentation(node, objectInfo) {
18420
18431
  const standardRecordFields = new Set(Object.keys(requiredFieldMap).map((x) => `${requiredPrefix}${x}`));
18421
18432
  const id = node[`${requiredPrefix}Id`];
18422
18433
  const recordTypeId = node[`${requiredPrefix}RecordTypeId`].value;
@@ -18431,6 +18442,16 @@ class RecordLoaderGraphQL {
18431
18442
  }, {});
18432
18443
  fields['Id'] = { value: id, displayValue: null };
18433
18444
  fields['RecordTypeId'] = { value: recordTypeId, displayValue: null };
18445
+ let recordTypeInfo = null;
18446
+ if (recordTypeId !== null &&
18447
+ objectInfo.recordTypeInfos &&
18448
+ objectInfo.recordTypeInfos[recordTypeId]) {
18449
+ const appliedRecordTypeInfo = objectInfo.recordTypeInfos[recordTypeId];
18450
+ // ui-api only applies the record type if its not the default type, otherwise it sets it to null
18451
+ if (appliedRecordTypeInfo.defaultRecordTypeMapping === false) {
18452
+ recordTypeInfo = appliedRecordTypeInfo;
18453
+ }
18454
+ }
18434
18455
  return {
18435
18456
  apiName: node[`${requiredPrefix}ApiName`],
18436
18457
  childRelationships: {},
@@ -18445,7 +18466,7 @@ class RecordLoaderGraphQL {
18445
18466
  ? node[`${requiredPrefix}LastModifiedDate`].value
18446
18467
  : null,
18447
18468
  recordTypeId,
18448
- recordTypeInfo: null,
18469
+ recordTypeInfo: recordTypeInfo,
18449
18470
  systemModstamp: node[`${requiredPrefix}SystemModstamp`] &&
18450
18471
  node[`${requiredPrefix}SystemModstamp`].value
18451
18472
  ? node[`${requiredPrefix}SystemModstamp`].value
@@ -19188,4 +19209,4 @@ register({
19188
19209
  });
19189
19210
 
19190
19211
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
19191
- // version: 1.310.0-6f61f12f95
19212
+ // version: 1.311.0-167623b638
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-mobile",
3
- "version": "1.310.0",
3
+ "version": "1.311.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,27 +32,27 @@
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-mobile": "^1.310.0",
36
- "@salesforce/lds-bindings": "^1.310.0",
37
- "@salesforce/lds-instrumentation": "^1.310.0",
38
- "@salesforce/lds-priming": "^1.310.0",
35
+ "@salesforce/lds-adapters-uiapi-mobile": "^1.311.0",
36
+ "@salesforce/lds-bindings": "^1.311.0",
37
+ "@salesforce/lds-instrumentation": "^1.311.0",
38
+ "@salesforce/lds-priming": "^1.311.0",
39
39
  "@salesforce/user": "0.0.21",
40
40
  "o11y": "250.7.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@salesforce/lds-adapters-graphql": "^1.310.0",
44
- "@salesforce/lds-drafts": "^1.310.0",
45
- "@salesforce/lds-drafts-adapters-uiapi": "^1.310.0",
46
- "@salesforce/lds-durable-records": "^1.310.0",
47
- "@salesforce/lds-graphql-eval": "^1.310.0",
48
- "@salesforce/lds-graphql-local-evaluation": "^1.310.0",
49
- "@salesforce/lds-network-adapter": "^1.310.0",
50
- "@salesforce/lds-network-nimbus": "^1.310.0",
51
- "@salesforce/lds-store-binary": "^1.310.0",
52
- "@salesforce/lds-store-nimbus": "^1.310.0",
53
- "@salesforce/lds-store-sql": "^1.310.0",
54
- "@salesforce/lds-utils-adapters": "^1.310.0",
55
- "@salesforce/nimbus-plugin-lds": "^1.310.0",
43
+ "@salesforce/lds-adapters-graphql": "^1.311.0",
44
+ "@salesforce/lds-drafts": "^1.311.0",
45
+ "@salesforce/lds-drafts-adapters-uiapi": "^1.311.0",
46
+ "@salesforce/lds-durable-records": "^1.311.0",
47
+ "@salesforce/lds-graphql-eval": "^1.311.0",
48
+ "@salesforce/lds-graphql-local-evaluation": "^1.311.0",
49
+ "@salesforce/lds-network-adapter": "^1.311.0",
50
+ "@salesforce/lds-network-nimbus": "^1.311.0",
51
+ "@salesforce/lds-store-binary": "^1.311.0",
52
+ "@salesforce/lds-store-nimbus": "^1.311.0",
53
+ "@salesforce/lds-store-sql": "^1.311.0",
54
+ "@salesforce/lds-utils-adapters": "^1.311.0",
55
+ "@salesforce/nimbus-plugin-lds": "^1.311.0",
56
56
  "babel-plugin-dynamic-import-node": "^2.3.3",
57
57
  "wait-for-expect": "^3.0.2"
58
58
  },
package/sfdc/main.js CHANGED
@@ -10787,6 +10787,11 @@ function singlePredicateToSql(predicate, defaultAlias, isChildNotPredicate = fal
10787
10787
  let { alias, leftPath, operator, value, dataType, isCaseSensitive } = predicate;
10788
10788
  let binding = [];
10789
10789
  let boundValue = extractPredicateValue(value, dataType);
10790
+ // using != does not include null values
10791
+ // using IS NOT predicate will include null values as null also is not the value
10792
+ if (operator === '!=') {
10793
+ operator = 'IS NOT';
10794
+ }
10790
10795
  // Handles boolean type field
10791
10796
  if (dataType === 'Boolean') {
10792
10797
  if (boundValue === null) {
@@ -10802,13 +10807,8 @@ function singlePredicateToSql(predicate, defaultAlias, isChildNotPredicate = fal
10802
10807
  boundValue = 0;
10803
10808
  }
10804
10809
  }
10805
- if (boundValue === null) {
10806
- if (operator === '=') {
10807
- operator = 'IS';
10808
- }
10809
- else if (operator === '!=') {
10810
- operator = 'IS NOT';
10811
- }
10810
+ if (boundValue === null && operator === '=') {
10811
+ operator = 'IS';
10812
10812
  }
10813
10813
  alias = !alias ? defaultAlias : alias;
10814
10814
  let sql;
@@ -10960,7 +10960,13 @@ function extractPredicateValue(value, dataType) {
10960
10960
  return value;
10961
10961
  }
10962
10962
  if (typeof value !== 'object') {
10963
- if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
10963
+ // GraphQL server treats empty string value as null
10964
+ if (typeof value === 'string' && value.length === 0) {
10965
+ return null;
10966
+ }
10967
+ else if (typeof value === 'string' ||
10968
+ typeof value === 'number' ||
10969
+ typeof value === 'boolean') {
10964
10970
  return value;
10965
10971
  }
10966
10972
  else {
@@ -18274,7 +18280,11 @@ class PrimingSession extends EventEmitter {
18274
18280
  const unavailableTypes = apiNames.filter((x) => !objectInfoMap[x]);
18275
18281
  const availableTypes = apiNames.filter((x) => objectInfoMap[x]);
18276
18282
  const unavilableBatches = batches.filter((x) => unavailableTypes.includes(x.type));
18277
- const availableBatches = batches.filter((x) => !unavailableTypes.includes(x.type));
18283
+ const availableBatches = batches
18284
+ .filter((x) => !unavailableTypes.includes(x.type))
18285
+ .map((x) => {
18286
+ return { ...x, objectInfo: objectInfoMap[x.type] };
18287
+ });
18278
18288
  const unavailableIds = unavilableBatches.reduce((acc, x) => {
18279
18289
  acc.push(...x.ids);
18280
18290
  return acc;
@@ -18296,7 +18306,7 @@ const requiredFieldMap = {
18296
18306
  Id: 'Id',
18297
18307
  LastModifiedById: 'LastModifiedById { value }',
18298
18308
  LastModifiedDate: 'LastModifiedDate { value }',
18299
- RecordTypeId: 'RecordTypeId { value }',
18309
+ RecordTypeId: 'RecordTypeId(fallback: true) { value }',
18300
18310
  SystemModstamp: 'SystemModstamp { value }',
18301
18311
  WeakEtag: 'WeakEtag',
18302
18312
  };
@@ -18363,9 +18373,10 @@ class RecordLoaderGraphQL {
18363
18373
  missingIds: batchInput.ids,
18364
18374
  };
18365
18375
  }
18376
+ const objectInfo = batchInput.objectInfo;
18366
18377
  const seenRecords = new Set(batchInput.ids);
18367
18378
  const records = data.uiapi.query[batchInput.type].edges.map((edge) => {
18368
- const record = this.generateDurableRecordRepresentation(edge.node);
18379
+ const record = this.generateDurableRecordRepresentation(edge.node, objectInfo);
18369
18380
  seenRecords.delete(record.id);
18370
18381
  return record;
18371
18382
  });
@@ -18416,7 +18427,7 @@ class RecordLoaderGraphQL {
18416
18427
  }
18417
18428
  `;
18418
18429
  }
18419
- generateDurableRecordRepresentation(node) {
18430
+ generateDurableRecordRepresentation(node, objectInfo) {
18420
18431
  const standardRecordFields = new Set(Object.keys(requiredFieldMap).map((x) => `${requiredPrefix}${x}`));
18421
18432
  const id = node[`${requiredPrefix}Id`];
18422
18433
  const recordTypeId = node[`${requiredPrefix}RecordTypeId`].value;
@@ -18431,6 +18442,16 @@ class RecordLoaderGraphQL {
18431
18442
  }, {});
18432
18443
  fields['Id'] = { value: id, displayValue: null };
18433
18444
  fields['RecordTypeId'] = { value: recordTypeId, displayValue: null };
18445
+ let recordTypeInfo = null;
18446
+ if (recordTypeId !== null &&
18447
+ objectInfo.recordTypeInfos &&
18448
+ objectInfo.recordTypeInfos[recordTypeId]) {
18449
+ const appliedRecordTypeInfo = objectInfo.recordTypeInfos[recordTypeId];
18450
+ // ui-api only applies the record type if its not the default type, otherwise it sets it to null
18451
+ if (appliedRecordTypeInfo.defaultRecordTypeMapping === false) {
18452
+ recordTypeInfo = appliedRecordTypeInfo;
18453
+ }
18454
+ }
18434
18455
  return {
18435
18456
  apiName: node[`${requiredPrefix}ApiName`],
18436
18457
  childRelationships: {},
@@ -18445,7 +18466,7 @@ class RecordLoaderGraphQL {
18445
18466
  ? node[`${requiredPrefix}LastModifiedDate`].value
18446
18467
  : null,
18447
18468
  recordTypeId,
18448
- recordTypeInfo: null,
18469
+ recordTypeInfo: recordTypeInfo,
18449
18470
  systemModstamp: node[`${requiredPrefix}SystemModstamp`] &&
18450
18471
  node[`${requiredPrefix}SystemModstamp`].value
18451
18472
  ? node[`${requiredPrefix}SystemModstamp`].value
@@ -19188,4 +19209,4 @@ register({
19188
19209
  });
19189
19210
 
19190
19211
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
19191
- // version: 1.310.0-6f61f12f95
19212
+ // version: 1.311.0-167623b638