@salesforce/lds-worker-api 1.259.0 → 1.260.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.260.0-95d02abca
@@ -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.260.0-95d02abca
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.260.0-95d02abca
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.260.0-95d02abca
16566
16566
 
16567
16567
  /**
16568
16568
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -42975,7 +42975,7 @@ withDefaultLuvio((luvio) => {
42975
42975
  throttle(60, 60000, createLDSAdapter(luvio, 'notifyListInfoUpdateAvailable', notifyUpdateAvailableFactory$1));
42976
42976
  throttle(60, 60000, createLDSAdapter(luvio, 'notifyQuickActionDefaultsUpdateAvailable', notifyUpdateAvailableFactory));
42977
42977
  });
42978
- // version: 1.259.0-54a7811b5
42978
+ // version: 1.260.0-7a5d1675a
42979
42979
 
42980
42980
  var ldsIdempotencyWriteDisabled = {
42981
42981
  isOpen: function (e) {
@@ -42995,6 +42995,8 @@ var ldsBackdatingEnabled = {
42995
42995
  },
42996
42996
  };
42997
42997
 
42998
+ var FIRST_DAY_OF_WEEK = 0;
42999
+
42998
43000
  var caseSensitiveUserId = '005B0000000GR4OIAW';
42999
43001
 
43000
43002
  function requestIdleDetectedCallback(_callback) { }
@@ -50536,16 +50538,21 @@ var DateRange;
50536
50538
  (function (DateRange) {
50537
50539
  DateRange["last_n_days"] = "last_n_days";
50538
50540
  DateRange["next_n_days"] = "next_n_days";
50541
+ DateRange["n_days_ago"] = "n_days_ago";
50539
50542
  DateRange["last_n_weeks"] = "last_n_weeks";
50540
50543
  DateRange["next_n_weeks"] = "next_n_weeks";
50544
+ DateRange["n_weeks_ago"] = "n_weeks_ago";
50541
50545
  DateRange["last_n_months"] = "last_n_months";
50542
50546
  DateRange["next_n_months"] = "next_n_months";
50547
+ DateRange["n_months_ago"] = "n_months_ago";
50543
50548
  DateRange["last_n_quarters"] = "last_n_quarters";
50544
50549
  DateRange["next_n_quarters"] = "next_n_quarters";
50550
+ DateRange["n_quarters_ago"] = "n_quarters_ago";
50545
50551
  DateRange["last_n_fiscal_quarters"] = "last_n_fiscal_quarters";
50546
50552
  DateRange["next_n_fiscal_quarters"] = "next_n_fiscal_quarters";
50547
50553
  DateRange["last_n_years"] = "last_n_years";
50548
50554
  DateRange["next_n_years"] = "next_n_years";
50555
+ DateRange["n_years_ago"] = "n_years_ago";
50549
50556
  DateRange["last_n_fiscal_years"] = "last_n_fiscal_years";
50550
50557
  DateRange["next_n_fiscal_years"] = "next_n_fiscal_years";
50551
50558
  })(DateRange || (DateRange = {}));
@@ -50616,6 +50623,7 @@ function dateTimeRange(input, op, field, alias) {
50616
50623
  dataType: field.dataType,
50617
50624
  };
50618
50625
  }
50626
+ // relative date ranges defined at https://help.salesforce.com/s/articleView?id=sf.filter_dates_relative.htm&type=5
50619
50627
  function dateRangesFrom(dateRange, input, dateFunction) {
50620
50628
  // use 'start of day' to ensure the timestamp is 00:00:00 for date time values
50621
50629
  switch (dateRange) {
@@ -50645,7 +50653,86 @@ function dateRangesFrom(dateRange, input, dateFunction) {
50645
50653
  },
50646
50654
  };
50647
50655
  }
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
50656
+ // n_days_ago
50657
+ // starts 12:00:00 am -(n) days from today
50658
+ // ends 11:59:99 pm -(n) days from today
50659
+ case DateRange.n_days_ago: {
50660
+ return {
50661
+ binding: {
50662
+ upper: `${-input + 1} days`,
50663
+ lower: `-${input} days`,
50664
+ },
50665
+ range: {
50666
+ upper: `${dateFunction}('now', 'start of day', ?, '-1 seconds')`,
50667
+ lower: `${dateFunction}('now', 'start of day', ?)`,
50668
+ },
50669
+ };
50670
+ }
50671
+ // next_n_weeks
50672
+ // starts at 00:00:00 the first day of the week n weeks after the current week
50673
+ // ends 23:59:59 of the last day of week before the current
50674
+ case DateRange.next_n_weeks: {
50675
+ const isStartOfWeek = isTodayStartOfWeek();
50676
+ return {
50677
+ binding: {
50678
+ // weekday FIRST_DAY_OF_WEEK goes to the next weekday of FIRST_DAY_OF_WEEK if not that current day
50679
+ // if that current day then it will be that day
50680
+ // 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
50681
+ upper: `${input * 7 + (isStartOfWeek ? 7 : 0)} days`,
50682
+ //lower bound starts out 00:00:00 of next week
50683
+ lower: `${isStartOfWeek ? 7 : 0} days`,
50684
+ },
50685
+ range: {
50686
+ upper: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?, '-1 seconds')`,
50687
+ lower: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?)`,
50688
+ },
50689
+ };
50690
+ }
50691
+ // last_n_weeks
50692
+ // starts at 00:00:00 of day 0 n weeks before the current week
50693
+ // ends 23:59:59 at last day of the week before the current week
50694
+ case DateRange.last_n_weeks: {
50695
+ const isStartOfWeek = isTodayStartOfWeek();
50696
+ return {
50697
+ binding: {
50698
+ // ending on at 23:59:59 of the week before the current week
50699
+ // -7 more days if today not start of week
50700
+ upper: `${-(isStartOfWeek ? 0 : 7)} days`,
50701
+ // starting on 00:00:00 of n * weeks before current week
50702
+ // -7 more days if today not the start of the week because weekday FIRST_DAY_OF_WEEK puts us next week day 0
50703
+ lower: `${-input * 7 - (isStartOfWeek ? 0 : 7)} days`,
50704
+ },
50705
+ range: {
50706
+ upper: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?, '-1 seconds')`,
50707
+ lower: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?)`,
50708
+ },
50709
+ };
50710
+ }
50711
+ // n_weeks_ago
50712
+ // starts 00:00:00 on day 0 of n weeks before the current week
50713
+ // ends 7 days after the start
50714
+ case DateRange.n_weeks_ago: {
50715
+ const isStartOfWeek = isTodayStartOfWeek();
50716
+ return {
50717
+ binding: {
50718
+ // end of week n weeks before current week
50719
+ // if today is start of the week then we need to -7 from the days given by n
50720
+ // so add 7 to remove a week from -(n)
50721
+ upper: `${-input * 7 + (isStartOfWeek ? 7 : 0)} days`,
50722
+ // start of the week n weeks from the current week
50723
+ // if today is the start of the week then -(n) will do to be the previous week, but
50724
+ // 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
50725
+ lower: `${-input * 7 - (isStartOfWeek ? 0 : 7)} days`,
50726
+ },
50727
+ range: {
50728
+ upper: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?, '-1 seconds')`,
50729
+ lower: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?)`,
50730
+ },
50731
+ };
50732
+ }
50733
+ // next_n_months
50734
+ // starts the first day of the next month at 00:00:00 and
50735
+ // ends end of the nth month 23:59:59
50649
50736
  case DateRange.next_n_months: {
50650
50737
  return {
50651
50738
  binding: {
@@ -50658,7 +50745,8 @@ function dateRangesFrom(dateRange, input, dateFunction) {
50658
50745
  },
50659
50746
  };
50660
50747
  }
50661
- // last_n_months range starts at 00:00:00 first day of n months before the current month and
50748
+ // last_n_months
50749
+ // starts at 00:00:00 first day of n months before the current month and
50662
50750
  // ends at 23:59:59 the last day of the month before the current month
50663
50751
  case DateRange.last_n_months: {
50664
50752
  return {
@@ -50672,11 +50760,125 @@ function dateRangesFrom(dateRange, input, dateFunction) {
50672
50760
  },
50673
50761
  };
50674
50762
  }
50763
+ // n_months_ago
50764
+ // starts at the first day of the month 00:00:00 n months ago from now
50765
+ // ends at 23:59:59 of n months ago
50766
+ case DateRange.n_months_ago: {
50767
+ return {
50768
+ binding: {
50769
+ // need to go 1 less month back then -1 seconds to get the end of it
50770
+ upper: `${-input + 1} months`,
50771
+ lower: `-${input} months`,
50772
+ },
50773
+ range: {
50774
+ upper: `${dateFunction}('now', 'start of month', ?, '-1 seconds')`,
50775
+ lower: `${dateFunction}('now', 'start of month', ?)`,
50776
+ },
50777
+ };
50778
+ }
50779
+ // next_n_years
50780
+ // starts 00:00:00 Jan 1st the year after the current year
50781
+ // ends Dec 31 23:59:59 of the nth year
50782
+ case DateRange.next_n_years: {
50783
+ return {
50784
+ binding: {
50785
+ upper: `+${input + 1} years`,
50786
+ lower: `+1 year`,
50787
+ },
50788
+ range: {
50789
+ upper: `${dateFunction}('now', 'start of year', ?, '-1 seconds')`,
50790
+ lower: `${dateFunction}('now', 'start of year', ?)`,
50791
+ },
50792
+ };
50793
+ }
50794
+ // last_n_years starts
50795
+ // starts 00:00:00 Jan 1 n+1 year ago and
50796
+ // ends dec 31 23:59:59 of the year before the current
50797
+ case DateRange.last_n_years: {
50798
+ return {
50799
+ binding: {
50800
+ upper: `-1 seconds`,
50801
+ lower: `-${input + 1} years`,
50802
+ },
50803
+ range: {
50804
+ upper: `${dateFunction}('now', 'start of year', ?)`,
50805
+ lower: `${dateFunction}('now', 'start of year', ?)`,
50806
+ },
50807
+ };
50808
+ }
50809
+ // n_years_ago
50810
+ // starts 00:00:00 Jan 1 of n years before the current year and
50811
+ // ends Dec 31 23:59:59 of that year
50812
+ case DateRange.n_years_ago: {
50813
+ return {
50814
+ binding: {
50815
+ upper: `-${input - 1} years`,
50816
+ lower: `-${input} years`,
50817
+ },
50818
+ range: {
50819
+ upper: `${dateFunction}('now', 'start of year', ?, '-1 seconds')`,
50820
+ lower: `${dateFunction}('now', 'start of year', ?)`,
50821
+ },
50822
+ };
50823
+ }
50824
+ // next_n_quarters
50825
+ // starts 00:00:00 first day of the quarter after the current quarter
50826
+ // ends 23:59:59 of the last day of n quarters in the future
50827
+ case DateRange.next_n_quarters: {
50828
+ const currentQuarterString = quarterStart(new Date());
50829
+ return {
50830
+ binding: {
50831
+ // add another quarter input to -1 seconds to get the end of the last day of the quarter
50832
+ upper: `${(input + 1) * 3} months`,
50833
+ lower: `3 months`,
50834
+ },
50835
+ range: {
50836
+ upper: `${dateFunction}('${currentQuarterString}', 'start of day', ?, '-1 seconds')`,
50837
+ lower: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
50838
+ },
50839
+ };
50840
+ }
50841
+ // last_n_quarters
50842
+ // starts 00:00:00 the first day of n quarters ago
50843
+ // end 23:59:59 the last day of the quarter before the current quarter
50844
+ case DateRange.last_n_quarters: {
50845
+ const currentQuarterString = quarterStart(new Date());
50846
+ return {
50847
+ binding: {
50848
+ upper: `-1 seconds`,
50849
+ lower: `-${input * 3} months`,
50850
+ },
50851
+ range: {
50852
+ upper: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
50853
+ lower: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
50854
+ },
50855
+ };
50856
+ }
50857
+ // n_quarters_ago
50858
+ // starts 00:00:00 first day of the quarter n quarters before the current
50859
+ // ends 23:59:59 last day of the same quarter
50860
+ case DateRange.n_quarters_ago: {
50861
+ const currentQuarterString = quarterStart(new Date());
50862
+ return {
50863
+ binding: {
50864
+ // minus 1 quarter to be able to -1 seconds to get the end of the nth quarter
50865
+ upper: `-${(input - 1) * 3} months`,
50866
+ lower: `-${input * 3} months`,
50867
+ },
50868
+ range: {
50869
+ upper: `${dateFunction}('${currentQuarterString}', 'start of day', ?, '-1 seconds')`,
50870
+ lower: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
50871
+ },
50872
+ };
50873
+ }
50675
50874
  default:
50676
50875
  // eslint-disable-next-line @salesforce/lds/no-error-in-production
50677
50876
  throw new Error(`DateRangeInput ${dateRange} is not supported in local evalutation`);
50678
50877
  }
50679
50878
  }
50879
+ function isTodayStartOfWeek() {
50880
+ return new Date().getDay() === FIRST_DAY_OF_WEEK;
50881
+ }
50680
50882
 
50681
50883
  const JSON_EXTRACT_PATH_INGESTION_TIMESTAMP = '$.ingestionTimestamp';
50682
50884
  const JSON_EXTRACT_PATH_INGESTION_APINAME = '$.apiName';
@@ -60627,7 +60829,7 @@ register$1({
60627
60829
  id: '@salesforce/lds-network-adapter',
60628
60830
  instrument: instrument$2,
60629
60831
  });
60630
- // version: 1.259.0-921ca6033
60832
+ // version: 1.260.0-95d02abca
60631
60833
 
60632
60834
  const { create: create$3, keys: keys$3 } = Object;
60633
60835
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -78956,7 +79158,7 @@ register$1({
78956
79158
  configuration: { ...configurationForGraphQLAdapters$1 },
78957
79159
  instrument: instrument$1,
78958
79160
  });
78959
- // version: 1.259.0-54a7811b5
79161
+ // version: 1.260.0-7a5d1675a
78960
79162
 
78961
79163
  // On core the unstable adapters are re-exported with different names,
78962
79164
  // we want to match them here.
@@ -81207,7 +81409,7 @@ withDefaultLuvio((luvio) => {
81207
81409
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
81208
81410
  graphQLImperative = ldsAdapter;
81209
81411
  });
81210
- // version: 1.259.0-54a7811b5
81412
+ // version: 1.260.0-7a5d1675a
81211
81413
 
81212
81414
  var gqlApi = /*#__PURE__*/Object.freeze({
81213
81415
  __proto__: null,
@@ -81905,7 +82107,7 @@ const callbacks$1 = [];
81905
82107
  function register(r) {
81906
82108
  callbacks$1.forEach((callback) => callback(r));
81907
82109
  }
81908
- // version: 1.259.0-921ca6033
82110
+ // version: 1.260.0-95d02abca
81909
82111
 
81910
82112
  /**
81911
82113
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -86810,4 +87012,4 @@ const { luvio } = getRuntime();
86810
87012
  setDefaultLuvio({ luvio });
86811
87013
 
86812
87014
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
86813
- // version: 1.259.0-921ca6033
87015
+ // version: 1.260.0-95d02abca
@@ -4135,7 +4135,7 @@
4135
4135
  }
4136
4136
  callbacks.push(callback);
4137
4137
  }
4138
- // version: 1.259.0-921ca6033
4138
+ // version: 1.260.0-95d02abca
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.260.0-95d02abca
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.260.0-95d02abca
16572
16572
 
16573
16573
  /**
16574
16574
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -42981,7 +42981,7 @@
42981
42981
  throttle(60, 60000, createLDSAdapter(luvio, 'notifyListInfoUpdateAvailable', notifyUpdateAvailableFactory$1));
42982
42982
  throttle(60, 60000, createLDSAdapter(luvio, 'notifyQuickActionDefaultsUpdateAvailable', notifyUpdateAvailableFactory));
42983
42983
  });
42984
- // version: 1.259.0-54a7811b5
42984
+ // version: 1.260.0-7a5d1675a
42985
42985
 
42986
42986
  var ldsIdempotencyWriteDisabled = {
42987
42987
  isOpen: function (e) {
@@ -43001,6 +43001,8 @@
43001
43001
  },
43002
43002
  };
43003
43003
 
43004
+ var FIRST_DAY_OF_WEEK = 0;
43005
+
43004
43006
  var caseSensitiveUserId = '005B0000000GR4OIAW';
43005
43007
 
43006
43008
  function requestIdleDetectedCallback(_callback) { }
@@ -50542,16 +50544,21 @@
50542
50544
  (function (DateRange) {
50543
50545
  DateRange["last_n_days"] = "last_n_days";
50544
50546
  DateRange["next_n_days"] = "next_n_days";
50547
+ DateRange["n_days_ago"] = "n_days_ago";
50545
50548
  DateRange["last_n_weeks"] = "last_n_weeks";
50546
50549
  DateRange["next_n_weeks"] = "next_n_weeks";
50550
+ DateRange["n_weeks_ago"] = "n_weeks_ago";
50547
50551
  DateRange["last_n_months"] = "last_n_months";
50548
50552
  DateRange["next_n_months"] = "next_n_months";
50553
+ DateRange["n_months_ago"] = "n_months_ago";
50549
50554
  DateRange["last_n_quarters"] = "last_n_quarters";
50550
50555
  DateRange["next_n_quarters"] = "next_n_quarters";
50556
+ DateRange["n_quarters_ago"] = "n_quarters_ago";
50551
50557
  DateRange["last_n_fiscal_quarters"] = "last_n_fiscal_quarters";
50552
50558
  DateRange["next_n_fiscal_quarters"] = "next_n_fiscal_quarters";
50553
50559
  DateRange["last_n_years"] = "last_n_years";
50554
50560
  DateRange["next_n_years"] = "next_n_years";
50561
+ DateRange["n_years_ago"] = "n_years_ago";
50555
50562
  DateRange["last_n_fiscal_years"] = "last_n_fiscal_years";
50556
50563
  DateRange["next_n_fiscal_years"] = "next_n_fiscal_years";
50557
50564
  })(DateRange || (DateRange = {}));
@@ -50622,6 +50629,7 @@
50622
50629
  dataType: field.dataType,
50623
50630
  };
50624
50631
  }
50632
+ // relative date ranges defined at https://help.salesforce.com/s/articleView?id=sf.filter_dates_relative.htm&type=5
50625
50633
  function dateRangesFrom(dateRange, input, dateFunction) {
50626
50634
  // use 'start of day' to ensure the timestamp is 00:00:00 for date time values
50627
50635
  switch (dateRange) {
@@ -50651,7 +50659,86 @@
50651
50659
  },
50652
50660
  };
50653
50661
  }
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
50662
+ // n_days_ago
50663
+ // starts 12:00:00 am -(n) days from today
50664
+ // ends 11:59:99 pm -(n) days from today
50665
+ case DateRange.n_days_ago: {
50666
+ return {
50667
+ binding: {
50668
+ upper: `${-input + 1} days`,
50669
+ lower: `-${input} days`,
50670
+ },
50671
+ range: {
50672
+ upper: `${dateFunction}('now', 'start of day', ?, '-1 seconds')`,
50673
+ lower: `${dateFunction}('now', 'start of day', ?)`,
50674
+ },
50675
+ };
50676
+ }
50677
+ // next_n_weeks
50678
+ // starts at 00:00:00 the first day of the week n weeks after the current week
50679
+ // ends 23:59:59 of the last day of week before the current
50680
+ case DateRange.next_n_weeks: {
50681
+ const isStartOfWeek = isTodayStartOfWeek();
50682
+ return {
50683
+ binding: {
50684
+ // weekday FIRST_DAY_OF_WEEK goes to the next weekday of FIRST_DAY_OF_WEEK if not that current day
50685
+ // if that current day then it will be that day
50686
+ // 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
50687
+ upper: `${input * 7 + (isStartOfWeek ? 7 : 0)} days`,
50688
+ //lower bound starts out 00:00:00 of next week
50689
+ lower: `${isStartOfWeek ? 7 : 0} days`,
50690
+ },
50691
+ range: {
50692
+ upper: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?, '-1 seconds')`,
50693
+ lower: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?)`,
50694
+ },
50695
+ };
50696
+ }
50697
+ // last_n_weeks
50698
+ // starts at 00:00:00 of day 0 n weeks before the current week
50699
+ // ends 23:59:59 at last day of the week before the current week
50700
+ case DateRange.last_n_weeks: {
50701
+ const isStartOfWeek = isTodayStartOfWeek();
50702
+ return {
50703
+ binding: {
50704
+ // ending on at 23:59:59 of the week before the current week
50705
+ // -7 more days if today not start of week
50706
+ upper: `${-(isStartOfWeek ? 0 : 7)} days`,
50707
+ // starting on 00:00:00 of n * weeks before current week
50708
+ // -7 more days if today not the start of the week because weekday FIRST_DAY_OF_WEEK puts us next week day 0
50709
+ lower: `${-input * 7 - (isStartOfWeek ? 0 : 7)} days`,
50710
+ },
50711
+ range: {
50712
+ upper: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?, '-1 seconds')`,
50713
+ lower: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?)`,
50714
+ },
50715
+ };
50716
+ }
50717
+ // n_weeks_ago
50718
+ // starts 00:00:00 on day 0 of n weeks before the current week
50719
+ // ends 7 days after the start
50720
+ case DateRange.n_weeks_ago: {
50721
+ const isStartOfWeek = isTodayStartOfWeek();
50722
+ return {
50723
+ binding: {
50724
+ // end of week n weeks before current week
50725
+ // if today is start of the week then we need to -7 from the days given by n
50726
+ // so add 7 to remove a week from -(n)
50727
+ upper: `${-input * 7 + (isStartOfWeek ? 7 : 0)} days`,
50728
+ // start of the week n weeks from the current week
50729
+ // if today is the start of the week then -(n) will do to be the previous week, but
50730
+ // 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
50731
+ lower: `${-input * 7 - (isStartOfWeek ? 0 : 7)} days`,
50732
+ },
50733
+ range: {
50734
+ upper: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?, '-1 seconds')`,
50735
+ lower: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?)`,
50736
+ },
50737
+ };
50738
+ }
50739
+ // next_n_months
50740
+ // starts the first day of the next month at 00:00:00 and
50741
+ // ends end of the nth month 23:59:59
50655
50742
  case DateRange.next_n_months: {
50656
50743
  return {
50657
50744
  binding: {
@@ -50664,7 +50751,8 @@
50664
50751
  },
50665
50752
  };
50666
50753
  }
50667
- // last_n_months range starts at 00:00:00 first day of n months before the current month and
50754
+ // last_n_months
50755
+ // starts at 00:00:00 first day of n months before the current month and
50668
50756
  // ends at 23:59:59 the last day of the month before the current month
50669
50757
  case DateRange.last_n_months: {
50670
50758
  return {
@@ -50678,11 +50766,125 @@
50678
50766
  },
50679
50767
  };
50680
50768
  }
50769
+ // n_months_ago
50770
+ // starts at the first day of the month 00:00:00 n months ago from now
50771
+ // ends at 23:59:59 of n months ago
50772
+ case DateRange.n_months_ago: {
50773
+ return {
50774
+ binding: {
50775
+ // need to go 1 less month back then -1 seconds to get the end of it
50776
+ upper: `${-input + 1} months`,
50777
+ lower: `-${input} months`,
50778
+ },
50779
+ range: {
50780
+ upper: `${dateFunction}('now', 'start of month', ?, '-1 seconds')`,
50781
+ lower: `${dateFunction}('now', 'start of month', ?)`,
50782
+ },
50783
+ };
50784
+ }
50785
+ // next_n_years
50786
+ // starts 00:00:00 Jan 1st the year after the current year
50787
+ // ends Dec 31 23:59:59 of the nth year
50788
+ case DateRange.next_n_years: {
50789
+ return {
50790
+ binding: {
50791
+ upper: `+${input + 1} years`,
50792
+ lower: `+1 year`,
50793
+ },
50794
+ range: {
50795
+ upper: `${dateFunction}('now', 'start of year', ?, '-1 seconds')`,
50796
+ lower: `${dateFunction}('now', 'start of year', ?)`,
50797
+ },
50798
+ };
50799
+ }
50800
+ // last_n_years starts
50801
+ // starts 00:00:00 Jan 1 n+1 year ago and
50802
+ // ends dec 31 23:59:59 of the year before the current
50803
+ case DateRange.last_n_years: {
50804
+ return {
50805
+ binding: {
50806
+ upper: `-1 seconds`,
50807
+ lower: `-${input + 1} years`,
50808
+ },
50809
+ range: {
50810
+ upper: `${dateFunction}('now', 'start of year', ?)`,
50811
+ lower: `${dateFunction}('now', 'start of year', ?)`,
50812
+ },
50813
+ };
50814
+ }
50815
+ // n_years_ago
50816
+ // starts 00:00:00 Jan 1 of n years before the current year and
50817
+ // ends Dec 31 23:59:59 of that year
50818
+ case DateRange.n_years_ago: {
50819
+ return {
50820
+ binding: {
50821
+ upper: `-${input - 1} years`,
50822
+ lower: `-${input} years`,
50823
+ },
50824
+ range: {
50825
+ upper: `${dateFunction}('now', 'start of year', ?, '-1 seconds')`,
50826
+ lower: `${dateFunction}('now', 'start of year', ?)`,
50827
+ },
50828
+ };
50829
+ }
50830
+ // next_n_quarters
50831
+ // starts 00:00:00 first day of the quarter after the current quarter
50832
+ // ends 23:59:59 of the last day of n quarters in the future
50833
+ case DateRange.next_n_quarters: {
50834
+ const currentQuarterString = quarterStart(new Date());
50835
+ return {
50836
+ binding: {
50837
+ // add another quarter input to -1 seconds to get the end of the last day of the quarter
50838
+ upper: `${(input + 1) * 3} months`,
50839
+ lower: `3 months`,
50840
+ },
50841
+ range: {
50842
+ upper: `${dateFunction}('${currentQuarterString}', 'start of day', ?, '-1 seconds')`,
50843
+ lower: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
50844
+ },
50845
+ };
50846
+ }
50847
+ // last_n_quarters
50848
+ // starts 00:00:00 the first day of n quarters ago
50849
+ // end 23:59:59 the last day of the quarter before the current quarter
50850
+ case DateRange.last_n_quarters: {
50851
+ const currentQuarterString = quarterStart(new Date());
50852
+ return {
50853
+ binding: {
50854
+ upper: `-1 seconds`,
50855
+ lower: `-${input * 3} months`,
50856
+ },
50857
+ range: {
50858
+ upper: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
50859
+ lower: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
50860
+ },
50861
+ };
50862
+ }
50863
+ // n_quarters_ago
50864
+ // starts 00:00:00 first day of the quarter n quarters before the current
50865
+ // ends 23:59:59 last day of the same quarter
50866
+ case DateRange.n_quarters_ago: {
50867
+ const currentQuarterString = quarterStart(new Date());
50868
+ return {
50869
+ binding: {
50870
+ // minus 1 quarter to be able to -1 seconds to get the end of the nth quarter
50871
+ upper: `-${(input - 1) * 3} months`,
50872
+ lower: `-${input * 3} months`,
50873
+ },
50874
+ range: {
50875
+ upper: `${dateFunction}('${currentQuarterString}', 'start of day', ?, '-1 seconds')`,
50876
+ lower: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
50877
+ },
50878
+ };
50879
+ }
50681
50880
  default:
50682
50881
  // eslint-disable-next-line @salesforce/lds/no-error-in-production
50683
50882
  throw new Error(`DateRangeInput ${dateRange} is not supported in local evalutation`);
50684
50883
  }
50685
50884
  }
50885
+ function isTodayStartOfWeek() {
50886
+ return new Date().getDay() === FIRST_DAY_OF_WEEK;
50887
+ }
50686
50888
 
50687
50889
  const JSON_EXTRACT_PATH_INGESTION_TIMESTAMP = '$.ingestionTimestamp';
50688
50890
  const JSON_EXTRACT_PATH_INGESTION_APINAME = '$.apiName';
@@ -60633,7 +60835,7 @@
60633
60835
  id: '@salesforce/lds-network-adapter',
60634
60836
  instrument: instrument$2,
60635
60837
  });
60636
- // version: 1.259.0-921ca6033
60838
+ // version: 1.260.0-95d02abca
60637
60839
 
60638
60840
  const { create: create$3, keys: keys$3 } = Object;
60639
60841
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -78962,7 +79164,7 @@
78962
79164
  configuration: { ...configurationForGraphQLAdapters$1 },
78963
79165
  instrument: instrument$1,
78964
79166
  });
78965
- // version: 1.259.0-54a7811b5
79167
+ // version: 1.260.0-7a5d1675a
78966
79168
 
78967
79169
  // On core the unstable adapters are re-exported with different names,
78968
79170
  // we want to match them here.
@@ -81213,7 +81415,7 @@
81213
81415
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
81214
81416
  graphQLImperative = ldsAdapter;
81215
81417
  });
81216
- // version: 1.259.0-54a7811b5
81418
+ // version: 1.260.0-7a5d1675a
81217
81419
 
81218
81420
  var gqlApi = /*#__PURE__*/Object.freeze({
81219
81421
  __proto__: null,
@@ -81911,7 +82113,7 @@
81911
82113
  function register(r) {
81912
82114
  callbacks$1.forEach((callback) => callback(r));
81913
82115
  }
81914
- // version: 1.259.0-921ca6033
82116
+ // version: 1.260.0-95d02abca
81915
82117
 
81916
82118
  /**
81917
82119
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -86834,4 +87036,4 @@
86834
87036
  exports.subscribeToAdapter = subscribeToAdapter;
86835
87037
 
86836
87038
  }));
86837
- // version: 1.259.0-921ca6033
87039
+ // version: 1.260.0-95d02abca
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.260.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.260.0",
39
+ "@salesforce/lds-adapters-uiapi": "^1.260.0",
40
+ "@salesforce/lds-default-luvio": "^1.260.0",
41
+ "@salesforce/lds-drafts": "^1.260.0",
42
+ "@salesforce/lds-graphql-parser": "^1.260.0",
43
+ "@salesforce/lds-luvio-engine": "^1.260.0",
44
+ "@salesforce/lds-priming": "^1.260.0",
45
+ "@salesforce/lds-runtime-mobile": "^1.260.0",
46
+ "@salesforce/nimbus-plugin-lds": "^1.260.0",
47
47
  "ajv": "^8.11.0",
48
48
  "glob": "^7.1.5",
49
49
  "nimbus-types": "^2.0.0-alpha1",