@salesforce/lds-worker-api 1.259.0 → 1.261.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.
@@ -1034,4 +1034,4 @@ if (process.env.NODE_ENV !== 'production') {
1034
1034
  }
1035
1035
 
1036
1036
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
1037
- // version: 1.259.0-921ca6033
1037
+ // version: 1.261.0-faaa0c74a
@@ -8,11 +8,13 @@ export declare const mockInstrumentation: {
8
8
  error: () => void;
9
9
  trackValue: (_operation: string, _value: number, _hasError?: boolean, _tags?: MetricsTags) => void;
10
10
  incrementCounter: (_operation: string, _increment?: number, _hasError?: boolean, _tags?: MetricsTags) => void;
11
+ bucketValue: (_operation: string, _value: number, _buckets: number[]) => void;
11
12
  };
12
13
  export declare const getInstrumentation: () => {
13
14
  startActivity: typeof startActivity;
14
15
  error: () => void;
15
16
  trackValue: (_operation: string, _value: number, _hasError?: boolean, _tags?: MetricsTags) => void;
16
17
  incrementCounter: (_operation: string, _increment?: number, _hasError?: boolean, _tags?: MetricsTags) => void;
18
+ bucketValue: (_operation: string, _value: number, _buckets: number[]) => void;
17
19
  };
18
20
  export {};
@@ -4129,7 +4129,7 @@ function withDefaultLuvio(callback) {
4129
4129
  }
4130
4130
  callbacks.push(callback);
4131
4131
  }
4132
- // version: 1.259.0-921ca6033
4132
+ // version: 1.261.0-faaa0c74a
4133
4133
 
4134
4134
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4135
4135
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15637,7 +15637,7 @@ function gql(literals, ...subs) {
15637
15637
  }
15638
15638
  return superResult;
15639
15639
  }
15640
- // version: 1.259.0-921ca6033
15640
+ // version: 1.261.0-faaa0c74a
15641
15641
 
15642
15642
  function unwrap(data) {
15643
15643
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16562,7 +16562,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
16562
16562
  const { apiFamily, name } = metadata;
16563
16563
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16564
16564
  }
16565
- // version: 1.259.0-921ca6033
16565
+ // version: 1.261.0-faaa0c74a
16566
16566
 
16567
16567
  /**
16568
16568
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -34898,7 +34898,7 @@ function createResourceRequest$s(config) {
34898
34898
 
34899
34899
  const adapterName$p = 'getRelatedListsCount';
34900
34900
  const getRelatedListsCount_ConfigPropertyMetadata = [
34901
- generateParamConfigMetadata$2('parentRecordId', true, 0 /* UrlParameter */, 0 /* String */),
34901
+ generateParamConfigMetadata$2('parentRecordId', true, 0 /* UrlParameter */, 0 /* String */, false, getRecordId18),
34902
34902
  generateParamConfigMetadata$2('relatedListNames', true, 0 /* UrlParameter */, 0 /* String */, true, getFieldApiNamesArray$2),
34903
34903
  generateParamConfigMetadata$2('maxCount', false, 1 /* QueryParameter */, 3 /* Integer */),
34904
34904
  ];
@@ -34984,7 +34984,7 @@ const getRelatedListsCountAdapterFactory = (luvio) => function UiApi__getRelated
34984
34984
 
34985
34985
  const adapterName$o = 'getRelatedListCount';
34986
34986
  const getRelatedListCount_ConfigPropertyMetadata = [
34987
- generateParamConfigMetadata$2('parentRecordId', true, 0 /* UrlParameter */, 0 /* String */),
34987
+ generateParamConfigMetadata$2('parentRecordId', true, 0 /* UrlParameter */, 0 /* String */, false, getRecordId18),
34988
34988
  generateParamConfigMetadata$2('relatedListId', true, 0 /* UrlParameter */, 0 /* String */),
34989
34989
  generateParamConfigMetadata$2('maxCount', false, 1 /* QueryParameter */, 3 /* Integer */),
34990
34990
  ];
