@salesforce/lds-worker-api 1.162.1 → 1.163.1

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.
@@ -770,4 +770,4 @@ if (process.env.NODE_ENV !== 'production') {
770
770
  }
771
771
 
772
772
  export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
773
- // version: 1.162.1-f025549da
773
+ // version: 1.163.1-a8f2dcd38
@@ -3799,7 +3799,7 @@ function withDefaultLuvio(callback) {
3799
3799
  }
3800
3800
  callbacks.push(callback);
3801
3801
  }
3802
- // version: 1.162.1-f025549da
3802
+ // version: 1.163.1-a8f2dcd38
3803
3803
 
3804
3804
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
3805
3805
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15232,7 +15232,7 @@ function parseAndVisit(source) {
15232
15232
  updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
15233
15233
  return luvioDocumentNode;
15234
15234
  }
15235
- // version: 1.162.1-f025549da
15235
+ // version: 1.163.1-a8f2dcd38
15236
15236
 
15237
15237
  function unwrap(data) {
15238
15238
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16145,7 +16145,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
16145
16145
  const { apiFamily, name } = metadata;
16146
16146
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16147
16147
  }
16148
- // version: 1.162.1-f025549da
16148
+ // version: 1.163.1-a8f2dcd38
16149
16149
 
16150
16150
  /**
16151
16151
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -44016,7 +44016,7 @@ withDefaultLuvio((luvio) => {
44016
44016
  dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
44017
44017
  });
44018
44018
  });
44019
- // version: 1.162.1-82da25cd1
44019
+ // version: 1.163.1-59506cdf6
44020
44020
 
44021
44021
  var caseSensitiveUserId = '005B0000000GR4OIAW';
44022
44022
 
@@ -44042,6 +44042,15 @@ const idleDetector = {
44042
44042
  declarePollableTaskMulti,
44043
44043
  };
44044
44044
 
44045
+ var ldsUseShortUrlGate = {
44046
+ isOpen: function (e) {
44047
+ return e.fallback;
44048
+ },
44049
+ hasError: function () {
44050
+ return !0;
44051
+ },
44052
+ };
44053
+
44045
44054
  var LOCALE = 'en-US';
44046
44055
 
44047
44056
  var CURRENCY = 'USD';
@@ -57773,6 +57782,10 @@ class ScopedFieldsCollection {
57773
57782
  }
57774
57783
 
57775
57784
  const MAX_STRING_LENGTH_PER_CHUNK = 10000;
57785
+ //Salesforce/Akamai cdn uri max size is 8898 bytes, short than normal. Per
57786
+ //https://help.salesforce.com/s/articleView?id=sf.community_builder_cdn_considerations.htm&type=5
57787
+ //Due to we don't know the domain ResourceRequest, here we give 8000
57788
+ const MAX_URL_LENGTH = 8000;
57776
57789
  const PARSE_ERROR = 'PARSE_AGGREGATE_UI_RESPONSE_ERROR';
57777
57790
  function isErrorResponse(response) {
57778
57791
  return response.httpStatusCode >= 400;
@@ -57851,8 +57864,8 @@ function buildAggregateUiUrl(params, resourceRequest) {
57851
57864
  }
57852
57865
  return `${resourceRequest.baseUri}${resourceRequest.basePath}?${join$1.call(queryString, '&')}`;
57853
57866
  }
57854
- function shouldUseAggregateUiForFields(fieldsArray, optionalFieldsArray) {
57855
- return fieldsArray.length + optionalFieldsArray.length >= MAX_STRING_LENGTH_PER_CHUNK;
57867
+ function shouldUseAggregateUiForFields(fieldsArray, optionalFieldsArray, maxLengthPerChunk) {
57868
+ return fieldsArray.length + optionalFieldsArray.length >= maxLengthPerChunk;
57856
57869
  }
57857
57870
  function isSpanningRecord(fieldValue) {
57858
57871
  return fieldValue !== null && typeof fieldValue === 'object';
@@ -57915,14 +57928,15 @@ function createAggregateBatchRequestInfo(resourceRequest, endpoint) {
57915
57928
  if (fieldsArray.length === 0 && optionalFieldsArray.length === 0) {
57916
57929
  return undefined;
57917
57930
  }
57931
+ const allowedMaxStringLengthPerChunk = getMaxLengthPerChunkAllowed(resourceRequest);
57918
57932
  const fieldsString = fieldsArray.join(',');
57919
57933
  const optionalFieldsString = optionalFieldsArray.join(',');
57920
- const shouldUseAggregate = shouldUseAggregateUiForFields(fieldsString, optionalFieldsString);
57934
+ const shouldUseAggregate = shouldUseAggregateUiForFields(fieldsString, optionalFieldsString, allowedMaxStringLengthPerChunk);
57921
57935
  if (!shouldUseAggregate) {
57922
57936
  return undefined;
57923
57937
  }
57924
- const fieldCollection = ScopedFieldsCollection.fromQueryParameterValue(fieldsString).split(MAX_STRING_LENGTH_PER_CHUNK);
57925
- const optionalFieldCollection = ScopedFieldsCollection.fromQueryParameterValue(optionalFieldsString).split(MAX_STRING_LENGTH_PER_CHUNK);
57938
+ const fieldCollection = ScopedFieldsCollection.fromQueryParameterValue(fieldsString).split(allowedMaxStringLengthPerChunk);
57939
+ const optionalFieldCollection = ScopedFieldsCollection.fromQueryParameterValue(optionalFieldsString).split(allowedMaxStringLengthPerChunk);
57926
57940
  return {
57927
57941
  fieldCollection,
57928
57942
  optionalFieldCollection,
@@ -57995,6 +58009,25 @@ function isGetRequestForEndpoint(endpoint, request) {
57995
58009
  function arrayOrEmpty(array) {
57996
58010
  return array !== undefined && isArray$6(array) ? array : [];
57997
58011
  }
58012
+ /**
58013
+ * Calculate the max lengh per chunk.
58014
+ * If useShortUrlGate is open, allow max chunk size is MAX_URL_LENGTH - the url without fields and optional fields in url.
58015
+ * Otherwise MAX_STRING_LENGTH_PER_CHUNK
58016
+ * @param resourceRequest
58017
+ * @returns
58018
+ */
58019
+ function getMaxLengthPerChunkAllowed(request) {
58020
+ if (!ldsUseShortUrlGate.isOpen({ fallback: false })) {
58021
+ return MAX_STRING_LENGTH_PER_CHUNK;
58022
+ }
58023
+ // Too much work to get exact length of the final url, so use stringified json to get the rough length.
58024
+ const roughUrlLengthWithoutFieldsAndOptionFields = request.basePath.length +
58025
+ request.baseUri.length +
58026
+ (request.urlParams ? stringify$1$1(request.urlParams).length : 0) +
58027
+ stringify$1$1({ ...request.queryParams, fields: {}, optionalFields: {} }).length;
58028
+ // MAX_URL_LENGTH - full lenght without fields, optionalFields
58029
+ return MAX_URL_LENGTH - roughUrlLengthWithoutFieldsAndOptionFields;
58030
+ }
57998
58031
 
