@salesforce/lds-runtime-mobile 1.332.0-dev3 → 1.332.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 +10 -167
  2. package/package.json +14 -14
  3. package/sfdc/main.js +10 -167
package/dist/main.js CHANGED
@@ -42867,16 +42867,12 @@ function isCreateContentDocumentAndVersionDraftAdapterEvent(customEvent) {
42867
42867
  /* global __nimbus */
42868
42868
  function chunkToBase64(chunk) {
42869
42869
  const bytes = new Uint8Array(chunk);
42870
- const CHUNK_SIZE = 64 * 1024; // 64kb, any bigger and fromCharCode() can error out with an overflow.
42871
- let binary = '';
42872
- for (let i = 0; i < bytes.length; i += CHUNK_SIZE) {
42873
- binary += String.fromCharCode(...bytes.subarray(i, i + CHUNK_SIZE));
42874
- }
42870
+ const binary = String.fromCharCode.apply(null, bytes);
42875
42871
  return btoa(binary);
42876
42872
  }
42877
42873
  async function streamBufferToBinaryStore(binaryStore, file, mimeType) {
42878
42874
  const uri = await binaryStore.createStream(mimeType);
42879
- const CHUNK_SIZE = 1024 * 1024 * 2; // 2mb
42875
+ const CHUNK_SIZE = 64 * 1024; // 64KB
42880
42876
  const fileSize = file.size;
42881
42877
  let offset = 0;
42882
42878
  try {
@@ -50897,7 +50893,7 @@ function calculateEstimatedTotalUrlLength(request) {
50897
50893
  }
50898
50894
 
50899
50895
  const RECORD_ENDPOINT_REGEX = /^\/ui-api\/records\/?(([a-zA-Z0-9]+))?$/;
50900
- const referenceId$3 = 'LDS_Records_AggregateUi';
50896
+ const referenceId$1 = 'LDS_Records_AggregateUi';
50901
50897
  /**
50902
50898
  * Export to facilitate unit tests
50903
50899
  * Merge the second getRecord result into the first one.
@@ -50925,7 +50921,7 @@ function makeNetworkChunkFieldsGetRecord(networkAdapter, instrumentationSink) {
50925
50921
  if (batchRequestInfo === undefined) {
50926
50922
  return networkAdapter(resourceRequest, resourceRequestContext);
50927
50923
  }
50928
- const compositeRequest = buildCompositeRequestByFields(referenceId$3, resourceRequest, batchRequestInfo);
50924
+ const compositeRequest = buildCompositeRequestByFields(referenceId$1, resourceRequest, batchRequestInfo);
50929
50925
  const aggregateRequest = createAggregateUiRequest(resourceRequest, compositeRequest);
50930
50926
  return networkAdapter(aggregateRequest, resourceRequestContext).then((response) => {
50931
50927
  return mergeAggregateUiResponse(response, mergeGetRecordResult);
@@ -50934,145 +50930,19 @@ function makeNetworkChunkFieldsGetRecord(networkAdapter, instrumentationSink) {
50934
50930
  }
50935
50931
 
50936
50932
  const RECORDS_BATCH_ENDPOINT_REGEX = /^\/ui-api\/records\/batch\/?(([a-zA-Z0-9|,]+))?$/;
50937
- const referenceId$2 = 'LDS_Records_Batch_AggregateUi';
50933
+ const referenceId = 'LDS_Records_Batch_AggregateUi';
50938
50934
  function makeNetworkChunkFieldsGetRecordsBatch(networkAdapter, intrumentationSink) {
50939
50935
  return (resourceRequest, resourceRequestContext) => {
50940
50936
  const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RECORDS_BATCH_ENDPOINT_REGEX, intrumentationSink);
50941
50937
  if (batchRequestInfo === undefined) {
50942
50938
  return networkAdapter(resourceRequest, resourceRequestContext);
50943
50939
  }
50944
- const compositeRequest = buildCompositeRequestByFields(referenceId$2, resourceRequest, batchRequestInfo);
50945
- const aggregateRequest = createAggregateUiRequest(resourceRequest, compositeRequest);
50946
- return networkAdapter(aggregateRequest, resourceRequestContext).then((response) => {
50947
- return mergeAggregateUiResponse(response, (first, second) => {
50948
- return mergeBatchRecordsFields(first, second, (a, b) => {
50949
- return mergeRecordFields(a, b);
50950
- });
50951
- });
50952
- });
50953
- };
50954
- }
50955
-
50956
- const RELATED_LIST_RECORDS_ENDPOINT_REGEX = /^\/ui-api\/related-list-records\/?(([a-zA-Z0-9]+))?\/?(([a-zA-Z0-9]+))?$/;
50957
- const referenceId$1 = 'LDS_Related_List_Records_AggregateUi';
50958
- const QUERY_KEY_FIELDS = 'fields';
50959
- const QUERY_KEY_OPTIONAL_FIELDS = 'optionalFields';
50960
- /**
50961
- * Merge the second related list record collection into first one and return it.
50962
- * It checks both collections should have exaction same records, otherwise error.
50963
- * Exports it for unit tests
50964
- */
50965
- function mergeRelatedRecordsFields(first, second) {
50966
- const { records: targetRecords } = first;
50967
- const { records: sourceRecords } = second;
50968
- if (sourceRecords.length === targetRecords.length &&
50969
- recordIdsAllMatch(targetRecords, sourceRecords)) {
50970
- first.fields = first.fields.concat(second.fields);
50971
- first.optionalFields = first.optionalFields.concat(second.optionalFields);
50972
- for (let i = 0, len = sourceRecords.length; i < len; i += 1) {
50973
- const targetRecord = targetRecords[i];
50974
- const sourceRecord = sourceRecords[i];
50975
- mergeRecordFields(targetRecord, sourceRecord);
50976
- }
50977
- mergePageUrls(first, second);
50978
- return first;
50979
- }
50980
- else {
50981
- // Throw error due to two collection are about different set of records
50982
- // eslint-disable-next-line @salesforce/lds/no-error-in-production
50983
- throw new Error('Aggregate UI response is invalid');
50984
- }
50985
- }
50986
- function makeNetworkChunkFieldsGetRelatedListRecords(networkAdapter, instrumentationSink) {
50987
- return (resourceRequest, resourceRequestContext) => {
50988
- const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RELATED_LIST_RECORDS_ENDPOINT_REGEX, instrumentationSink);
50989
- if (batchRequestInfo === undefined) {
50990
- return networkAdapter(resourceRequest, resourceRequestContext);
50991
- }
50992
- const compositeRequest = buildCompositeRequestByFields(referenceId$1, resourceRequest, batchRequestInfo);
50993
- const aggregateRequest = createAggregateUiRequest(resourceRequest, compositeRequest);
50994
- return networkAdapter(aggregateRequest, resourceRequestContext).then((response) => {
50995
- return mergeAggregateUiResponse(response, mergeRelatedRecordsFields);
50996
- });
50997
- };
50998
- }
50999
- /**
51000
- * merge the second related list record collection into first one and return it
51001
- */
51002
- function mergePageUrls(first, second) {
51003
- first.currentPageUrl = mergeUrl(first.currentPageUrl, second.currentPageUrl);
51004
- first.previousPageUrl = mergeUrl(first.previousPageUrl, second.previousPageUrl);
51005
- first.nextPageUrl = mergeUrl(first.nextPageUrl, second.nextPageUrl);
51006
- }
51007
- /**
51008
- * merge to paging url with different set of fields or optional fields as combined one
51009
- * the paging url is like
51010
- * /services/data/v63.0/ui-api/related-list-records/001R0000006l1xKIAQ/Contacts
51011
- * ?fields=Id%2CName&optionalFields=Contact.Id%2CContact.Name&pageSize=50&pageToken=0
51012
- * @param path1 url path and query parmeter without domain
51013
- * @param path2 url path and query parmeter without domain
51014
- *
51015
- * Export to unit test
51016
- */
51017
- function mergeUrl(path1, path2) {
51018
- if (path1 === null)
51019
- return path2;
51020
- if (path2 === null)
51021
- return path1;
51022
- // new Url(...) need the path1, path2 to be prefix-ed with this fake domain
51023
- const domain = 'http://c.com';
51024
- const url1 = new URL(domain + path1);
51025
- const url2 = new URL(domain + path2);
51026
- const searchParams1 = url1.searchParams;
51027
- const fields = mergeFields(url1, url2, QUERY_KEY_FIELDS);
51028
- if (fields && searchParams1.get(QUERY_KEY_FIELDS) !== fields) {
51029
- searchParams1.set(QUERY_KEY_FIELDS, fields);
51030
- }
51031
- const optionalFields = mergeFields(url1, url2, QUERY_KEY_OPTIONAL_FIELDS);
51032
- if (optionalFields && searchParams1.get(QUERY_KEY_OPTIONAL_FIELDS) !== optionalFields) {
51033
- searchParams1.set(QUERY_KEY_OPTIONAL_FIELDS, optionalFields);
51034
- }
51035
- from(searchParams1.keys())
51036
- .sort()
51037
- .forEach((key) => {
51038
- const value = searchParams1.get(key);
51039
- searchParams1.delete(key);
51040
- searchParams1.append(key, value);
51041
- });
51042
- return url1.toString().substr(domain.length);
51043
- }
51044
- function mergeFields(url1, url2, name) {
51045
- const fields1 = ScopedFieldsCollection.fromQueryParameterValue(url1.searchParams.get(name));
51046
- const fields2 = ScopedFieldsCollection.fromQueryParameterValue(url2.searchParams.get(name));
51047
- fields1.merge(fields2);
51048
- return fields1.toQueryParameterValue();
51049
- }
51050
- /**
51051
- * Checks that all records ids exist in both arrays
51052
- * @param first batch of first array or records
51053
- * @param second batch of second array or records
51054
- * @returns
51055
- */
51056
- function recordIdsAllMatch(first, second) {
51057
- const firstIds = first.map((record) => record.id);
51058
- const secondIds = second.map((record) => record.id);
51059
- return firstIds.every((id) => secondIds.includes(id));
51060
- }
51061
-
51062
- const RELATED_LIST_RECORDS_BATCH_ENDPOINT_REGEX = /^\/ui-api\/related-list-records\/batch\/?(([a-zA-Z0-9]+))?\//;
51063
- const referenceId = 'LDS_Related_List_Records_AggregateUi';
51064
- function makeNetworkChunkFieldsGetRelatedListRecordsBatch(networkAdapter, instrumentationSink) {
51065
- return (resourceRequest, resourceRequestContext) => {
51066
- const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RELATED_LIST_RECORDS_BATCH_ENDPOINT_REGEX, instrumentationSink);
51067
- if (batchRequestInfo === undefined) {
51068
- return networkAdapter(resourceRequest, resourceRequestContext);
51069
- }
51070
50940
  const compositeRequest = buildCompositeRequestByFields(referenceId, resourceRequest, batchRequestInfo);
51071
50941
  const aggregateRequest = createAggregateUiRequest(resourceRequest, compositeRequest);
51072
50942
  return networkAdapter(aggregateRequest, resourceRequestContext).then((response) => {
51073
50943
  return mergeAggregateUiResponse(response, (first, second) => {
51074
50944
  return mergeBatchRecordsFields(first, second, (a, b) => {
51075
- return mergeRelatedRecordsFields(a, b);
50945
+ return mergeRecordFields(a, b);
51076
50946
  });
51077
50947
  });
51078
50948
  });
@@ -51088,12 +50958,7 @@ function makeNetworkChunkFieldsGetRelatedListRecordsBatch(networkAdapter, instru
51088
50958
  */
51089
50959
  function makeNetworkAdapterChunkRecordFields(networkAdapter, instrumentationSink) {
51090
50960
  // endpoint handlers that support aggregate-ui field batching
51091
- const batchHandlers = [
51092
- makeNetworkChunkFieldsGetRecord,
51093
- makeNetworkChunkFieldsGetRecordsBatch,
51094
- makeNetworkChunkFieldsGetRelatedListRecords,
51095
- makeNetworkChunkFieldsGetRelatedListRecordsBatch,
51096
- ];
50961
+ const batchHandlers = [makeNetworkChunkFieldsGetRecord, makeNetworkChunkFieldsGetRecordsBatch];
51097
50962
  return batchHandlers.reduce((network, handler) => {
51098
50963
  return handler(network, instrumentationSink);
51099
50964
  }, networkAdapter);
@@ -52107,14 +51972,10 @@ class NimbusSqliteStore {
52107
51972
  ...additionalTableMap,
52108
51973
  [DefaultDurableSegment]: new LdsDataTable(plugin),
52109
51974
  };
52110
- this.supportsBatchUpdates = plugin.supportsBatchUpdates !== undefined;
52111
51975
  }
52112
51976
  isEvalSupported() {
52113
51977
  return true;
52114
51978
  }
52115
- isBatchUpdateSupported() {
52116
- return this.supportsBatchUpdates;
52117
- }
52118
51979
  query(sql, params) {
52119
51980
  return new Promise((resolve, reject) => {
52120
51981
  this.plugin.query(sql, params, (result) => {
@@ -52150,16 +52011,7 @@ class NimbusSqliteStore {
52150
52011
  return Promise.resolve();
52151
52012
  }
52152
52013
  const table = this.getTable(segment);
52153
- let operation;
52154
- if (this.supportsBatchUpdates) {
52155
- operation = table.metadataToUpdateOperations(entries, segment);
52156
- }
52157
- else {
52158
- operation = table.entriesToUpsertOperations(entries, segment);
52159
- // manually set the context type on the upsert so notifications do not notify rebuilds without
52160
- // plugin updates
52161
- operation.context.type = 'setMetadata';
52162
- }
52014
+ let operation = table.metadataToUpdateOperations(entries, segment);
52163
52015
  return this.batchOperationAsPromise([operation]);
52164
52016
  }
52165
52017
  batchOperations(operations) {
@@ -52173,16 +52025,7 @@ class NimbusSqliteStore {
52173
52025
  else if (cur.type === 'setMetadata') {
52174
52026
  if (keys$1(cur.entries).length > 0) {
52175
52027
  const table = this.getTable(cur.segment);
52176
- if (this.supportsBatchUpdates) {
52177
- acc.push(table.metadataToUpdateOperations(cur.entries, cur.segment));
52178
- }
52179
- else {
52180
- const upsert = table.entriesToUpsertOperations(cur.entries, cur.segment);
52181
- // manually set the context type on the upsert so notifications do not notify rebuilds without
52182
- // plugin updates
52183
- upsert.context.type = 'setMetadata';
52184
- acc.push(upsert);
52185
- }
52028
+ acc.push(table.metadataToUpdateOperations(cur.entries, cur.segment));
52186
52029
  }
52187
52030
  }
52188
52031
  else {
@@ -55482,4 +55325,4 @@ register({
55482
55325
  });
55483
55326
 
55484
55327
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
55485
- // version: 1.332.0-dev3-2dc63dbba0
55328
+ // version: 1.332.0-fe34ef5c6f
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-mobile",
3
- "version": "1.332.0-dev3",
3
+ "version": "1.332.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,23 +32,23 @@
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.332.0-dev3",
36
- "@salesforce/lds-bindings": "^1.332.0-dev3",
37
- "@salesforce/lds-instrumentation": "^1.332.0-dev3",
35
+ "@salesforce/lds-adapters-uiapi": "^1.332.0",
36
+ "@salesforce/lds-bindings": "^1.332.0",
37
+ "@salesforce/lds-instrumentation": "^1.332.0",
38
38
  "@salesforce/user": "0.0.21",
39
39
  "o11y": "250.7.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@salesforce/lds-adapters-graphql": "^1.332.0-dev3",
43
- "@salesforce/lds-drafts": "^1.332.0-dev3",
44
- "@salesforce/lds-durable-records": "^1.332.0-dev3",
45
- "@salesforce/lds-network-adapter": "^1.332.0-dev3",
46
- "@salesforce/lds-network-nimbus": "^1.332.0-dev3",
47
- "@salesforce/lds-store-binary": "^1.332.0-dev3",
48
- "@salesforce/lds-store-nimbus": "^1.332.0-dev3",
49
- "@salesforce/lds-store-sql": "^1.332.0-dev3",
50
- "@salesforce/lds-utils-adapters": "^1.332.0-dev3",
51
- "@salesforce/nimbus-plugin-lds": "^1.332.0-dev3",
42
+ "@salesforce/lds-adapters-graphql": "^1.332.0",
43
+ "@salesforce/lds-drafts": "^1.332.0",
44
+ "@salesforce/lds-durable-records": "^1.332.0",
45
+ "@salesforce/lds-network-adapter": "^1.332.0",
46
+ "@salesforce/lds-network-nimbus": "^1.332.0",
47
+ "@salesforce/lds-store-binary": "^1.332.0",
48
+ "@salesforce/lds-store-nimbus": "^1.332.0",
49
+ "@salesforce/lds-store-sql": "^1.332.0",
50
+ "@salesforce/lds-utils-adapters": "^1.332.0",
51
+ "@salesforce/nimbus-plugin-lds": "^1.332.0",
52
52
  "babel-plugin-dynamic-import-node": "^2.3.3",
53
53
  "wait-for-expect": "^3.0.2"
54
54
  },
package/sfdc/main.js CHANGED
@@ -42867,16 +42867,12 @@ function isCreateContentDocumentAndVersionDraftAdapterEvent(customEvent) {
42867
42867
  /* global __nimbus */
42868
42868
  function chunkToBase64(chunk) {
42869
42869
  const bytes = new Uint8Array(chunk);
42870
- const CHUNK_SIZE = 64 * 1024; // 64kb, any bigger and fromCharCode() can error out with an overflow.
42871
- let binary = '';
42872
- for (let i = 0; i < bytes.length; i += CHUNK_SIZE) {
42873
- binary += String.fromCharCode(...bytes.subarray(i, i + CHUNK_SIZE));
42874
- }
42870
+ const binary = String.fromCharCode.apply(null, bytes);
42875
42871
  return btoa(binary);
42876
42872
  }
42877
42873
  async function streamBufferToBinaryStore(binaryStore, file, mimeType) {
42878
42874
  const uri = await binaryStore.createStream(mimeType);
42879
- const CHUNK_SIZE = 1024 * 1024 * 2; // 2mb
42875
+ const CHUNK_SIZE = 64 * 1024; // 64KB
42880
42876
  const fileSize = file.size;
42881
42877
  let offset = 0;
42882
42878
  try {
@@ -50897,7 +50893,7 @@ function calculateEstimatedTotalUrlLength(request) {
50897
50893
  }
50898
50894
 
50899
50895
  const RECORD_ENDPOINT_REGEX = /^\/ui-api\/records\/?(([a-zA-Z0-9]+))?$/;
50900
- const referenceId$3 = 'LDS_Records_AggregateUi';
50896
+ const referenceId$1 = 'LDS_Records_AggregateUi';
50901
50897
  /**
50902
50898
  * Export to facilitate unit tests
50903
50899
  * Merge the second getRecord result into the first one.
@@ -50925,7 +50921,7 @@ function makeNetworkChunkFieldsGetRecord(networkAdapter, instrumentationSink) {
50925
50921
  if (batchRequestInfo === undefined) {
50926
50922
  return networkAdapter(resourceRequest, resourceRequestContext);
50927
50923
  }
50928
- const compositeRequest = buildCompositeRequestByFields(referenceId$3, resourceRequest, batchRequestInfo);
50924
+ const compositeRequest = buildCompositeRequestByFields(referenceId$1, resourceRequest, batchRequestInfo);
50929
50925
  const aggregateRequest = createAggregateUiRequest(resourceRequest, compositeRequest);
50930
50926
  return networkAdapter(aggregateRequest, resourceRequestContext).then((response) => {
50931
50927
  return mergeAggregateUiResponse(response, mergeGetRecordResult);
@@ -50934,145 +50930,19 @@ function makeNetworkChunkFieldsGetRecord(networkAdapter, instrumentationSink) {
50934
50930
  }
50935
50931
 
50936
50932
  const RECORDS_BATCH_ENDPOINT_REGEX = /^\/ui-api\/records\/batch\/?(([a-zA-Z0-9|,]+))?$/;
50937
- const referenceId$2 = 'LDS_Records_Batch_AggregateUi';
50933
+ const referenceId = 'LDS_Records_Batch_AggregateUi';
50938
50934
  function makeNetworkChunkFieldsGetRecordsBatch(networkAdapter, intrumentationSink) {
50939
50935
  return (resourceRequest, resourceRequestContext) => {
50940
50936
  const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RECORDS_BATCH_ENDPOINT_REGEX, intrumentationSink);
50941
50937
  if (batchRequestInfo === undefined) {
50942
50938
  return networkAdapter(resourceRequest, resourceRequestContext);
50943
50939
  }
50944
- const compositeRequest = buildCompositeRequestByFields(referenceId$2, resourceRequest, batchRequestInfo);
50945
- const aggregateRequest = createAggregateUiRequest(resourceRequest, compositeRequest);
50946
- return networkAdapter(aggregateRequest, resourceRequestContext).then((response) => {
50947
- return mergeAggregateUiResponse(response, (first, second) => {
50948
- return mergeBatchRecordsFields(first, second, (a, b) => {
50949
- return mergeRecordFields(a, b);
50950
- });
50951
- });
50952
- });
50953
- };
50954
- }
50955
-
50956
- const RELATED_LIST_RECORDS_ENDPOINT_REGEX = /^\/ui-api\/related-list-records\/?(([a-zA-Z0-9]+))?\/?(([a-zA-Z0-9]+))?$/;
50957
- const referenceId$1 = 'LDS_Related_List_Records_AggregateUi';
50958
- const QUERY_KEY_FIELDS = 'fields';
50959
- const QUERY_KEY_OPTIONAL_FIELDS = 'optionalFields';
50960
- /**
50961
- * Merge the second related list record collection into first one and return it.
50962
- * It checks both collections should have exaction same records, otherwise error.
50963
- * Exports it for unit tests
50964
- */
50965
- function mergeRelatedRecordsFields(first, second) {
50966
- const { records: targetRecords } = first;
50967
- const { records: sourceRecords } = second;
50968
- if (sourceRecords.length === targetRecords.length &&
50969
- recordIdsAllMatch(targetRecords, sourceRecords)) {
50970
- first.fields = first.fields.concat(second.fields);
50971
- first.optionalFields = first.optionalFields.concat(second.optionalFields);
50972
- for (let i = 0, len = sourceRecords.length; i < len; i += 1) {
50973
- const targetRecord = targetRecords[i];
50974
- const sourceRecord = sourceRecords[i];
50975
- mergeRecordFields(targetRecord, sourceRecord);
50976
- }
50977
- mergePageUrls(first, second);
50978
- return first;
50979
- }
50980
- else {
50981
- // Throw error due to two collection are about different set of records
50982
- // eslint-disable-next-line @salesforce/lds/no-error-in-production
50983
- throw new Error('Aggregate UI response is invalid');
50984
- }
50985
- }
50986
- function makeNetworkChunkFieldsGetRelatedListRecords(networkAdapter, instrumentationSink) {
50987
- return (resourceRequest, resourceRequestContext) => {
50988
- const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RELATED_LIST_RECORDS_ENDPOINT_REGEX, instrumentationSink);
50989
- if (batchRequestInfo === undefined) {
50990
- return networkAdapter(resourceRequest, resourceRequestContext);
50991
- }
50992
- const compositeRequest = buildCompositeRequestByFields(referenceId$1, resourceRequest, batchRequestInfo);
50993
- const aggregateRequest = createAggregateUiRequest(resourceRequest, compositeRequest);
50994
- return networkAdapter(aggregateRequest, resourceRequestContext).then((response) => {
50995
- return mergeAggregateUiResponse(response, mergeRelatedRecordsFields);
50996
- });
50997
- };
50998
- }
50999
- /**
51000
- * merge the second related list record collection into first one and return it
51001
- */
51002
- function mergePageUrls(first, second) {
51003
- first.currentPageUrl = mergeUrl(first.currentPageUrl, second.currentPageUrl);
51004
- first.previousPageUrl = mergeUrl(first.previousPageUrl, second.previousPageUrl);
51005
- first.nextPageUrl = mergeUrl(first.nextPageUrl, second.nextPageUrl);
51006
- }
51007
- /**
51008
- * merge to paging url with different set of fields or optional fields as combined one
51009
- * the paging url is like
51010
- * /services/data/v63.0/ui-api/related-list-records/001R0000006l1xKIAQ/Contacts
51011
- * ?fields=Id%2CName&optionalFields=Contact.Id%2CContact.Name&pageSize=50&pageToken=0
51012
- * @param path1 url path and query parmeter without domain
51013
- * @param path2 url path and query parmeter without domain
51014
- *
51015
- * Export to unit test
51016
- */
51017
- function mergeUrl(path1, path2) {
51018
- if (path1 === null)
51019
- return path2;
51020
- if (path2 === null)
51021
- return path1;
51022
- // new Url(...) need the path1, path2 to be prefix-ed with this fake domain
51023
- const domain = 'http://c.com';
51024
- const url1 = new URL(domain + path1);
51025
- const url2 = new URL(domain + path2);
51026
- const searchParams1 = url1.searchParams;
51027
- const fields = mergeFields(url1, url2, QUERY_KEY_FIELDS);
51028
- if (fields && searchParams1.get(QUERY_KEY_FIELDS) !== fields) {
51029
- searchParams1.set(QUERY_KEY_FIELDS, fields);
51030
- }
51031
- const optionalFields = mergeFields(url1, url2, QUERY_KEY_OPTIONAL_FIELDS);
51032
- if (optionalFields && searchParams1.get(QUERY_KEY_OPTIONAL_FIELDS) !== optionalFields) {
51033
- searchParams1.set(QUERY_KEY_OPTIONAL_FIELDS, optionalFields);
51034
- }
51035
- from(searchParams1.keys())
51036
- .sort()
51037
- .forEach((key) => {
51038
- const value = searchParams1.get(key);
51039
- searchParams1.delete(key);
51040
- searchParams1.append(key, value);
51041
- });
51042
- return url1.toString().substr(domain.length);
51043
- }
51044
- function mergeFields(url1, url2, name) {
51045
- const fields1 = ScopedFieldsCollection.fromQueryParameterValue(url1.searchParams.get(name));
51046
- const fields2 = ScopedFieldsCollection.fromQueryParameterValue(url2.searchParams.get(name));
51047
- fields1.merge(fields2);
51048
- return fields1.toQueryParameterValue();
51049
- }
51050
- /**
51051
- * Checks that all records ids exist in both arrays
51052
- * @param first batch of first array or records
51053
- * @param second batch of second array or records
51054
- * @returns
51055
- */
51056
- function recordIdsAllMatch(first, second) {
51057
- const firstIds = first.map((record) => record.id);
51058
- const secondIds = second.map((record) => record.id);
51059
- return firstIds.every((id) => secondIds.includes(id));
51060
- }
51061
-
51062
- const RELATED_LIST_RECORDS_BATCH_ENDPOINT_REGEX = /^\/ui-api\/related-list-records\/batch\/?(([a-zA-Z0-9]+))?\//;
51063
- const referenceId = 'LDS_Related_List_Records_AggregateUi';
51064
- function makeNetworkChunkFieldsGetRelatedListRecordsBatch(networkAdapter, instrumentationSink) {
51065
- return (resourceRequest, resourceRequestContext) => {
51066
- const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RELATED_LIST_RECORDS_BATCH_ENDPOINT_REGEX, instrumentationSink);
51067
- if (batchRequestInfo === undefined) {
51068
- return networkAdapter(resourceRequest, resourceRequestContext);
51069
- }
51070
50940
  const compositeRequest = buildCompositeRequestByFields(referenceId, resourceRequest, batchRequestInfo);
51071
50941
  const aggregateRequest = createAggregateUiRequest(resourceRequest, compositeRequest);
51072
50942
  return networkAdapter(aggregateRequest, resourceRequestContext).then((response) => {
51073
50943
  return mergeAggregateUiResponse(response, (first, second) => {
51074
50944
  return mergeBatchRecordsFields(first, second, (a, b) => {
51075
- return mergeRelatedRecordsFields(a, b);
50945
+ return mergeRecordFields(a, b);
51076
50946
  });
51077
50947
  });
51078
50948
  });
@@ -51088,12 +50958,7 @@ function makeNetworkChunkFieldsGetRelatedListRecordsBatch(networkAdapter, instru
51088
50958
  */
51089
50959
  function makeNetworkAdapterChunkRecordFields(networkAdapter, instrumentationSink) {
51090
50960
  // endpoint handlers that support aggregate-ui field batching
51091
- const batchHandlers = [
51092
- makeNetworkChunkFieldsGetRecord,
51093
- makeNetworkChunkFieldsGetRecordsBatch,
51094
- makeNetworkChunkFieldsGetRelatedListRecords,
51095
- makeNetworkChunkFieldsGetRelatedListRecordsBatch,
51096
- ];
50961
+ const batchHandlers = [makeNetworkChunkFieldsGetRecord, makeNetworkChunkFieldsGetRecordsBatch];
51097
50962
  return batchHandlers.reduce((network, handler) => {
51098
50963
  return handler(network, instrumentationSink);
51099
50964
  }, networkAdapter);
@@ -52107,14 +51972,10 @@ class NimbusSqliteStore {
52107
51972
  ...additionalTableMap,
52108
51973
  [DefaultDurableSegment]: new LdsDataTable(plugin),
52109
51974
  };
52110
- this.supportsBatchUpdates = plugin.supportsBatchUpdates !== undefined;
52111
51975
  }
52112
51976
  isEvalSupported() {
52113
51977
  return true;
52114
51978
  }
52115
- isBatchUpdateSupported() {
52116
- return this.supportsBatchUpdates;
52117
- }
52118
51979
  query(sql, params) {
52119
51980
  return new Promise((resolve, reject) => {
52120
51981
  this.plugin.query(sql, params, (result) => {
@@ -52150,16 +52011,7 @@ class NimbusSqliteStore {
52150
52011
  return Promise.resolve();
52151
52012
  }
52152
52013
  const table = this.getTable(segment);
52153
- let operation;
52154
- if (this.supportsBatchUpdates) {
52155
- operation = table.metadataToUpdateOperations(entries, segment);
52156
- }
52157
- else {
52158
- operation = table.entriesToUpsertOperations(entries, segment);
52159
- // manually set the context type on the upsert so notifications do not notify rebuilds without
52160
- // plugin updates
52161
- operation.context.type = 'setMetadata';
52162
- }
52014
+ let operation = table.metadataToUpdateOperations(entries, segment);
52163
52015
  return this.batchOperationAsPromise([operation]);
52164
52016
  }
52165
52017
  batchOperations(operations) {
@@ -52173,16 +52025,7 @@ class NimbusSqliteStore {
52173
52025
  else if (cur.type === 'setMetadata') {
52174
52026
  if (keys$1(cur.entries).length > 0) {
52175
52027
  const table = this.getTable(cur.segment);
52176
- if (this.supportsBatchUpdates) {
52177
- acc.push(table.metadataToUpdateOperations(cur.entries, cur.segment));
52178
- }
52179
- else {
52180
- const upsert = table.entriesToUpsertOperations(cur.entries, cur.segment);
52181
- // manually set the context type on the upsert so notifications do not notify rebuilds without
52182
- // plugin updates
52183
- upsert.context.type = 'setMetadata';
52184
- acc.push(upsert);
52185
- }
52028
+ acc.push(table.metadataToUpdateOperations(cur.entries, cur.segment));
52186
52029
  }
52187
52030
  }
52188
52031
  else {
@@ -55482,4 +55325,4 @@ register({
55482
55325
  });
55483
55326
 
55484
55327
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
55485
- // version: 1.332.0-dev3-2dc63dbba0
55328
+ // version: 1.332.0-fe34ef5c6f