@@ -35003,7 +35003,8 @@ function validateAdapterConfig$r(untrustedConfig, configPropertyNames) {
35003
35003
  if (!untrustedIsObject$2(untrustedConfig)) {
35004
35004
  return null;
35005
35005
  }
35006
- const config = typeCheckConfig$s(untrustedConfig);
35006
+ const coercedConfig = coerceConfig$1(untrustedConfig, getRelatedListCount_ConfigPropertyMetadata);
35007
+ const config = typeCheckConfig$s(coercedConfig);
35007
35008
  if (!areRequiredParametersPresent$1(config, configPropertyNames)) {
35008
35009
  return null;
35009
35010
  }
@@ -37607,7 +37608,7 @@ function createResourceRequest$j(config) {
37607
37608
 
37608
37609
  const adapterName$g = 'getRelatedListRecordsBatch';
37609
37610
  const getRelatedListRecordsBatch_ConfigPropertyMetadata = [
37610
- generateParamConfigMetadata$2('parentRecordId', true, 0 /* UrlParameter */, 0 /* String */),
37611
+ generateParamConfigMetadata$2('parentRecordId', true, 0 /* UrlParameter */, 0 /* String */, false, getRecordId18),
37611
37612
  generateParamConfigMetadata$2('relatedListParameters', true, 2 /* Body */, 4 /* Unsupported */, true),
37612
37613
  ];
37613
37614
  const getRelatedListRecordsBatch_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig$2(adapterName$g, getRelatedListRecordsBatch_ConfigPropertyMetadata);
@@ -37637,7 +37638,8 @@ function validateAdapterConfig$j(untrustedConfig, configPropertyNames) {
37637
37638
  if (!untrustedIsObject$2(untrustedConfig)) {
37638
37639
  return null;
37639
37640
  }
37640
- const config = typeCheckConfig$k(untrustedConfig);
37641
+ const coercedConfig = coerceConfig$1(untrustedConfig, getRelatedListRecordsBatch_ConfigPropertyMetadata);
37642
+ const config = typeCheckConfig$k(coercedConfig);
37641
37643
  if (!areRequiredParametersPresent$1(config, configPropertyNames)) {
37642
37644
  return null;
37643
37645
  }
@@ -37703,7 +37705,7 @@ const getRelatedListRecordsBatchAdapterFactory = (luvio) => function UiApi__getR
37703
37705
 
37704
37706
  const adapterName$f = 'getRelatedListRecords';
37705
37707
  const getRelatedListRecords_ConfigPropertyMetadata = [
37706
- generateParamConfigMetadata$2('parentRecordId', true, 0 /* UrlParameter */, 0 /* String */),
37708
+ generateParamConfigMetadata$2('parentRecordId', true, 0 /* UrlParameter */, 0 /* String */, false, getRecordId18),
37707
37709
  generateParamConfigMetadata$2('relatedListId', true, 0 /* UrlParameter */, 0 /* String */),
37708
37710
  generateParamConfigMetadata$2('fields', false, 2 /* Body */, 0 /* String */, true),
37709
37711
  generateParamConfigMetadata$2('optionalFields', false, 2 /* Body */, 0 /* String */, true),
@@ -37727,7 +37729,8 @@ function validateAdapterConfig$i(untrustedConfig, configPropertyNames) {
37727
37729
  if (!untrustedIsObject$2(untrustedConfig)) {
37728
37730
  return null;
37729
37731
  }
37730
- const config = typeCheckConfig$j(untrustedConfig);
37732
+ const coercedConfig = coerceConfig$1(untrustedConfig, getRelatedListRecords_ConfigPropertyMetadata);
37733
+ const config = typeCheckConfig$j(coercedConfig);
37731
37734
  if (!areRequiredParametersPresent$1(config, configPropertyNames)) {
37732
37735
  return null;
37733
37736
  }
@@ -42975,7 +42978,7 @@ withDefaultLuvio((luvio) => {
42975
42978
  throttle(60, 60000, createLDSAdapter(luvio, 'notifyListInfoUpdateAvailable', notifyUpdateAvailableFactory$1));
42976
42979
  throttle(60, 60000, createLDSAdapter(luvio, 'notifyQuickActionDefaultsUpdateAvailable', notifyUpdateAvailableFactory));
42977
42980
  });
42978
- // version: 1.259.0-54a7811b5
42981
+ // version: 1.261.0-10ee630e7
42979
42982
 
42980
42983
  var ldsIdempotencyWriteDisabled = {
42981
42984
  isOpen: function (e) {
@@ -42995,6 +42998,8 @@ var ldsBackdatingEnabled = {
42995
42998
  },
42996
42999
  };
42997
43000
 
43001
+ var FIRST_DAY_OF_WEEK = 0;
43002
+
42998
43003
  var caseSensitiveUserId = '005B0000000GR4OIAW';
42999
43004
 
43000
43005
  function requestIdleDetectedCallback(_callback) { }
@@ -43032,6 +43037,7 @@ const mockInstrumentation = {
43032
43037
  error: () => { },
43033
43038
  trackValue: (_operation, _value, _hasError, _tags) => { },
43034
43039
  incrementCounter: (_operation, _increment, _hasError, _tags) => { },
43040
+ bucketValue: (_operation, _value, _buckets) => { },
43035
43041
  };
43036
43042
  const getInstrumentation = () => {
43037
43043
  return mockInstrumentation;
@@ -50536,16 +50542,21 @@ var DateRange;
50536
50542
  (function (DateRange) {
50537
50543
  DateRange["last_n_days"] = "last_n_days";
50538
50544
  DateRange["next_n_days"] = "next_n_days";
50545
+ DateRange["n_days_ago"] = "n_days_ago";
50539
50546
  DateRange["last_n_weeks"] = "last_n_weeks";
50540
50547
  DateRange["next_n_weeks"] = "next_n_weeks";
50548
+ DateRange["n_weeks_ago"] = "n_weeks_ago";
50541
50549
  DateRange["last_n_months"] = "last_n_months";
50542
50550
  DateRange["next_n_months"] = "next_n_months";
50551
+ DateRange["n_months_ago"] = "n_months_ago";
50543
50552
  DateRange["last_n_quarters"] = "last_n_quarters";
50544
50553
  DateRange["next_n_quarters"] = "next_n_quarters";
50554
+ DateRange["n_quarters_ago"] = "n_quarters_ago";
50545
50555
  DateRange["last_n_fiscal_quarters"] = "last_n_fiscal_quarters";
50546
50556
  DateRange["next_n_fiscal_quarters"] = "next_n_fiscal_quarters";
50547
50557
  DateRange["last_n_years"] = "last_n_years";
50548
50558
  DateRange["next_n_years"] = "next_n_years";
50559
+ DateRange["n_years_ago"] = "n_years_ago";
50549
50560
  DateRange["last_n_fiscal_years"] = "last_n_fiscal_years";
50550
50561
  DateRange["next_n_fiscal_years"] = "next_n_fiscal_years";
50551
50562
  })(DateRange || (DateRange = {}));
@@ -50616,6 +50627,7 @@ function dateTimeRange(input, op, field, alias) {
50616
50627
  dataType: field.dataType,
50617
50628
  };
50618
50629
  }
50630
+ // relative date ranges defined at https://help.salesforce.com/s/articleView?id=sf.filter_dates_relative.htm&type=5
50619
50631
  function dateRangesFrom(dateRange, input, dateFunction) {
50620
50632
  // use 'start of day' to ensure the timestamp is 00:00:00 for date time values
50621
50633
  switch (dateRange) {
@@ -50645,7 +50657,86 @@ function dateRangesFrom(dateRange, input, dateFunction) {
50645
50657
  },
50646
50658
  };
50647
50659
  }
50648
- // next_n_months range starts the first day of the next month at 00:00:00 and ends end of the nth month 23:59:59
50660
+ // n_days_ago
50661
+ // starts 12:00:00 am -(n) days from today
50662
+ // ends 11:59:99 pm -(n) days from today
50663
+ case DateRange.n_days_ago: {
50664
+ return {
50665
+ binding: {
50666
+ upper: `${-input + 1} days`,
50667
+ lower: `-${input} days`,
50668
+ },
50669
+ range: {
50670
+ upper: `${dateFunction}('now', 'start of day', ?, '-1 seconds')`,
50671
+ lower: `${dateFunction}('now', 'start of day', ?)`,
50672
+ },
50673
+ };
50674
+ }
50675
+ // next_n_weeks
50676
+ // starts at 00:00:00 the first day of the week n weeks after the current week
50677
+ // ends 23:59:59 of the last day of week before the current
50678
+ case DateRange.next_n_weeks: {
50679
+ const isStartOfWeek = isTodayStartOfWeek();
50680
+ return {
50681
+ binding: {
50682
+ // weekday FIRST_DAY_OF_WEEK goes to the next weekday of FIRST_DAY_OF_WEEK if not that current day
50683
+ // if that current day then it will be that day
50684
+ // so for the upper bound if today is the start of the week we need to add 7 more days to the value to get next week as the start
50685
+ upper: `${input * 7 + (isStartOfWeek ? 7 : 0)} days`,
50686
+ //lower bound starts out 00:00:00 of next week
50687
+ lower: `${isStartOfWeek ? 7 : 0} days`,
50688
+ },
50689
+ range: {
50690
+ upper: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?, '-1 seconds')`,
50691
+ lower: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?)`,
50692
+ },
50693
+ };
50694
+ }
50695
+ // last_n_weeks
50696
+ // starts at 00:00:00 of day 0 n weeks before the current week
50697
+ // ends 23:59:59 at last day of the week before the current week
50698
+ case DateRange.last_n_weeks: {
50699
+ const isStartOfWeek = isTodayStartOfWeek();
50700
+ return {
50701
+ binding: {
50702
+ // ending on at 23:59:59 of the week before the current week
50703
+ // -7 more days if today not start of week
50704
+ upper: `${-(isStartOfWeek ? 0 : 7)} days`,
50705
+ // starting on 00:00:00 of n * weeks before current week
50706
+ // -7 more days if today not the start of the week because weekday FIRST_DAY_OF_WEEK puts us next week day 0
50707
+ lower: `${-input * 7 - (isStartOfWeek ? 0 : 7)} days`,
50708
+ },
50709
+ range: {
50710
+ upper: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?, '-1 seconds')`,
50711
+ lower: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?)`,
50712
+ },
50713
+ };
50714
+ }
50715
+ // n_weeks_ago
50716
+ // starts 00:00:00 on day 0 of n weeks before the current week
50717
+ // ends 7 days after the start
50718
+ case DateRange.n_weeks_ago: {
50719
+ const isStartOfWeek = isTodayStartOfWeek();
50720
+ return {
50721
+ binding: {
50722
+ // end of week n weeks before current week
50723
+ // if today is start of the week then we need to -7 from the days given by n
50724
+ // so add 7 to remove a week from -(n)
50725
+ upper: `${-input * 7 + (isStartOfWeek ? 7 : 0)} days`,
50726
+ // start of the week n weeks from the current week
50727
+ // if today is the start of the week then -(n) will do to be the previous week, but
50728
+ // if today is not the start of the week we need to go back 1 more week since weekday FIRST_DAY_OF_WEEK will put us next week
50729
+ lower: `${-input * 7 - (isStartOfWeek ? 0 : 7)} days`,
50730
+ },
50731
+ range: {
50732
+ upper: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?, '-1 seconds')`,
50733
+ lower: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?)`,
50734
+ },
50735
+ };
50736
+ }
50737
+ // next_n_months
50738
+ // starts the first day of the next month at 00:00:00 and
50739
+ // ends end of the nth month 23:59:59
50649
50740
  case DateRange.next_n_months: {
50650
50741
  return {
50651
50742
  binding: {
@@ -50658,7 +50749,8 @@ function dateRangesFrom(dateRange, input, dateFunction) {
50658
50749
  },
50659
50750
  };
50660
50751
  }
50661
- // last_n_months range starts at 00:00:00 first day of n months before the current month and
50752
+ // last_n_months
50753
+ // starts at 00:00:00 first day of n months before the current month and
50662
50754
  // ends at 23:59:59 the last day of the month before the current month
50663
50755
  case DateRange.last_n_months: {
50664
50756
  return {
@@ -50672,11 +50764,125 @@ function dateRangesFrom(dateRange, input, dateFunction) {
50672
50764
  },
50673
50765
  };
50674
50766
  }
50767
+ // n_months_ago
50768
+ // starts at the first day of the month 00:00:00 n months ago from now
50769
+ // ends at 23:59:59 of n months ago
50770
+ case DateRange.n_months_ago: {
50771
+ return {
50772
+ binding: {
50773
+ // need to go 1 less month back then -1 seconds to get the end of it
50774
+ upper: `${-input + 1} months`,
50775
+ lower: `-${input} months`,
50776
+ },
50777
+ range: {
50778
+ upper: `${dateFunction}('now', 'start of month', ?, '-1 seconds')`,
50779
+ lower: `${dateFunction}('now', 'start of month', ?)`,
50780
+ },
50781
+ };
50782
+ }
50783
+ // next_n_years
50784
+ // starts 00:00:00 Jan 1st the year after the current year
50785
+ // ends Dec 31 23:59:59 of the nth year
50786
+ case DateRange.next_n_years: {
50787
+ return {
50788
+ binding: {
50789
+ upper: `+${input + 1} years`,
50790
+ lower: `+1 year`,
50791
+ },
50792
+ range: {
50793
+ upper: `${dateFunction}('now', 'start of year', ?, '-1 seconds')`,
50794
+ lower: `${dateFunction}('now', 'start of year', ?)`,
50795
+ },
50796
+ };
50797
+ }
50798
+ // last_n_years starts
50799
+ // starts 00:00:00 Jan 1 n+1 year ago and
50800
+ // ends dec 31 23:59:59 of the year before the current
50801
+ case DateRange.last_n_years: {
50802
+ return {
50803
+ binding: {
50804
+ upper: `-1 seconds`,
50805
+ lower: `-${input + 1} years`,
50806
+ },
50807
+ range: {
50808
+ upper: `${dateFunction}('now', 'start of year', ?)`,
50809
+ lower: `${dateFunction}('now', 'start of year', ?)`,
50810
+ },
50811
+ };
50812
+ }
50813
+ // n_years_ago
50814
+ // starts 00:00:00 Jan 1 of n years before the current year and
50815
+ // ends Dec 31 23:59:59 of that year
50816
+ case DateRange.n_years_ago: {
50817
+ return {
50818
+ binding: {
50819
+ upper: `-${input - 1} years`,
50820
+ lower: `-${input} years`,
50821
+ },
50822
+ range: {
50823
+ upper: `${dateFunction}('now', 'start of year', ?, '-1 seconds')`,
50824
+ lower: `${dateFunction}('now', 'start of year', ?)`,
50825
+ },
50826
+ };
50827
+ }
50828
+ // next_n_quarters
50829
+ // starts 00:00:00 first day of the quarter after the current quarter
50830
+ // ends 23:59:59 of the last day of n quarters in the future
50831
+ case DateRange.next_n_quarters: {
50832
+ const currentQuarterString = quarterStart(new Date());
50833
+ return {
50834
+ binding: {
50835
+ // add another quarter input to -1 seconds to get the end of the last day of the quarter
50836
+ upper: `${(input + 1) * 3} months`,
50837
+ lower: `3 months`,
50838
+ },
50839
+ range: {
50840
+ upper: `${dateFunction}('${currentQuarterString}', 'start of day', ?, '-1 seconds')`,
50841
+ lower: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
50842
+ },
50843
+ };
50844
+ }
50845
+ // last_n_quarters
50846
+ // starts 00:00:00 the first day of n quarters ago
50847
+ // end 23:59:59 the last day of the quarter before the current quarter
50848
+ case DateRange.last_n_quarters: {
50849
+ const currentQuarterString = quarterStart(new Date());
50850
+ return {
50851
+ binding: {
50852
+ upper: `-1 seconds`,
50853
+ lower: `-${input * 3} months`,
50854
+ },
50855
+ range: {
50856
+ upper: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
50857
+ lower: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
50858
+ },
50859
+ };
50860
+ }
50861
+ // n_quarters_ago
50862
+ // starts 00:00:00 first day of the quarter n quarters before the current
50863
+ // ends 23:59:59 last day of the same quarter
50864
+ case DateRange.n_quarters_ago: {
50865
+ const currentQuarterString = quarterStart(new Date());
50866
+ return {
50867
+ binding: {
50868
+ // minus 1 quarter to be able to -1 seconds to get the end of the nth quarter
50869
+ upper: `-${(input - 1) * 3} months`,
50870
+ lower: `-${input * 3} months`,
50871
+ },
50872
+ range: {
50873
+ upper: `${dateFunction}('${currentQuarterString}', 'start of day', ?, '-1 seconds')`,
50874
+ lower: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
50875
+ },
50876
+ };
50877
+ }
50675
50878
  default:
50676
50879
  // eslint-disable-next-line @salesforce/lds/no-error-in-production
50677
50880
  throw new Error(`DateRangeInput ${dateRange} is not supported in local evalutation`);
50678
50881
  }
50679
50882
  }
50883
+ function isTodayStartOfWeek() {
50884
+ return new Date().getDay() === FIRST_DAY_OF_WEEK;
50885
+ }
50680
50886
 
50681
50887
  const JSON_EXTRACT_PATH_INGESTION_TIMESTAMP = '$.ingestionTimestamp';
50682
50888
  const JSON_EXTRACT_PATH_INGESTION_APINAME = '$.apiName';
@@ -57840,11 +58046,14 @@ function mergeBatchRecordsFields(first, second, collectionMergeFunc) {
57840
58046
  * @param endpoint Regular Expression to check the endpoint to aggregate
57841
58047
  * @returns undefined if we should not aggregate. object if we should.
57842
58048
  */
57843
- function createAggregateBatchRequestInfo(resourceRequest, endpoint) {
58049
+ function createAggregateBatchRequestInfo(resourceRequest, endpoint, instrumentationSink) {
57844
58050
  // only handle GETs on the given endpoint regex
57845
58051
  if (!isGetRequestForEndpoint(endpoint, resourceRequest)) {
57846
58052
  return undefined;
57847
58053
  }
58054
+ if (instrumentationSink) {
58055
+ instrumentationSink.reportChunkCandidateUrlLength(calculateEstimatedTotalUrlLength(resourceRequest));
58056
+ }
57848
58057
  const { queryParams: { fields, optionalFields }, } = resourceRequest;
57849
58058
  // only handle requests with fields or optional fields
57850
58059
  if (fields === undefined && optionalFields === undefined) {
@@ -57956,6 +58165,21 @@ function getMaxLengthPerChunkAllowed(request) {
57956
58165
  // MAX_URL_LENGTH - full lenght without fields, optionalFields
57957
58166
  return MAX_URL_LENGTH - roughUrlLengthWithoutFieldsAndOptionFields;
57958
58167
  }
58168
+ // we don't have access to the host so we cannot calculate the exact length of the url
58169
+ // so we will estimate it
58170
+ function calculateEstimatedTotalUrlLength(request) {
58171
+ const { baseUri, basePath, queryParams } = request;
58172
+ let url = `${baseUri}${basePath}`;
58173
+ if (queryParams) {
58174
+ const queryParamString = entries$2(queryParams)
58175
+ .map(([key, value]) => `${key}=${value}`)
58176
+ .join('&');
58177
+ if (queryParamString) {
58178
+ url += `?${queryParamString}`;
58179
+ }
58180
+ }
58181
+ return url.length;
58182
+ }
57959
58183
 
57960
58184
  const RECORD_ENDPOINT_REGEX = /^\/ui-api\/records\/?(([a-zA-Z0-9]+))?$/;
57961
58185
  const referenceId$3 = 'LDS_Records_AggregateUi';
@@ -57980,9 +58204,9 @@ function mergeGetRecordResult(first, second) {
57980
58204
  mergeRecordFields(first, second);
57981
58205
  return first;
57982
58206
  }
57983
- function makeNetworkChunkFieldsGetRecord(networkAdapter) {
58207
+ function makeNetworkChunkFieldsGetRecord(networkAdapter, instrumentationSink) {
57984
58208
  return (resourceRequest, resourceRequestContext) => {
57985
- const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RECORD_ENDPOINT_REGEX);
58209
+ const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RECORD_ENDPOINT_REGEX, instrumentationSink);
57986
58210
  if (batchRequestInfo === undefined) {
57987
58211
  return networkAdapter(resourceRequest, resourceRequestContext);
57988
58212
  }
@@ -57996,9 +58220,9 @@ function makeNetworkChunkFieldsGetRecord(networkAdapter) {
57996
58220
 
57997
58221
  const RECORDS_BATCH_ENDPOINT_REGEX = /^\/ui-api\/records\/batch\/?(([a-zA-Z0-9|,]+))?$/;
57998
58222
  const referenceId$2 = 'LDS_Records_Batch_AggregateUi';
57999
- function makeNetworkChunkFieldsGetRecordsBatch(networkAdapter) {
58223
+ function makeNetworkChunkFieldsGetRecordsBatch(networkAdapter, intrumentationSink) {
58000
58224
  return (resourceRequest, resourceRequestContext) => {
58001
- const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RECORDS_BATCH_ENDPOINT_REGEX);
58225
+ const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RECORDS_BATCH_ENDPOINT_REGEX, intrumentationSink);
58002
58226
  if (batchRequestInfo === undefined) {
58003
58227
  return networkAdapter(resourceRequest, resourceRequestContext);
58004
58228
  }
@@ -58044,9 +58268,9 @@ function mergeRelatedRecordsFields(first, second) {
58044
58268
  throw new Error('Aggregate UI response is invalid');
58045
58269
  }
58046
58270
  }
58047
- function makeNetworkChunkFieldsGetRelatedListRecords(networkAdapter) {
58271
+ function makeNetworkChunkFieldsGetRelatedListRecords(networkAdapter, instrumentationSink) {
58048
58272
  return (resourceRequest, resourceRequestContext) => {
58049
- const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RELATED_LIST_RECORDS_ENDPOINT_REGEX);
58273
+ const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RELATED_LIST_RECORDS_ENDPOINT_REGEX, instrumentationSink);
58050
58274
  if (batchRequestInfo === undefined) {
58051
58275
  return networkAdapter(resourceRequest, resourceRequestContext);
58052
58276
  }
@@ -58122,9 +58346,9 @@ function recordIdsAllMatch(first, second) {
58122
58346
 
58123
58347
  const RELATED_LIST_RECORDS_BATCH_ENDPOINT_REGEX = /^\/ui-api\/related-list-records\/batch\/?(([a-zA-Z0-9]+))?\//;
58124
58348
  const referenceId = 'LDS_Related_List_Records_AggregateUi';
58125
- function makeNetworkChunkFieldsGetRelatedListRecordsBatch(networkAdapter) {
58349
+ function makeNetworkChunkFieldsGetRelatedListRecordsBatch(networkAdapter, instrumentationSink) {
58126
58350
  return (resourceRequest, resourceRequestContext) => {
58127
- const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RELATED_LIST_RECORDS_BATCH_ENDPOINT_REGEX);
58351
+ const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RELATED_LIST_RECORDS_BATCH_ENDPOINT_REGEX, instrumentationSink);
58128
58352
  if (batchRequestInfo === undefined) {
58129
58353
  return networkAdapter(resourceRequest, resourceRequestContext);
58130
58354
  }
@@ -58147,7 +58371,7 @@ function makeNetworkChunkFieldsGetRelatedListRecordsBatch(networkAdapter) {
58147
58371
  *
58148
58372
  * @param networkAdapter the network adapter to do the call.
58149
58373
  */
58150
- function makeNetworkAdapterChunkRecordFields(networkAdapter) {
58374
+ function makeNetworkAdapterChunkRecordFields(networkAdapter, instrumentationSink) {
58151
58375
  // endpoint handlers that support aggregate-ui field batching
58152
58376
  const batchHandlers = [
58153
58377
  makeNetworkChunkFieldsGetRecord,
@@ -58156,7 +58380,7 @@ function makeNetworkAdapterChunkRecordFields(networkAdapter) {
58156
58380
  makeNetworkChunkFieldsGetRelatedListRecordsBatch,
58157
58381
  ];
58158
58382
  return batchHandlers.reduce((network, handler) => {
58159
- return handler(network);
58383
+ return handler(network, instrumentationSink);
58160
58384
  }, networkAdapter);
58161
58385
  }
58162
58386
 
@@ -58319,6 +58543,9 @@ function reportPrimingError(errorType, recordCount) {
58319
58543
  }
58320
58544
  function reportPrimingConflict(resolutionType, recordCount) {
58321
58545
  }
58546
+ /** Network */
58547
+ function reportChunkCandidateUrlLength(urlLength) {
58548
+ }
58322
58549
 
58323
58550
  /**
58324
58551
  * HOF (high-order-function) that instruments any async operation. If the operation
@@ -60501,7 +60728,9 @@ function getRuntime() {
60501
60728
  const { newRecordId, isGenerated } = recordIdGenerator(userId);
60502
60729
  // non-draft-aware base services
60503
60730
  const store = new InMemoryStore();
60504
- lazyNetworkAdapter = platformNetworkAdapter(makeNetworkAdapterChunkRecordFields(NimbusNetworkAdapter));
60731
+ lazyNetworkAdapter = platformNetworkAdapter(makeNetworkAdapterChunkRecordFields(NimbusNetworkAdapter, {
60732
+ reportChunkCandidateUrlLength: reportChunkCandidateUrlLength,
60733
+ }));
60505
60734
  lazyBaseDurableStore = getNimbusDurableStore();
60506
60735
  // specific adapters
60507
60736
  const internalAdapterStore = new InMemoryStore();
@@ -60627,7 +60856,7 @@ register$1({
60627
60856
  id: '@salesforce/lds-network-adapter',
60628
60857
  instrument: instrument$2,
60629
60858
  });
60630
- // version: 1.259.0-921ca6033
60859
+ // version: 1.261.0-faaa0c74a
60631
60860
 
60632
60861
  const { create: create$3, keys: keys$3 } = Object;
60633
60862
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -78956,7 +79185,7 @@ register$1({
78956
79185
  configuration: { ...configurationForGraphQLAdapters$1 },
78957
79186
  instrument: instrument$1,
78958
79187
  });
78959
- // version: 1.259.0-54a7811b5
79188
+ // version: 1.261.0-10ee630e7
78960
79189
 
78961
79190
  // On core the unstable adapters are re-exported with different names,
78962
79191
  // we want to match them here.
@@ -81207,7 +81436,7 @@ withDefaultLuvio((luvio) => {
81207
81436
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
81208
81437
  graphQLImperative = ldsAdapter;
81209
81438
  });
81210
- // version: 1.259.0-54a7811b5
81439
+ // version: 1.261.0-10ee630e7
81211
81440
 
81212
81441
  var gqlApi = /*#__PURE__*/Object.freeze({
81213
81442
  __proto__: null,
@@ -81905,7 +82134,7 @@ const callbacks$1 = [];
81905
82134
  function register(r) {
81906
82135
  callbacks$1.forEach((callback) => callback(r));
81907
82136
  }
81908
- // version: 1.259.0-921ca6033
82137
+ // version: 1.261.0-faaa0c74a
81909
82138
 
81910
82139
  /**
81911
82140
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -86810,4 +87039,4 @@ const { luvio } = getRuntime();
86810
87039
  setDefaultLuvio({ luvio });
86811
87040
 
86812
87041
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
86813
- // version: 1.259.0-921ca6033
87042
+ // version: 1.261.0-faaa0c74a
@@ -8,11 +8,13 @@ export declare const mockInstrumentation: {
8
8
  error: () => void;
9
9
  trackValue: (_operation: string, _value: number, _hasError?: boolean, _tags?: MetricsTags) => void;
10
10
  incrementCounter: (_operation: string, _increment?: number, _hasError?: boolean, _tags?: MetricsTags) => void;
11
+ bucketValue: (_operation: string, _value: number, _buckets: number[]) => void;
11
12
  };
12
13
  export declare const getInstrumentation: () => {
13
14
  startActivity: typeof startActivity;
14
15
  error: () => void;
15
16
  trackValue: (_operation: string, _value: number, _hasError?: boolean, _tags?: MetricsTags) => void;
16
17
  incrementCounter: (_operation: string, _increment?: number, _hasError?: boolean, _tags?: MetricsTags) => void;
18
+ bucketValue: (_operation: string, _value: number, _buckets: number[]) => void;
17
19
  };
18
20
  export {};
@@ -4135,7 +4135,7 @@
4135
4135
  }
4136
4136
  callbacks.push(callback);
4137
4137
  }
4138
- // version: 1.259.0-921ca6033
4138
+ // version: 1.261.0-faaa0c74a
4139
4139
 
4140
4140
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4141
4141
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15643,7 +15643,7 @@
15643
15643
  }
15644
15644
  return superResult;
15645
15645
  }
15646
- // version: 1.259.0-921ca6033
15646
+ // version: 1.261.0-faaa0c74a
15647
15647
 
15648
15648
  function unwrap(data) {
15649
15649
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16568,7 +16568,7 @@
16568
16568
  const { apiFamily, name } = metadata;
16569
16569
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16570
16570
  }
16571
- // version: 1.259.0-921ca6033
16571
+ // version: 1.261.0-faaa0c74a
16572
16572
 
16573
16573
  /**
16574
16574
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -34904,7 +34904,7 @@
34904
34904
 
34905
34905
  const adapterName$p = 'getRelatedListsCount';
34906
34906
  const getRelatedListsCount_ConfigPropertyMetadata = [
34907
- generateParamConfigMetadata$2('parentRecordId', true, 0 /* UrlParameter */, 0 /* String */),
34907
+ generateParamConfigMetadata$2('parentRecordId', true, 0 /* UrlParameter */, 0 /* String */, false, getRecordId18),
34908
34908
  generateParamConfigMetadata$2('relatedListNames', true, 0 /* UrlParameter */, 0 /* String */, true, getFieldApiNamesArray$2),
34909
34909
  generateParamConfigMetadata$2('maxCount', false, 1 /* QueryParameter */, 3 /* Integer */),
34910
34910
  ];
@@ -34990,7 +34990,7 @@
34990
34990
 
34991
34991
  const adapterName$o = 'getRelatedListCount';
34992
34992
  const getRelatedListCount_ConfigPropertyMetadata = [
34993
- generateParamConfigMetadata$2('parentRecordId', true, 0 /* UrlParameter */, 0 /* String */),
34993
+ generateParamConfigMetadata$2('parentRecordId', true, 0 /* UrlParameter */, 0 /* String */, false, getRecordId18),
34994
34994
  generateParamConfigMetadata$2('relatedListId', true, 0 /* UrlParameter */, 0 /* String */),
34995
34995
  generateParamConfigMetadata$2('maxCount', false, 1 /* QueryParameter */, 3 /* Integer */),
34996
34996
  ];
@@ -35009,7 +35009,8 @@
35009
35009
  if (!untrustedIsObject$2(untrustedConfig)) {
35010
35010
  return null;
35011
35011
  }
35012
- const config = typeCheckConfig$s(untrustedConfig);
35012
+ const coercedConfig = coerceConfig$1(untrustedConfig, getRelatedListCount_ConfigPropertyMetadata);
35013
+ const config = typeCheckConfig$s(coercedConfig);
35013
35014
  if (!areRequiredParametersPresent$1(config, configPropertyNames)) {
35014
35015
  return null;
35015
35016
  }
@@ -37613,7 +37614,7 @@
37613
37614
 
37614
37615
  const adapterName$g = 'getRelatedListRecordsBatch';
37615
37616
  const getRelatedListRecordsBatch_ConfigPropertyMetadata = [
37616
- generateParamConfigMetadata$2('parentRecordId', true, 0 /* UrlParameter */, 0 /* String */),
37617
+ generateParamConfigMetadata$2('parentRecordId', true, 0 /* UrlParameter */, 0 /* String */, false, getRecordId18),
37617
37618
  generateParamConfigMetadata$2('relatedListParameters', true, 2 /* Body */, 4 /* Unsupported */, true),
37618
37619
  ];
37619
37620
  const getRelatedListRecordsBatch_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig$2(adapterName$g, getRelatedListRecordsBatch_ConfigPropertyMetadata);
@@ -37643,7 +37644,8 @@
37643
37644
  if (!untrustedIsObject$2(untrustedConfig)) {
37644
37645
  return null;
37645
37646
  }
37646
- const config = typeCheckConfig$k(untrustedConfig);
37647
+ const coercedConfig = coerceConfig$1(untrustedConfig, getRelatedListRecordsBatch_ConfigPropertyMetadata);
37648
+ const config = typeCheckConfig$k(coercedConfig);
37647
37649
  if (!areRequiredParametersPresent$1(config, configPropertyNames)) {
37648
37650
  return null;
37649
37651
  }
@@ -37709,7 +37711,7 @@
37709
37711
 
37710
37712
  const adapterName$f = 'getRelatedListRecords';
37711
37713
  const getRelatedListRecords_ConfigPropertyMetadata = [
37712
- generateParamConfigMetadata$2('parentRecordId', true, 0 /* UrlParameter */, 0 /* String */),
37714
+ generateParamConfigMetadata$2('parentRecordId', true, 0 /* UrlParameter */, 0 /* String */, false, getRecordId18),
37713
37715
  generateParamConfigMetadata$2('relatedListId', true, 0 /* UrlParameter */, 0 /* String */),
37714
37716
  generateParamConfigMetadata$2('fields', false, 2 /* Body */, 0 /* String */, true),
37715
37717
  generateParamConfigMetadata$2('optionalFields', false, 2 /* Body */, 0 /* String */, true),
@@ -37733,7 +37735,8 @@
37733
37735
  if (!untrustedIsObject$2(untrustedConfig)) {
37734
37736
  return null;
37735
37737
  }
37736
- const config = typeCheckConfig$j(untrustedConfig);
37738
+ const coercedConfig = coerceConfig$1(untrustedConfig, getRelatedListRecords_ConfigPropertyMetadata);
37739
+ const config = typeCheckConfig$j(coercedConfig);
37737
37740
  if (!areRequiredParametersPresent$1(config, configPropertyNames)) {
37738
37741
  return null;
37739
37742
  }
@@ -42981,7 +42984,7 @@
42981
42984
  throttle(60, 60000, createLDSAdapter(luvio, 'notifyListInfoUpdateAvailable', notifyUpdateAvailableFactory$1));
42982
42985
  throttle(60, 60000, createLDSAdapter(luvio, 'notifyQuickActionDefaultsUpdateAvailable', notifyUpdateAvailableFactory));
42983
42986
  });
42984
- // version: 1.259.0-54a7811b5
42987
+ // version: 1.261.0-10ee630e7
42985
42988
 
42986
42989
  var ldsIdempotencyWriteDisabled = {
42987
42990
  isOpen: function (e) {
@@ -43001,6 +43004,8 @@
43001
43004
  },
43002
43005
  };
43003
43006
 
43007
+ var FIRST_DAY_OF_WEEK = 0;
43008
+
43004
43009
  var caseSensitiveUserId = '005B0000000GR4OIAW';
43005
43010
 
43006
43011
  function requestIdleDetectedCallback(_callback) { }
@@ -43038,6 +43043,7 @@
43038
43043
  error: () => { },
43039
43044
  trackValue: (_operation, _value, _hasError, _tags) => { },
43040
43045
  incrementCounter: (_operation, _increment, _hasError, _tags) => { },
43046
+ bucketValue: (_operation, _value, _buckets) => { },
43041
43047
  };
43042
43048
  const getInstrumentation = () => {
43043
43049
  return mockInstrumentation;
@@ -50542,16 +50548,21 @@
50542
50548
  (function (DateRange) {
50543
50549
  DateRange["last_n_days"] = "last_n_days";
50544
50550
  DateRange["next_n_days"] = "next_n_days";
50551
+ DateRange["n_days_ago"] = "n_days_ago";
50545
50552
  DateRange["last_n_weeks"] = "last_n_weeks";
50546
50553
  DateRange["next_n_weeks"] = "next_n_weeks";
50554
+ DateRange["n_weeks_ago"] = "n_weeks_ago";
50547
50555
  DateRange["last_n_months"] = "last_n_months";
50548
50556
  DateRange["next_n_months"] = "next_n_months";
50557
+ DateRange["n_months_ago"] = "n_months_ago";
50549
50558
  DateRange["last_n_quarters"] = "last_n_quarters";
50550
50559
  DateRange["next_n_quarters"] = "next_n_quarters";
50560
+ DateRange["n_quarters_ago"] = "n_quarters_ago";
50551
50561
  DateRange["last_n_fiscal_quarters"] = "last_n_fiscal_quarters";
50552
50562
  DateRange["next_n_fiscal_quarters"] = "next_n_fiscal_quarters";
50553
50563
  DateRange["last_n_years"] = "last_n_years";
50554
50564
  DateRange["next_n_years"] = "next_n_years";
50565
+ DateRange["n_years_ago"] = "n_years_ago";
50555
50566
  DateRange["last_n_fiscal_years"] = "last_n_fiscal_years";
50556
50567
  DateRange["next_n_fiscal_years"] = "next_n_fiscal_years";
50557
50568
  })(DateRange || (DateRange = {}));
@@ -50622,6 +50633,7 @@
50622
50633
  dataType: field.dataType,
50623
50634
  };
50624
50635
  }
50636
+ // relative date ranges defined at https://help.salesforce.com/s/articleView?id=sf.filter_dates_relative.htm&type=5
50625
50637
  function dateRangesFrom(dateRange, input, dateFunction) {
50626
50638
  // use 'start of day' to ensure the timestamp is 00:00:00 for date time values
50627
50639
  switch (dateRange) {
@@ -50651,7 +50663,86 @@
50651
50663
  },
50652
50664
  };
50653
50665
  }
50654
- // next_n_months range starts the first day of the next month at 00:00:00 and ends end of the nth month 23:59:59
50666
+ // n_days_ago
50667
+ // starts 12:00:00 am -(n) days from today
50668
+ // ends 11:59:99 pm -(n) days from today
50669
+ case DateRange.n_days_ago: {
50670
+ return {
50671
+ binding: {
50672
+ upper: `${-input + 1} days`,
50673
+ lower: `-${input} days`,
50674
+ },
50675
+ range: {
50676
+ upper: `${dateFunction}('now', 'start of day', ?, '-1 seconds')`,
50677
+ lower: `${dateFunction}('now', 'start of day', ?)`,
50678
+ },
50679
+ };
50680
+ }
50681
+ // next_n_weeks
50682
+ // starts at 00:00:00 the first day of the week n weeks after the current week
50683
+ // ends 23:59:59 of the last day of week before the current
50684
+ case DateRange.next_n_weeks: {
50685
+ const isStartOfWeek = isTodayStartOfWeek();
50686
+ return {
50687
+ binding: {
50688
+ // weekday FIRST_DAY_OF_WEEK goes to the next weekday of FIRST_DAY_OF_WEEK if not that current day
50689
+ // if that current day then it will be that day
50690
+ // so for the upper bound if today is the start of the week we need to add 7 more days to the value to get next week as the start
50691
+ upper: `${input * 7 + (isStartOfWeek ? 7 : 0)} days`,
50692
+ //lower bound starts out 00:00:00 of next week
50693
+ lower: `${isStartOfWeek ? 7 : 0} days`,
50694
+ },
50695
+ range: {
50696
+ upper: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?, '-1 seconds')`,
50697
+ lower: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?)`,
50698
+ },
50699
+ };
50700
+ }
50701
+ // last_n_weeks
50702
+ // starts at 00:00:00 of day 0 n weeks before the current week
50703
+ // ends 23:59:59 at last day of the week before the current week
50704
+ case DateRange.last_n_weeks: {
50705
+ const isStartOfWeek = isTodayStartOfWeek();
50706
+ return {
50707
+ binding: {
50708
+ // ending on at 23:59:59 of the week before the current week
50709
+ // -7 more days if today not start of week
50710
+ upper: `${-(isStartOfWeek ? 0 : 7)} days`,
50711
+ // starting on 00:00:00 of n * weeks before current week
50712
+ // -7 more days if today not the start of the week because weekday FIRST_DAY_OF_WEEK puts us next week day 0
50713
+ lower: `${-input * 7 - (isStartOfWeek ? 0 : 7)} days`,
50714
+ },
50715
+ range: {
50716
+ upper: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?, '-1 seconds')`,
50717
+ lower: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?)`,
50718
+ },
50719
+ };
50720
+ }
50721
+ // n_weeks_ago
50722
+ // starts 00:00:00 on day 0 of n weeks before the current week
50723
+ // ends 7 days after the start
50724
+ case DateRange.n_weeks_ago: {
50725
+ const isStartOfWeek = isTodayStartOfWeek();
50726
+ return {
50727
+ binding: {
50728
+ // end of week n weeks before current week
50729
+ // if today is start of the week then we need to -7 from the days given by n
50730
+ // so add 7 to remove a week from -(n)
50731
+ upper: `${-input * 7 + (isStartOfWeek ? 7 : 0)} days`,
50732
+ // start of the week n weeks from the current week
50733
+ // if today is the start of the week then -(n) will do to be the previous week, but
50734
+ // if today is not the start of the week we need to go back 1 more week since weekday FIRST_DAY_OF_WEEK will put us next week
50735
+ lower: `${-input * 7 - (isStartOfWeek ? 0 : 7)} days`,
50736
+ },
50737
+ range: {
50738
+ upper: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?, '-1 seconds')`,
50739
+ lower: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?)`,
50740
+ },
50741
+ };
50742
+ }
50743
+ // next_n_months
50744
+ // starts the first day of the next month at 00:00:00 and
50745
+ // ends end of the nth month 23:59:59
50655
50746
  case DateRange.next_n_months: {
50656
50747
  return {
50657
50748
  binding: {
@@ -50664,7 +50755,8 @@
50664
50755
  },
50665
50756
  };
50666
50757
  }
50667
- // last_n_months range starts at 00:00:00 first day of n months before the current month and
50758
+ // last_n_months
50759
+ // starts at 00:00:00 first day of n months before the current month and
50668
50760
  // ends at 23:59:59 the last day of the month before the current month
50669
50761
  case DateRange.last_n_months: {
50670
50762
  return {
@@ -50678,11 +50770,125 @@
50678
50770
  },
50679
50771
  };
50680
50772
  }
50773
+ // n_months_ago
50774
+ // starts at the first day of the month 00:00:00 n months ago from now
50775
+ // ends at 23:59:59 of n months ago
50776
+ case DateRange.n_months_ago: {
50777
+ return {
50778
+ binding: {
50779
+ // need to go 1 less month back then -1 seconds to get the end of it
50780
+ upper: `${-input + 1} months`,
50781
+ lower: `-${input} months`,
50782
+ },
50783
+ range: {
50784
+ upper: `${dateFunction}('now', 'start of month', ?, '-1 seconds')`,
50785
+ lower: `${dateFunction}('now', 'start of month', ?)`,
50786
+ },
50787
+ };
50788
+ }
50789
+ // next_n_years
50790
+ // starts 00:00:00 Jan 1st the year after the current year
50791
+ // ends Dec 31 23:59:59 of the nth year
50792
+ case DateRange.next_n_years: {
50793
+ return {
50794
+ binding: {
50795
+ upper: `+${input + 1} years`,
50796
+ lower: `+1 year`,
50797
+ },
50798
+ range: {
50799
+ upper: `${dateFunction}('now', 'start of year', ?, '-1 seconds')`,
50800
+ lower: `${dateFunction}('now', 'start of year', ?)`,
50801
+ },
50802
+ };
50803
+ }
50804
+ // last_n_years starts
50805
+ // starts 00:00:00 Jan 1 n+1 year ago and
50806
+ // ends dec 31 23:59:59 of the year before the current
50807
+ case DateRange.last_n_years: {
50808
+ return {
50809
+ binding: {
50810
+ upper: `-1 seconds`,
50811
+ lower: `-${input + 1} years`,
50812
+ },
50813
+ range: {
50814
+ upper: `${dateFunction}('now', 'start of year', ?)`,
50815
+ lower: `${dateFunction}('now', 'start of year', ?)`,
50816
+ },
50817
+ };
50818
+ }
50819
+ // n_years_ago
50820
+ // starts 00:00:00 Jan 1 of n years before the current year and
50821
+ // ends Dec 31 23:59:59 of that year
50822
+ case DateRange.n_years_ago: {
50823
+ return {
50824
+ binding: {
50825
+ upper: `-${input - 1} years`,
50826
+ lower: `-${input} years`,
50827
+ },
50828
+ range: {
50829
+ upper: `${dateFunction}('now', 'start of year', ?, '-1 seconds')`,
50830
+ lower: `${dateFunction}('now', 'start of year', ?)`,
50831
+ },
50832
+ };
50833
+ }
50834
+ // next_n_quarters
50835
+ // starts 00:00:00 first day of the quarter after the current quarter
50836
+ // ends 23:59:59 of the last day of n quarters in the future
50837
+ case DateRange.next_n_quarters: {
50838
+ const currentQuarterString = quarterStart(new Date());
50839
+ return {
50840
+ binding: {
50841
+ // add another quarter input to -1 seconds to get the end of the last day of the quarter
50842
+ upper: `${(input + 1) * 3} months`,
50843
+ lower: `3 months`,
50844
+ },
50845
+ range: {
50846
+ upper: `${dateFunction}('${currentQuarterString}', 'start of day', ?, '-1 seconds')`,
50847
+ lower: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
50848
+ },
50849
+ };
50850
+ }
50851
+ // last_n_quarters
50852
+ // starts 00:00:00 the first day of n quarters ago
50853
+ // end 23:59:59 the last day of the quarter before the current quarter
50854
+ case DateRange.last_n_quarters: {
50855
+ const currentQuarterString = quarterStart(new Date());
50856
+ return {
50857
+ binding: {
50858
+ upper: `-1 seconds`,
50859
+ lower: `-${input * 3} months`,
50860
+ },
50861
+ range: {
50862
+ upper: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
50863
+ lower: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
50864
+ },
50865
+ };
50866
+ }
50867
+ // n_quarters_ago
50868
+ // starts 00:00:00 first day of the quarter n quarters before the current
50869
+ // ends 23:59:59 last day of the same quarter
50870
+ case DateRange.n_quarters_ago: {
50871
+ const currentQuarterString = quarterStart(new Date());
50872
+ return {
50873
+ binding: {
50874
+ // minus 1 quarter to be able to -1 seconds to get the end of the nth quarter
50875
+ upper: `-${(input - 1) * 3} months`,
50876
+ lower: `-${input * 3} months`,
50877
+ },
50878
+ range: {
50879
+ upper: `${dateFunction}('${currentQuarterString}', 'start of day', ?, '-1 seconds')`,
50880
+ lower: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
50881
+ },
50882
+ };
50883
+ }
50681
50884
  default:
50682
50885
  // eslint-disable-next-line @salesforce/lds/no-error-in-production
50683
50886
  throw new Error(`DateRangeInput ${dateRange} is not supported in local evalutation`);
50684
50887
  }
50685
50888
  }
50889
+ function isTodayStartOfWeek() {
50890
+ return new Date().getDay() === FIRST_DAY_OF_WEEK;
50891
+ }
50686
50892
 
50687
50893
  const JSON_EXTRACT_PATH_INGESTION_TIMESTAMP = '$.ingestionTimestamp';
50688
50894
  const JSON_EXTRACT_PATH_INGESTION_APINAME = '$.apiName';
@@ -57846,11 +58052,14 @@
57846
58052
  * @param endpoint Regular Expression to check the endpoint to aggregate
57847
58053
  * @returns undefined if we should not aggregate. object if we should.
57848
58054
  */
57849
- function createAggregateBatchRequestInfo(resourceRequest, endpoint) {
58055
+ function createAggregateBatchRequestInfo(resourceRequest, endpoint, instrumentationSink) {
57850
58056
  // only handle GETs on the given endpoint regex
57851
58057
  if (!isGetRequestForEndpoint(endpoint, resourceRequest)) {
57852
58058
  return undefined;
57853
58059
  }
58060
+ if (instrumentationSink) {
58061
+ instrumentationSink.reportChunkCandidateUrlLength(calculateEstimatedTotalUrlLength(resourceRequest));
58062
+ }
57854
58063
  const { queryParams: { fields, optionalFields }, } = resourceRequest;
57855
58064
  // only handle requests with fields or optional fields
57856
58065
  if (fields === undefined && optionalFields === undefined) {
@@ -57962,6 +58171,21 @@
57962
58171
  // MAX_URL_LENGTH - full lenght without fields, optionalFields
57963
58172
  return MAX_URL_LENGTH - roughUrlLengthWithoutFieldsAndOptionFields;
57964
58173
  }
58174
+ // we don't have access to the host so we cannot calculate the exact length of the url
58175
+ // so we will estimate it
58176
+ function calculateEstimatedTotalUrlLength(request) {
58177
+ const { baseUri, basePath, queryParams } = request;
58178
+ let url = `${baseUri}${basePath}`;
58179
+ if (queryParams) {
58180
+ const queryParamString = entries$2(queryParams)
58181
+ .map(([key, value]) => `${key}=${value}`)
58182
+ .join('&');
58183
+ if (queryParamString) {
58184
+ url += `?${queryParamString}`;
58185
+ }
58186
+ }
58187
+ return url.length;
58188
+ }
57965
58189
 
57966
58190
  const RECORD_ENDPOINT_REGEX = /^\/ui-api\/records\/?(([a-zA-Z0-9]+))?$/;
57967
58191
  const referenceId$3 = 'LDS_Records_AggregateUi';
@@ -57986,9 +58210,9 @@
57986
58210
  mergeRecordFields(first, second);
57987
58211
  return first;
57988
58212
  }
57989
- function makeNetworkChunkFieldsGetRecord(networkAdapter) {
58213
+ function makeNetworkChunkFieldsGetRecord(networkAdapter, instrumentationSink) {
57990
58214
  return (resourceRequest, resourceRequestContext) => {
57991
- const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RECORD_ENDPOINT_REGEX);
58215
+ const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RECORD_ENDPOINT_REGEX, instrumentationSink);
57992
58216
  if (batchRequestInfo === undefined) {
57993
58217
  return networkAdapter(resourceRequest, resourceRequestContext);
57994
58218
  }
@@ -58002,9 +58226,9 @@
58002
58226
 
58003
58227
  const RECORDS_BATCH_ENDPOINT_REGEX = /^\/ui-api\/records\/batch\/?(([a-zA-Z0-9|,]+))?$/;
58004
58228
  const referenceId$2 = 'LDS_Records_Batch_AggregateUi';
58005
- function makeNetworkChunkFieldsGetRecordsBatch(networkAdapter) {
58229
+ function makeNetworkChunkFieldsGetRecordsBatch(networkAdapter, intrumentationSink) {
58006
58230
  return (resourceRequest, resourceRequestContext) => {
58007
- const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RECORDS_BATCH_ENDPOINT_REGEX);
58231
+ const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RECORDS_BATCH_ENDPOINT_REGEX, intrumentationSink);
58008
58232
  if (batchRequestInfo === undefined) {
58009
58233
  return networkAdapter(resourceRequest, resourceRequestContext);
58010
58234
  }
@@ -58050,9 +58274,9 @@
58050
58274
  throw new Error('Aggregate UI response is invalid');
58051
58275
  }
58052
58276
  }
58053
- function makeNetworkChunkFieldsGetRelatedListRecords(networkAdapter) {
58277
+ function makeNetworkChunkFieldsGetRelatedListRecords(networkAdapter, instrumentationSink) {
58054
58278
  return (resourceRequest, resourceRequestContext) => {
58055
- const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RELATED_LIST_RECORDS_ENDPOINT_REGEX);
58279
+ const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RELATED_LIST_RECORDS_ENDPOINT_REGEX, instrumentationSink);
58056
58280
  if (batchRequestInfo === undefined) {
58057
58281
  return networkAdapter(resourceRequest, resourceRequestContext);
58058
58282
  }
@@ -58128,9 +58352,9 @@
58128
58352
 
58129
58353
  const RELATED_LIST_RECORDS_BATCH_ENDPOINT_REGEX = /^\/ui-api\/related-list-records\/batch\/?(([a-zA-Z0-9]+))?\//;
58130
58354
  const referenceId = 'LDS_Related_List_Records_AggregateUi';
58131
- function makeNetworkChunkFieldsGetRelatedListRecordsBatch(networkAdapter) {
58355
+ function makeNetworkChunkFieldsGetRelatedListRecordsBatch(networkAdapter, instrumentationSink) {
58132
58356
  return (resourceRequest, resourceRequestContext) => {
58133
- const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RELATED_LIST_RECORDS_BATCH_ENDPOINT_REGEX);
58357
+ const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RELATED_LIST_RECORDS_BATCH_ENDPOINT_REGEX, instrumentationSink);
58134
58358
  if (batchRequestInfo === undefined) {
58135
58359
  return networkAdapter(resourceRequest, resourceRequestContext);
58136
58360
  }
@@ -58153,7 +58377,7 @@
58153
58377
  *
58154
58378
  * @param networkAdapter the network adapter to do the call.
58155
58379
  */
58156
- function makeNetworkAdapterChunkRecordFields(networkAdapter) {
58380
+ function makeNetworkAdapterChunkRecordFields(networkAdapter, instrumentationSink) {
58157
58381
  // endpoint handlers that support aggregate-ui field batching
58158
58382
  const batchHandlers = [
58159
58383
  makeNetworkChunkFieldsGetRecord,
@@ -58162,7 +58386,7 @@
58162
58386
  makeNetworkChunkFieldsGetRelatedListRecordsBatch,
58163
58387
  ];
58164
58388
  return batchHandlers.reduce((network, handler) => {
58165
- return handler(network);
58389
+ return handler(network, instrumentationSink);
58166
58390
  }, networkAdapter);
58167
58391
  }
58168
58392
 
@@ -58325,6 +58549,9 @@
58325
58549
  }
58326
58550
  function reportPrimingConflict(resolutionType, recordCount) {
58327
58551
  }
58552
+ /** Network */
58553
+ function reportChunkCandidateUrlLength(urlLength) {
58554
+ }
58328
58555
 
58329
58556
  /**
58330
58557
  * HOF (high-order-function) that instruments any async operation. If the operation
@@ -60507,7 +60734,9 @@
60507
60734
  const { newRecordId, isGenerated } = recordIdGenerator(userId);
60508
60735
  // non-draft-aware base services
60509
60736
  const store = new InMemoryStore();
60510
- lazyNetworkAdapter = platformNetworkAdapter(makeNetworkAdapterChunkRecordFields(NimbusNetworkAdapter));
60737
+ lazyNetworkAdapter = platformNetworkAdapter(makeNetworkAdapterChunkRecordFields(NimbusNetworkAdapter, {
60738
+ reportChunkCandidateUrlLength: reportChunkCandidateUrlLength,
60739
+ }));
60511
60740
  lazyBaseDurableStore = getNimbusDurableStore();
60512
60741
  // specific adapters
60513
60742
  const internalAdapterStore = new InMemoryStore();
@@ -60633,7 +60862,7 @@
60633
60862
  id: '@salesforce/lds-network-adapter',
60634
60863
  instrument: instrument$2,
60635
60864
  });
60636
- // version: 1.259.0-921ca6033
60865
+ // version: 1.261.0-faaa0c74a
60637
60866
 
60638
60867
  const { create: create$3, keys: keys$3 } = Object;
60639
60868
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -78962,7 +79191,7 @@
78962
79191
  configuration: { ...configurationForGraphQLAdapters$1 },
78963
79192
  instrument: instrument$1,
78964
79193
  });
78965
- // version: 1.259.0-54a7811b5
79194
+ // version: 1.261.0-10ee630e7
78966
79195
 
78967
79196
  // On core the unstable adapters are re-exported with different names,
78968
79197
  // we want to match them here.
@@ -81213,7 +81442,7 @@
81213
81442
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
81214
81443
  graphQLImperative = ldsAdapter;
81215
81444
  });
81216
- // version: 1.259.0-54a7811b5
81445
+ // version: 1.261.0-10ee630e7
81217
81446
 
81218
81447
  var gqlApi = /*#__PURE__*/Object.freeze({
81219
81448
  __proto__: null,
@@ -81911,7 +82140,7 @@
81911
82140
  function register(r) {
81912
82141
  callbacks$1.forEach((callback) => callback(r));
81913
82142
  }
81914
- // version: 1.259.0-921ca6033
82143
+ // version: 1.261.0-faaa0c74a
81915
82144
 
81916
82145
  /**
81917
82146
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -86834,4 +87063,4 @@
86834
87063
  exports.subscribeToAdapter = subscribeToAdapter;
86835
87064
 
86836
87065
  }));
86837
- // version: 1.259.0-921ca6033
87066
+ // version: 1.261.0-faaa0c74a
@@ -8,11 +8,13 @@ export declare const mockInstrumentation: {
8
8
  error: () => void;
9
9
  trackValue: (_operation: string, _value: number, _hasError?: boolean, _tags?: MetricsTags) => void;
10
10
  incrementCounter: (_operation: string, _increment?: number, _hasError?: boolean, _tags?: MetricsTags) => void;
11
+ bucketValue: (_operation: string, _value: number, _buckets: number[]) => void;
11
12
  };
12
13
  export declare const getInstrumentation: () => {
13
14
  startActivity: typeof startActivity;
14
15
  error: () => void;
15
16
  trackValue: (_operation: string, _value: number, _hasError?: boolean, _tags?: MetricsTags) => void;
16
17
  incrementCounter: (_operation: string, _increment?: number, _hasError?: boolean, _tags?: MetricsTags) => void;
18
+ bucketValue: (_operation: string, _value: number, _buckets: number[]) => void;
17
19
  };
18
20
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-worker-api",
3
- "version": "1.259.0",
3
+ "version": "1.261.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "",
6
6
  "main": "dist/standalone/es/lds-worker-api.js",
@@ -35,15 +35,15 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@oat-sa/rollup-plugin-wildcard-external": "^1.0.0",
38
- "@salesforce/lds-adapters-graphql": "^1.259.0",
39
- "@salesforce/lds-adapters-uiapi": "^1.259.0",
40
- "@salesforce/lds-default-luvio": "^1.259.0",
41
- "@salesforce/lds-drafts": "^1.259.0",
42
- "@salesforce/lds-graphql-parser": "^1.259.0",
43
- "@salesforce/lds-luvio-engine": "^1.259.0",
44
- "@salesforce/lds-priming": "^1.259.0",
45
- "@salesforce/lds-runtime-mobile": "^1.259.0",
46
- "@salesforce/nimbus-plugin-lds": "^1.259.0",
38
+ "@salesforce/lds-adapters-graphql": "^1.261.0",
39
+ "@salesforce/lds-adapters-uiapi": "^1.261.0",
40
+ "@salesforce/lds-default-luvio": "^1.261.0",
41
+ "@salesforce/lds-drafts": "^1.261.0",
42
+ "@salesforce/lds-graphql-parser": "^1.261.0",
43
+ "@salesforce/lds-luvio-engine": "^1.261.0",
44
+ "@salesforce/lds-priming": "^1.261.0",
45
+ "@salesforce/lds-runtime-mobile": "^1.261.0",
46
+ "@salesforce/nimbus-plugin-lds": "^1.261.0",
47
47
  "ajv": "^8.11.0",
48
48
  "glob": "^7.1.5",
49
49
  "nimbus-types": "^2.0.0-alpha1",