57999
58032
  const RECORD_ENDPOINT_REGEX = /^\/ui-api\/records\/?(([a-zA-Z0-9]+))?$/;
58000
58033
  const referenceId$3 = 'LDS_Records_AggregateUi';
@@ -59178,10 +59211,11 @@ function makeEnvironmentGraphqlAware(environment) {
59178
59211
  if (eagerEvalStaleWhileRevalidate.isOpen({ fallback: false }) &&
59179
59212
  cachePolicy &&
59180
59213
  cachePolicy.type === 'stale-while-revalidate' &&
59181
- cachePolicy.staleDurationSeconds === Number.MAX_SAFE_INTEGER) {
59214
+ cachePolicy.staleDurationSeconds >= Number.MAX_SAFE_INTEGER) {
59182
59215
  localBuildCachedSnapshot = hoistUnfulfilledToStale;
59183
59216
  }
59184
- if (eagerEvalDefaultCachePolicy.isOpen({ fallback: false }) && cachePolicy === undefined) {
59217
+ if (eagerEvalDefaultCachePolicy.isOpen({ fallback: false }) &&
59218
+ (cachePolicy === undefined || cachePolicy === null)) {
59185
59219
  localBuildCachedSnapshot = hoistUnfulfilledToStale;
59186
59220
  }
59187
59221
  return environment.applyCachePolicy(luvio, adapterRequestContext, buildSnapshotContext, localBuildCachedSnapshot, buildNetworkSnapshot);
@@ -60072,7 +60106,7 @@ register({
60072
60106
  id: '@salesforce/lds-network-adapter',
60073
60107
  instrument: instrument$1,
60074
60108
  });
60075
- // version: 1.162.1-f025549da
60109
+ // version: 1.163.1-a8f2dcd38
60076
60110
 
60077
60111
  const { create: create$2, keys: keys$2 } = Object;
60078
60112
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -77554,7 +77588,7 @@ register({
77554
77588
  configuration: { ...configurationForGraphQLAdapters },
77555
77589
  instrument,
77556
77590
  });
77557
- // version: 1.162.1-82da25cd1
77591
+ // version: 1.163.1-59506cdf6
77558
77592
 
77559
77593
  // On core the unstable adapters are re-exported with different names,
77560
77594
 
@@ -79801,7 +79835,7 @@ withDefaultLuvio((luvio) => {
79801
79835
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
79802
79836
  graphQLImperative = ldsAdapter;
79803
79837
  });
79804
- // version: 1.162.1-82da25cd1
79838
+ // version: 1.163.1-59506cdf6
79805
79839
 
79806
79840
  var gqlApi = /*#__PURE__*/Object.freeze({
79807
79841
  __proto__: null,
@@ -80490,4 +80524,4 @@ const { luvio } = getRuntime();
80490
80524
  setDefaultLuvio({ luvio });
80491
80525
 
80492
80526
  export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
80493
- // version: 1.162.1-f025549da
80527
+ // version: 1.163.1-a8f2dcd38
@@ -3805,7 +3805,7 @@
3805
3805
  }
3806
3806
  callbacks.push(callback);
3807
3807
  }
3808
- // version: 1.162.1-f025549da
3808
+ // version: 1.163.1-a8f2dcd38
3809
3809
 
3810
3810
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
3811
3811
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15238,7 +15238,7 @@
15238
15238
  updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
15239
15239
  return luvioDocumentNode;
15240
15240
  }
15241
- // version: 1.162.1-f025549da
15241
+ // version: 1.163.1-a8f2dcd38
15242
15242
 
15243
15243
  function unwrap(data) {
15244
15244
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16151,7 +16151,7 @@
16151
16151
  const { apiFamily, name } = metadata;
16152
16152
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16153
16153
  }
16154
- // version: 1.162.1-f025549da
16154
+ // version: 1.163.1-a8f2dcd38
16155
16155
 
16156
16156
  /**
16157
16157
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -44022,7 +44022,7 @@
44022
44022
  dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
44023
44023
  });
44024
44024
  });
44025
- // version: 1.162.1-82da25cd1
44025
+ // version: 1.163.1-59506cdf6
44026
44026
 
44027
44027
  var caseSensitiveUserId = '005B0000000GR4OIAW';
44028
44028
 
@@ -44048,6 +44048,15 @@
44048
44048
  declarePollableTaskMulti,
44049
44049
  };
44050
44050
 
44051
+ var ldsUseShortUrlGate = {
44052
+ isOpen: function (e) {
44053
+ return e.fallback;
44054
+ },
44055
+ hasError: function () {
44056
+ return !0;
44057
+ },
44058
+ };
44059
+
44051
44060
  var LOCALE = 'en-US';
44052
44061
 
44053
44062
  var CURRENCY = 'USD';
@@ -57779,6 +57788,10 @@
57779
57788
  }
57780
57789
 
57781
57790
  const MAX_STRING_LENGTH_PER_CHUNK = 10000;
57791
+ //Salesforce/Akamai cdn uri max size is 8898 bytes, short than normal. Per
57792
+ //https://help.salesforce.com/s/articleView?id=sf.community_builder_cdn_considerations.htm&type=5
57793
+ //Due to we don't know the domain ResourceRequest, here we give 8000
57794
+ const MAX_URL_LENGTH = 8000;
57782
57795
  const PARSE_ERROR = 'PARSE_AGGREGATE_UI_RESPONSE_ERROR';
57783
57796
  function isErrorResponse(response) {
57784
57797
  return response.httpStatusCode >= 400;
@@ -57857,8 +57870,8 @@
57857
57870
  }
57858
57871
  return `${resourceRequest.baseUri}${resourceRequest.basePath}?${join$1.call(queryString, '&')}`;
57859
57872
  }
57860
- function shouldUseAggregateUiForFields(fieldsArray, optionalFieldsArray) {
57861
- return fieldsArray.length + optionalFieldsArray.length >= MAX_STRING_LENGTH_PER_CHUNK;
57873
+ function shouldUseAggregateUiForFields(fieldsArray, optionalFieldsArray, maxLengthPerChunk) {
57874
+ return fieldsArray.length + optionalFieldsArray.length >= maxLengthPerChunk;
57862
57875
  }
57863
57876
  function isSpanningRecord(fieldValue) {
57864
57877
  return fieldValue !== null && typeof fieldValue === 'object';
@@ -57921,14 +57934,15 @@
57921
57934
  if (fieldsArray.length === 0 && optionalFieldsArray.length === 0) {
57922
57935
  return undefined;
57923
57936
  }
57937
+ const allowedMaxStringLengthPerChunk = getMaxLengthPerChunkAllowed(resourceRequest);
57924
57938
  const fieldsString = fieldsArray.join(',');
57925
57939
  const optionalFieldsString = optionalFieldsArray.join(',');
57926
- const shouldUseAggregate = shouldUseAggregateUiForFields(fieldsString, optionalFieldsString);
57940
+ const shouldUseAggregate = shouldUseAggregateUiForFields(fieldsString, optionalFieldsString, allowedMaxStringLengthPerChunk);
57927
57941
  if (!shouldUseAggregate) {
57928
57942
  return undefined;
57929
57943
  }
57930
- const fieldCollection = ScopedFieldsCollection.fromQueryParameterValue(fieldsString).split(MAX_STRING_LENGTH_PER_CHUNK);
57931
- const optionalFieldCollection = ScopedFieldsCollection.fromQueryParameterValue(optionalFieldsString).split(MAX_STRING_LENGTH_PER_CHUNK);
57944
+ const fieldCollection = ScopedFieldsCollection.fromQueryParameterValue(fieldsString).split(allowedMaxStringLengthPerChunk);
57945
+ const optionalFieldCollection = ScopedFieldsCollection.fromQueryParameterValue(optionalFieldsString).split(allowedMaxStringLengthPerChunk);
57932
57946
  return {
57933
57947
  fieldCollection,
57934
57948
  optionalFieldCollection,
@@ -58001,6 +58015,25 @@
58001
58015
  function arrayOrEmpty(array) {
58002
58016
  return array !== undefined && isArray$6(array) ? array : [];
58003
58017
  }
58018
+ /**
58019
+ * Calculate the max lengh per chunk.
58020
+ * If useShortUrlGate is open, allow max chunk size is MAX_URL_LENGTH - the url without fields and optional fields in url.
58021
+ * Otherwise MAX_STRING_LENGTH_PER_CHUNK
58022
+ * @param resourceRequest
58023
+ * @returns
58024
+ */
58025
+ function getMaxLengthPerChunkAllowed(request) {
58026
+ if (!ldsUseShortUrlGate.isOpen({ fallback: false })) {
58027
+ return MAX_STRING_LENGTH_PER_CHUNK;
58028
+ }
58029
+ // Too much work to get exact length of the final url, so use stringified json to get the rough length.
58030
+ const roughUrlLengthWithoutFieldsAndOptionFields = request.basePath.length +
58031
+ request.baseUri.length +
58032
+ (request.urlParams ? stringify$1$1(request.urlParams).length : 0) +
58033
+ stringify$1$1({ ...request.queryParams, fields: {}, optionalFields: {} }).length;
58034
+ // MAX_URL_LENGTH - full lenght without fields, optionalFields
58035
+ return MAX_URL_LENGTH - roughUrlLengthWithoutFieldsAndOptionFields;
58036
+ }
58004
58037
 
58005
58038
  const RECORD_ENDPOINT_REGEX = /^\/ui-api\/records\/?(([a-zA-Z0-9]+))?$/;
58006
58039
  const referenceId$3 = 'LDS_Records_AggregateUi';
@@ -59184,10 +59217,11 @@
59184
59217
  if (eagerEvalStaleWhileRevalidate.isOpen({ fallback: false }) &&
59185
59218
  cachePolicy &&
59186
59219
  cachePolicy.type === 'stale-while-revalidate' &&
59187
- cachePolicy.staleDurationSeconds === Number.MAX_SAFE_INTEGER) {
59220
+ cachePolicy.staleDurationSeconds >= Number.MAX_SAFE_INTEGER) {
59188
59221
  localBuildCachedSnapshot = hoistUnfulfilledToStale;
59189
59222
  }
59190
- if (eagerEvalDefaultCachePolicy.isOpen({ fallback: false }) && cachePolicy === undefined) {
59223
+ if (eagerEvalDefaultCachePolicy.isOpen({ fallback: false }) &&
59224
+ (cachePolicy === undefined || cachePolicy === null)) {
59191
59225
  localBuildCachedSnapshot = hoistUnfulfilledToStale;
59192
59226
  }
59193
59227
  return environment.applyCachePolicy(luvio, adapterRequestContext, buildSnapshotContext, localBuildCachedSnapshot, buildNetworkSnapshot);
@@ -60078,7 +60112,7 @@
60078
60112
  id: '@salesforce/lds-network-adapter',
60079
60113
  instrument: instrument$1,
60080
60114
  });
