@salesforce/lds-runtime-mobile 1.242.1 → 1.243.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 +21 -20
  2. package/package.json +1 -1
  3. package/sfdc/main.js +21 -20
package/dist/main.js CHANGED
@@ -6111,9 +6111,6 @@ class AbstractResourceRequestActionHandler {
6111
6111
  }
6112
6112
  async buildPendingAction(request, queue) {
6113
6113
  const targetId = await this.getIdFromRequest(request);
6114
- if (targetId === undefined) {
6115
- return Promise.reject(new Error('Cannot determine target id from the resource request'));
6116
- }
6117
6114
  const tag = this.buildTagForTargetId(targetId);
6118
6115
  const handlerActions = queue.filter((x) => x.handler === this.handlerId);
6119
6116
  if (request.method === 'post' && actionsForTag(tag, handlerActions).length > 0) {
@@ -11124,7 +11121,7 @@ const RECORD_ENDPOINT_REGEX$1 = /^\/ui-api\/records\/?(([a-zA-Z0-9]+))?$/;
11124
11121
  function getRecordIdFromRecordRequest(request) {
11125
11122
  const { method, basePath } = request;
11126
11123
  if (basePath === undefined) {
11127
- return undefined;
11124
+ throw Error(`Could not determine record id from request without a basePath`);
11128
11125
  }
11129
11126
  let recordId = '';
11130
11127
  switch (method) {
@@ -11133,13 +11130,13 @@ function getRecordIdFromRecordRequest(request) {
11133
11130
  case 'delete': {
11134
11131
  const matches = basePath.match(RECORD_ENDPOINT_REGEX$1);
11135
11132
  if (!matches || matches.length !== 3) {
11136
- return undefined;
11133
+ throw Error(`Could not determine record id from request path ${basePath}`);
11137
11134
  }
11138
11135
  recordId = matches[2];
11139
11136
  break;
11140
11137
  }
11141
11138
  default: {
11142
- return undefined;
11139
+ throw Error(`Could not determine record id from request type `);
11143
11140
  }
11144
11141
  }
11145
11142
  return recordId;
@@ -11995,7 +11992,7 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
11995
11992
  if (request.method === 'post') {
11996
11993
  const apiName = request.body.apiName;
11997
11994
  if (apiName === undefined) {
11998
- return undefined;
11995
+ throw Error('Could not determine api name from request body');
11999
11996
  }
12000
11997
  return this.recordService.synthesizeId(apiName);
12001
11998
  }
@@ -12710,11 +12707,11 @@ class UiApiDraftRecordService {
12710
12707
  const objectInfo = await getAdapterData(this.objectInfoAdapter, {
12711
12708
  objectApiName: apiName,
12712
12709
  });
12713
- if (objectInfo === undefined) {
12714
- return undefined;
12710
+ if (objectInfo === undefined || objectInfo.keyPrefix === null) {
12711
+ throw Error(`Could not find or fetch object info for ${apiName}`);
12715
12712
  }
12716
12713
  if (objectInfo.keyPrefix === null) {
12717
- return undefined;
12714
+ throw Error(`Could not find key prefix for ${apiName}. Cannot synthesize id.`);
12718
12715
  }
12719
12716
  return this.generateId(objectInfo.keyPrefix);
12720
12717
  }
@@ -12790,7 +12787,7 @@ class QuickActionExecutionRepresentationHandler extends AbstractResourceRequestA
12790
12787
  getIdFromRequest(request) {
12791
12788
  const apiName = request.body.apiName;
12792
12789
  if (typeof apiName !== 'string') {
12793
- throw Error('expected api name not found');
12790
+ throw Error('expected api name not found in request body');
12794
12791
  }
12795
12792
  const id = this.draftRecordService.synthesizeId(apiName);
12796
12793
  return Promise.resolve(id);
@@ -13252,16 +13249,18 @@ class ContentDocumentCompositeRepresentationActionHandler extends AbstractResour
13252
13249
  // remember ContentDocument ID
13253
13250
  pendingAction.metadata[CONTENT_DOCUMENT_DRAFT_ID_KEY] = targetId;
13254
13251
  // generate and remember ContentVersion ID
13255
- const contentVersionId = await this.draftRecordService.synthesizeId(CONTENT_VERSION_API_NAME);
13256
- if (contentVersionId === undefined) {
13252
+ const contentVersionId = await this.draftRecordService
13253
+ .synthesizeId(CONTENT_VERSION_API_NAME)
13254
+ .catch(() => {
13257
13255
  return Promise.reject(new DraftSynthesisError('Cannot generate local ContentVersion synthetic id', 'CANNOT_GENERATE_ID'));
13258
- }
13256
+ });
13259
13257
  pendingAction.metadata[CONTENT_VERSION_DRAFT_ID_KEY] = contentVersionId;
13260
13258
  // generate and remember ContentDocumentLink ID
13261
- const contentDocumentLinkId = await this.draftRecordService.synthesizeId(CONTENT_DOCUMENT_LINK_API_NAME);
13262
- if (contentDocumentLinkId === undefined) {
13259
+ const contentDocumentLinkId = await this.draftRecordService
13260
+ .synthesizeId(CONTENT_DOCUMENT_LINK_API_NAME)
13261
+ .catch(() => {
13263
13262
  return Promise.reject(new DraftSynthesisError('Cannot generate local ContentDocumentLink synthetic id', 'CANNOT_GENERATE_ID'));
13264
- }
13263
+ });
13265
13264
  pendingAction.metadata[CONTENT_DOCUMENT_LINK_DRAFT_ID_KEY] = contentDocumentLinkId;
13266
13265
  // assert that object infos and references exist
13267
13266
  const metaDataResult = await this.draftRecordService.getRecordDraftMetadata(targetId, pendingAction);
@@ -13290,8 +13289,7 @@ class ContentDocumentCompositeRepresentationActionHandler extends AbstractResour
13290
13289
  return false;
13291
13290
  }
13292
13291
  async getIdFromRequest(_request) {
13293
- const id = this.draftRecordService.synthesizeId(CONTENT_DOCUMENT_API_NAME);
13294
- return id;
13292
+ return this.draftRecordService.synthesizeId(CONTENT_DOCUMENT_API_NAME);
13295
13293
  }
13296
13294
  getIdFromResponseBody(responseBody) {
13297
13295
  return responseBody.contentDocument.id;
@@ -16249,6 +16247,9 @@ class PrimingSession extends EventEmitter {
16249
16247
  this.ldsRecordRefresher = config.ldsRecordRefresher;
16250
16248
  this.networkWorkerPool = new AsyncWorkerPool(this.concurrency);
16251
16249
  this.useBatchGQL = ldsPrimingGraphqlBatch.isOpen({ fallback: false });
16250
+ if (this.useBatchGQL) {
16251
+ this.batchSize = this.batchSize / DEFAULT_GQL_QUERY_BATCH_SIZE;
16252
+ }
16252
16253
  this.conflictPool = new ConflictPool(config.store, this.objectInfoLoader);
16253
16254
  }
16254
16255
  // function that enqueues priming work
@@ -17113,4 +17114,4 @@ register({
17113
17114
  });
17114
17115
 
17115
17116
  export { getRuntime, registerReportObserver, reportGraphqlQueryParseError };
17116
- // version: 1.242.1-58f8f4bb1
17117
+ // version: 1.243.0-87f38263e
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-mobile",
3
- "version": "1.242.1",
3
+ "version": "1.243.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS runtime for mobile/hybrid environments.",
6
6
  "main": "dist/main.js",
package/sfdc/main.js CHANGED
@@ -6111,9 +6111,6 @@ class AbstractResourceRequestActionHandler {
6111
6111
  }
6112
6112
  async buildPendingAction(request, queue) {
6113
6113
  const targetId = await this.getIdFromRequest(request);
6114
- if (targetId === undefined) {
6115
- return Promise.reject(new Error('Cannot determine target id from the resource request'));
6116
- }
6117
6114
  const tag = this.buildTagForTargetId(targetId);
6118
6115
  const handlerActions = queue.filter((x) => x.handler === this.handlerId);
6119
6116
  if (request.method === 'post' && actionsForTag(tag, handlerActions).length > 0) {
@@ -11124,7 +11121,7 @@ const RECORD_ENDPOINT_REGEX$1 = /^\/ui-api\/records\/?(([a-zA-Z0-9]+))?$/;
11124
11121
  function getRecordIdFromRecordRequest(request) {
11125
11122
  const { method, basePath } = request;
11126
11123
  if (basePath === undefined) {
11127
- return undefined;
11124
+ throw Error(`Could not determine record id from request without a basePath`);
11128
11125
  }
11129
11126
  let recordId = '';
11130
11127
  switch (method) {
@@ -11133,13 +11130,13 @@ function getRecordIdFromRecordRequest(request) {
11133
11130
  case 'delete': {
11134
11131
  const matches = basePath.match(RECORD_ENDPOINT_REGEX$1);
11135
11132
  if (!matches || matches.length !== 3) {
11136
- return undefined;
11133
+ throw Error(`Could not determine record id from request path ${basePath}`);
11137
11134
  }
11138
11135
  recordId = matches[2];
11139
11136
  break;
11140
11137
  }
11141
11138
  default: {
11142
- return undefined;
11139
+ throw Error(`Could not determine record id from request type `);
11143
11140
  }
11144
11141
  }
11145
11142
  return recordId;
@@ -11995,7 +11992,7 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
11995
11992
  if (request.method === 'post') {
11996
11993
  const apiName = request.body.apiName;
11997
11994
  if (apiName === undefined) {
11998
- return undefined;
11995
+ throw Error('Could not determine api name from request body');
11999
11996
  }
12000
11997
  return this.recordService.synthesizeId(apiName);
12001
11998
  }
@@ -12710,11 +12707,11 @@ class UiApiDraftRecordService {
12710
12707
  const objectInfo = await getAdapterData(this.objectInfoAdapter, {
12711
12708
  objectApiName: apiName,
12712
12709
  });
12713
- if (objectInfo === undefined) {
12714
- return undefined;
12710
+ if (objectInfo === undefined || objectInfo.keyPrefix === null) {
12711
+ throw Error(`Could not find or fetch object info for ${apiName}`);
12715
12712
  }
12716
12713
  if (objectInfo.keyPrefix === null) {
12717
- return undefined;
12714
+ throw Error(`Could not find key prefix for ${apiName}. Cannot synthesize id.`);
12718
12715
  }
12719
12716
  return this.generateId(objectInfo.keyPrefix);
12720
12717
  }
@@ -12790,7 +12787,7 @@ class QuickActionExecutionRepresentationHandler extends AbstractResourceRequestA
12790
12787
  getIdFromRequest(request) {
12791
12788
  const apiName = request.body.apiName;
12792
12789
  if (typeof apiName !== 'string') {
12793
- throw Error('expected api name not found');
12790
+ throw Error('expected api name not found in request body');
12794
12791
  }
12795
12792
  const id = this.draftRecordService.synthesizeId(apiName);
12796
12793
  return Promise.resolve(id);
@@ -13252,16 +13249,18 @@ class ContentDocumentCompositeRepresentationActionHandler extends AbstractResour
13252
13249
  // remember ContentDocument ID
13253
13250
  pendingAction.metadata[CONTENT_DOCUMENT_DRAFT_ID_KEY] = targetId;
13254
13251
  // generate and remember ContentVersion ID
13255
- const contentVersionId = await this.draftRecordService.synthesizeId(CONTENT_VERSION_API_NAME);
13256
- if (contentVersionId === undefined) {
13252
+ const contentVersionId = await this.draftRecordService
13253
+ .synthesizeId(CONTENT_VERSION_API_NAME)
13254
+ .catch(() => {
13257
13255
  return Promise.reject(new DraftSynthesisError('Cannot generate local ContentVersion synthetic id', 'CANNOT_GENERATE_ID'));
13258
- }
13256
+ });
13259
13257
  pendingAction.metadata[CONTENT_VERSION_DRAFT_ID_KEY] = contentVersionId;
13260
13258
  // generate and remember ContentDocumentLink ID
13261
- const contentDocumentLinkId = await this.draftRecordService.synthesizeId(CONTENT_DOCUMENT_LINK_API_NAME);
13262
- if (contentDocumentLinkId === undefined) {
13259
+ const contentDocumentLinkId = await this.draftRecordService
13260
+ .synthesizeId(CONTENT_DOCUMENT_LINK_API_NAME)
13261
+ .catch(() => {
13263
13262
  return Promise.reject(new DraftSynthesisError('Cannot generate local ContentDocumentLink synthetic id', 'CANNOT_GENERATE_ID'));
13264
- }
13263
+ });
13265
13264
  pendingAction.metadata[CONTENT_DOCUMENT_LINK_DRAFT_ID_KEY] = contentDocumentLinkId;
13266
13265
  // assert that object infos and references exist
13267
13266
  const metaDataResult = await this.draftRecordService.getRecordDraftMetadata(targetId, pendingAction);
@@ -13290,8 +13289,7 @@ class ContentDocumentCompositeRepresentationActionHandler extends AbstractResour
13290
13289
  return false;
13291
13290
  }
13292
13291
  async getIdFromRequest(_request) {
13293
- const id = this.draftRecordService.synthesizeId(CONTENT_DOCUMENT_API_NAME);
13294
- return id;
13292
+ return this.draftRecordService.synthesizeId(CONTENT_DOCUMENT_API_NAME);
13295
13293
  }
13296
13294
  getIdFromResponseBody(responseBody) {
13297
13295
  return responseBody.contentDocument.id;
@@ -16249,6 +16247,9 @@ class PrimingSession extends EventEmitter {
16249
16247
  this.ldsRecordRefresher = config.ldsRecordRefresher;
16250
16248
  this.networkWorkerPool = new AsyncWorkerPool(this.concurrency);
16251
16249
  this.useBatchGQL = ldsPrimingGraphqlBatch.isOpen({ fallback: false });
16250
+ if (this.useBatchGQL) {
16251
+ this.batchSize = this.batchSize / DEFAULT_GQL_QUERY_BATCH_SIZE;
16252
+ }
16252
16253
  this.conflictPool = new ConflictPool(config.store, this.objectInfoLoader);
16253
16254
  }
16254
16255
  // function that enqueues priming work
@@ -17113,4 +17114,4 @@ register({
17113
17114
  });
17114
17115
 
17115
17116
  export { getRuntime, registerReportObserver, reportGraphqlQueryParseError };
17116
- // version: 1.242.1-58f8f4bb1
17117
+ // version: 1.243.0-87f38263e