60081
- // version: 1.162.1-f025549da
60115
+ // version: 1.163.1-a8f2dcd38
60082
60116
 
60083
60117
  const { create: create$2, keys: keys$2 } = Object;
60084
60118
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -77560,7 +77594,7 @@
77560
77594
  configuration: { ...configurationForGraphQLAdapters },
77561
77595
  instrument,
77562
77596
  });
77563
- // version: 1.162.1-82da25cd1
77597
+ // version: 1.163.1-59506cdf6
77564
77598
 
77565
77599
  // On core the unstable adapters are re-exported with different names,
77566
77600
 
@@ -79807,7 +79841,7 @@
79807
79841
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
79808
79842
  graphQLImperative = ldsAdapter;
79809
79843
  });
79810
- // version: 1.162.1-82da25cd1
79844
+ // version: 1.163.1-59506cdf6
79811
79845
 
79812
79846
  var gqlApi = /*#__PURE__*/Object.freeze({
79813
79847
  __proto__: null,
@@ -80513,4 +80547,4 @@
80513
80547
  Object.defineProperty(exports, '__esModule', { value: true });
80514
80548
 
80515
80549
  }));
80516
- // version: 1.162.1-f025549da
80550
+ // version: 1.163.1-a8f2dcd38
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-worker-api",
3
- "version": "1.162.1",
3
+ "version": "1.163.1",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "",
6
6
  "main": "dist/standalone/es/lds-worker-api.js",