@salesforce/lds-runtime-mobile 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.
package/dist/main.js CHANGED
@@ -19,6 +19,7 @@ import { parseAndVisit, Kind, buildSchema, isObjectType, defaultFieldResolver, v
19
19
  import { RECORD_ID_PREFIX, RECORD_FIELDS_KEY_JUNCTION, isStoreKeyRecordViewEntity, getRecordId18, RECORD_REPRESENTATION_NAME, extractRecordIdFromStoreKey, keyBuilderQuickActionExecutionRepresentation, ingestQuickActionExecutionRepresentation, keyBuilderContentDocumentCompositeRepresentation, getResponseCacheKeysContentDocumentCompositeRepresentation, keyBuilderFromTypeContentDocumentCompositeRepresentation, ingestContentDocumentCompositeRepresentation, keyBuilderRecord, RECORD_VIEW_ENTITY_ID_PREFIX, getTypeCacheKeysRecord, keyBuilderFromTypeRecordRepresentation, ingestRecord, RecordRepresentationRepresentationType, ObjectInfoRepresentationType, getRecordAdapterFactory, getObjectInfoAdapterFactory, getObjectInfosAdapterFactory, getObjectInfoDirectoryAdapterFactory, UiApiNamespace, RecordRepresentationType, RecordRepresentationTTL, RecordRepresentationVersion, getRecordsAdapterFactory } from '@salesforce/lds-adapters-uiapi';
20
20
  import ldsIdempotencyWriteDisabled from '@salesforce/gate/lds.idempotencyWriteDisabled';
21
21
  import ldsBackdatingEnabled from '@salesforce/gate/lds.backdatingEnabled';
22
+ import FIRST_DAY_OF_WEEK from '@salesforce/i18n/firstDayOfWeek';
22
23
  import caseSensitiveUserId from '@salesforce/user/Id';
23
24
  import { idleDetector, getInstrumentation } from 'o11y/client';
24
25
  import ldsUseShortUrlGate from '@salesforce/gate/lds.useShortUrl';
@@ -7453,16 +7454,21 @@ var DateRange;
7453
7454
  (function (DateRange) {
7454
7455
  DateRange["last_n_days"] = "last_n_days";
7455
7456
  DateRange["next_n_days"] = "next_n_days";
7457
+ DateRange["n_days_ago"] = "n_days_ago";
7456
7458
  DateRange["last_n_weeks"] = "last_n_weeks";
7457
7459
  DateRange["next_n_weeks"] = "next_n_weeks";
7460
+ DateRange["n_weeks_ago"] = "n_weeks_ago";
7458
7461
  DateRange["last_n_months"] = "last_n_months";
7459
7462
  DateRange["next_n_months"] = "next_n_months";
7463
+ DateRange["n_months_ago"] = "n_months_ago";
7460
7464
  DateRange["last_n_quarters"] = "last_n_quarters";
7461
7465
  DateRange["next_n_quarters"] = "next_n_quarters";
7466
+ DateRange["n_quarters_ago"] = "n_quarters_ago";
7462
7467
  DateRange["last_n_fiscal_quarters"] = "last_n_fiscal_quarters";
7463
7468
  DateRange["next_n_fiscal_quarters"] = "next_n_fiscal_quarters";
7464
7469
  DateRange["last_n_years"] = "last_n_years";
7465
7470
  DateRange["next_n_years"] = "next_n_years";
7471
+ DateRange["n_years_ago"] = "n_years_ago";
7466
7472
  DateRange["last_n_fiscal_years"] = "last_n_fiscal_years";
7467
7473
  DateRange["next_n_fiscal_years"] = "next_n_fiscal_years";
7468
7474
  })(DateRange || (DateRange = {}));
@@ -7533,6 +7539,7 @@ function dateTimeRange(input, op, field, alias) {
7533
7539
  dataType: field.dataType,
7534
7540
  };
7535
7541
  }
7542
+ // relative date ranges defined at https://help.salesforce.com/s/articleView?id=sf.filter_dates_relative.htm&type=5
7536
7543
  function dateRangesFrom(dateRange, input, dateFunction) {
7537
7544
  // use 'start of day' to ensure the timestamp is 00:00:00 for date time values
7538
7545
  switch (dateRange) {
@@ -7562,7 +7569,86 @@ function dateRangesFrom(dateRange, input, dateFunction) {
7562
7569
  },
7563
7570
  };
7564
7571
  }
7565
- // 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
7572
+ // n_days_ago
7573
+ // starts 12:00:00 am -(n) days from today
7574
+ // ends 11:59:99 pm -(n) days from today
7575
+ case DateRange.n_days_ago: {
7576
+ return {
7577
+ binding: {
7578
+ upper: `${-input + 1} days`,
7579
+ lower: `-${input} days`,
7580
+ },
7581
+ range: {
7582
+ upper: `${dateFunction}('now', 'start of day', ?, '-1 seconds')`,
7583
+ lower: `${dateFunction}('now', 'start of day', ?)`,
7584
+ },
7585
+ };
7586
+ }
7587
+ // next_n_weeks
7588
+ // starts at 00:00:00 the first day of the week n weeks after the current week
7589
+ // ends 23:59:59 of the last day of week before the current
7590
+ case DateRange.next_n_weeks: {
7591
+ const isStartOfWeek = isTodayStartOfWeek();
7592
+ return {
7593
+ binding: {
7594
+ // weekday FIRST_DAY_OF_WEEK goes to the next weekday of FIRST_DAY_OF_WEEK if not that current day
7595
+ // if that current day then it will be that day
7596
+ // 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
7597
+ upper: `${input * 7 + (isStartOfWeek ? 7 : 0)} days`,
7598
+ //lower bound starts out 00:00:00 of next week
7599
+ lower: `${isStartOfWeek ? 7 : 0} days`,
7600
+ },
7601
+ range: {
7602
+ upper: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?, '-1 seconds')`,
7603
+ lower: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?)`,
7604
+ },
7605
+ };
7606
+ }
7607
+ // last_n_weeks
7608
+ // starts at 00:00:00 of day 0 n weeks before the current week
7609
+ // ends 23:59:59 at last day of the week before the current week
7610
+ case DateRange.last_n_weeks: {
7611
+ const isStartOfWeek = isTodayStartOfWeek();
7612
+ return {
7613
+ binding: {
7614
+ // ending on at 23:59:59 of the week before the current week
7615
+ // -7 more days if today not start of week
7616
+ upper: `${-(isStartOfWeek ? 0 : 7)} days`,
7617
+ // starting on 00:00:00 of n * weeks before current week
7618
+ // -7 more days if today not the start of the week because weekday FIRST_DAY_OF_WEEK puts us next week day 0
7619
+ lower: `${-input * 7 - (isStartOfWeek ? 0 : 7)} days`,
7620
+ },
7621
+ range: {
7622
+ upper: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?, '-1 seconds')`,
7623
+ lower: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?)`,
7624
+ },
7625
+ };
7626
+ }
7627
+ // n_weeks_ago
7628
+ // starts 00:00:00 on day 0 of n weeks before the current week
7629
+ // ends 7 days after the start
7630
+ case DateRange.n_weeks_ago: {
7631
+ const isStartOfWeek = isTodayStartOfWeek();
7632
+ return {
7633
+ binding: {
7634
+ // end of week n weeks before current week
7635
+ // if today is start of the week then we need to -7 from the days given by n
7636
+ // so add 7 to remove a week from -(n)
7637
+ upper: `${-input * 7 + (isStartOfWeek ? 7 : 0)} days`,
7638
+ // start of the week n weeks from the current week
7639
+ // if today is the start of the week then -(n) will do to be the previous week, but
7640
+ // 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
7641
+ lower: `${-input * 7 - (isStartOfWeek ? 0 : 7)} days`,
7642
+ },
7643
+ range: {
7644
+ upper: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?, '-1 seconds')`,
7645
+ lower: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?)`,
7646
+ },
7647
+ };
7648
+ }
7649
+ // next_n_months
7650
+ // starts the first day of the next month at 00:00:00 and
7651
+ // ends end of the nth month 23:59:59
7566
7652
  case DateRange.next_n_months: {
7567
7653
  return {
7568
7654
  binding: {
@@ -7575,7 +7661,8 @@ function dateRangesFrom(dateRange, input, dateFunction) {
7575
7661
  },
7576
7662
  };
7577
7663
  }
7578
- // last_n_months range starts at 00:00:00 first day of n months before the current month and
7664
+ // last_n_months
7665
+ // starts at 00:00:00 first day of n months before the current month and
7579
7666
  // ends at 23:59:59 the last day of the month before the current month
7580
7667
  case DateRange.last_n_months: {
7581
7668
  return {
@@ -7589,11 +7676,125 @@ function dateRangesFrom(dateRange, input, dateFunction) {
7589
7676
  },
7590
7677
  };
7591
7678
  }
7679
+ // n_months_ago
7680
+ // starts at the first day of the month 00:00:00 n months ago from now
7681
+ // ends at 23:59:59 of n months ago
7682
+ case DateRange.n_months_ago: {
7683
+ return {
7684
+ binding: {
7685
+ // need to go 1 less month back then -1 seconds to get the end of it
7686
+ upper: `${-input + 1} months`,
7687
+ lower: `-${input} months`,
7688
+ },
7689
+ range: {
7690
+ upper: `${dateFunction}('now', 'start of month', ?, '-1 seconds')`,
7691
+ lower: `${dateFunction}('now', 'start of month', ?)`,
7692
+ },
7693
+ };
7694
+ }
7695
+ // next_n_years
7696
+ // starts 00:00:00 Jan 1st the year after the current year
7697
+ // ends Dec 31 23:59:59 of the nth year
7698
+ case DateRange.next_n_years: {
7699
+ return {
7700
+ binding: {
7701
+ upper: `+${input + 1} years`,
7702
+ lower: `+1 year`,
7703
+ },
7704
+ range: {
7705
+ upper: `${dateFunction}('now', 'start of year', ?, '-1 seconds')`,
7706
+ lower: `${dateFunction}('now', 'start of year', ?)`,
7707
+ },
7708
+ };
7709
+ }
7710
+ // last_n_years starts
7711
+ // starts 00:00:00 Jan 1 n+1 year ago and
7712
+ // ends dec 31 23:59:59 of the year before the current
7713
+ case DateRange.last_n_years: {
7714
+ return {
7715
+ binding: {
7716
+ upper: `-1 seconds`,
7717
+ lower: `-${input + 1} years`,
7718
+ },
7719
+ range: {
7720
+ upper: `${dateFunction}('now', 'start of year', ?)`,
7721
+ lower: `${dateFunction}('now', 'start of year', ?)`,
7722
+ },
7723
+ };
7724
+ }
7725
+ // n_years_ago
7726
+ // starts 00:00:00 Jan 1 of n years before the current year and
7727
+ // ends Dec 31 23:59:59 of that year
7728
+ case DateRange.n_years_ago: {
7729
+ return {
7730
+ binding: {
7731
+ upper: `-${input - 1} years`,
7732
+ lower: `-${input} years`,
7733
+ },
7734
+ range: {
7735
+ upper: `${dateFunction}('now', 'start of year', ?, '-1 seconds')`,
7736
+ lower: `${dateFunction}('now', 'start of year', ?)`,
7737
+ },
7738
+ };
7739
+ }
7740
+ // next_n_quarters
7741
+ // starts 00:00:00 first day of the quarter after the current quarter
7742
+ // ends 23:59:59 of the last day of n quarters in the future
7743
+ case DateRange.next_n_quarters: {
7744
+ const currentQuarterString = quarterStart(new Date());
7745
+ return {
7746
+ binding: {
7747
+ // add another quarter input to -1 seconds to get the end of the last day of the quarter
7748
+ upper: `${(input + 1) * 3} months`,
7749
+ lower: `3 months`,
7750
+ },
7751
+ range: {
7752
+ upper: `${dateFunction}('${currentQuarterString}', 'start of day', ?, '-1 seconds')`,
7753
+ lower: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
7754
+ },
7755
+ };
7756
+ }
7757
+ // last_n_quarters
7758
+ // starts 00:00:00 the first day of n quarters ago
7759
+ // end 23:59:59 the last day of the quarter before the current quarter
7760
+ case DateRange.last_n_quarters: {
7761
+ const currentQuarterString = quarterStart(new Date());
7762
+ return {
7763
+ binding: {
7764
+ upper: `-1 seconds`,
7765
+ lower: `-${input * 3} months`,
7766
+ },
7767
+ range: {
7768
+ upper: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
7769
+ lower: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
7770
+ },
7771
+ };
7772
+ }
7773
+ // n_quarters_ago
7774
+ // starts 00:00:00 first day of the quarter n quarters before the current
7775
+ // ends 23:59:59 last day of the same quarter
7776
+ case DateRange.n_quarters_ago: {
7777
+ const currentQuarterString = quarterStart(new Date());
7778
+ return {
7779
+ binding: {
7780
+ // minus 1 quarter to be able to -1 seconds to get the end of the nth quarter
7781
+ upper: `-${(input - 1) * 3} months`,
7782
+ lower: `-${input * 3} months`,
7783
+ },
7784
+ range: {
7785
+ upper: `${dateFunction}('${currentQuarterString}', 'start of day', ?, '-1 seconds')`,
7786
+ lower: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
7787
+ },
7788
+ };
7789
+ }
7592
7790
  default:
7593
7791
  // eslint-disable-next-line @salesforce/lds/no-error-in-production
7594
7792
  throw new Error(`DateRangeInput ${dateRange} is not supported in local evalutation`);
7595
7793
  }
7596
7794
  }
7795
+ function isTodayStartOfWeek() {
7796
+ return new Date().getDay() === FIRST_DAY_OF_WEEK;
7797
+ }
7597
7798
 
7598
7799
  const JSON_EXTRACT_PATH_INGESTION_TIMESTAMP = '$.ingestionTimestamp';
7599
7800
  const JSON_EXTRACT_PATH_INGESTION_APINAME = '$.apiName';
@@ -14758,11 +14959,14 @@ function mergeBatchRecordsFields(first, second, collectionMergeFunc) {
14758
14959
  * @param endpoint Regular Expression to check the endpoint to aggregate
14759
14960
  * @returns undefined if we should not aggregate. object if we should.
14760
14961
  */
14761
- function createAggregateBatchRequestInfo(resourceRequest, endpoint) {
14962
+ function createAggregateBatchRequestInfo(resourceRequest, endpoint, instrumentationSink) {
14762
14963
  // only handle GETs on the given endpoint regex
14763
14964
  if (!isGetRequestForEndpoint(endpoint, resourceRequest)) {
14764
14965
  return undefined;
14765
14966
  }
14967
+ if (instrumentationSink) {
14968
+ instrumentationSink.reportChunkCandidateUrlLength(calculateEstimatedTotalUrlLength(resourceRequest));
14969
+ }
14766
14970
  const { queryParams: { fields, optionalFields }, } = resourceRequest;
14767
14971
  // only handle requests with fields or optional fields
14768
14972
  if (fields === undefined && optionalFields === undefined) {
@@ -14874,6 +15078,21 @@ function getMaxLengthPerChunkAllowed(request) {
14874
15078
  // MAX_URL_LENGTH - full lenght without fields, optionalFields
14875
15079
  return MAX_URL_LENGTH - roughUrlLengthWithoutFieldsAndOptionFields;
14876
15080
  }
15081
+ // we don't have access to the host so we cannot calculate the exact length of the url
15082
+ // so we will estimate it
15083
+ function calculateEstimatedTotalUrlLength(request) {
15084
+ const { baseUri, basePath, queryParams } = request;
15085
+ let url = `${baseUri}${basePath}`;
15086
+ if (queryParams) {
15087
+ const queryParamString = entries$2(queryParams)
15088
+ .map(([key, value]) => `${key}=${value}`)
15089
+ .join('&');
15090
+ if (queryParamString) {
15091
+ url += `?${queryParamString}`;
15092
+ }
15093
+ }
15094
+ return url.length;
15095
+ }
14877
15096
 
14878
15097
  const RECORD_ENDPOINT_REGEX = /^\/ui-api\/records\/?(([a-zA-Z0-9]+))?$/;
14879
15098
  const referenceId$3 = 'LDS_Records_AggregateUi';
@@ -14898,9 +15117,9 @@ function mergeGetRecordResult(first, second) {
14898
15117
  mergeRecordFields(first, second);
14899
15118
  return first;
14900
15119
  }
14901
- function makeNetworkChunkFieldsGetRecord(networkAdapter) {
15120
+ function makeNetworkChunkFieldsGetRecord(networkAdapter, instrumentationSink) {
14902
15121
  return (resourceRequest, resourceRequestContext) => {
14903
- const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RECORD_ENDPOINT_REGEX);
15122
+ const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RECORD_ENDPOINT_REGEX, instrumentationSink);
14904
15123
  if (batchRequestInfo === undefined) {
14905
15124
  return networkAdapter(resourceRequest, resourceRequestContext);
14906
15125
  }
@@ -14914,9 +15133,9 @@ function makeNetworkChunkFieldsGetRecord(networkAdapter) {
14914
15133
 
14915
15134
  const RECORDS_BATCH_ENDPOINT_REGEX = /^\/ui-api\/records\/batch\/?(([a-zA-Z0-9|,]+))?$/;
14916
15135
  const referenceId$2 = 'LDS_Records_Batch_AggregateUi';
14917
- function makeNetworkChunkFieldsGetRecordsBatch(networkAdapter) {
15136
+ function makeNetworkChunkFieldsGetRecordsBatch(networkAdapter, intrumentationSink) {
14918
15137
  return (resourceRequest, resourceRequestContext) => {
14919
- const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RECORDS_BATCH_ENDPOINT_REGEX);
15138
+ const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RECORDS_BATCH_ENDPOINT_REGEX, intrumentationSink);
14920
15139
  if (batchRequestInfo === undefined) {
14921
15140
  return networkAdapter(resourceRequest, resourceRequestContext);
14922
15141
  }
@@ -14962,9 +15181,9 @@ function mergeRelatedRecordsFields(first, second) {
14962
15181
  throw new Error('Aggregate UI response is invalid');
14963
15182
  }
14964
15183
  }
14965
- function makeNetworkChunkFieldsGetRelatedListRecords(networkAdapter) {
15184
+ function makeNetworkChunkFieldsGetRelatedListRecords(networkAdapter, instrumentationSink) {
14966
15185
  return (resourceRequest, resourceRequestContext) => {
14967
- const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RELATED_LIST_RECORDS_ENDPOINT_REGEX);
15186
+ const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RELATED_LIST_RECORDS_ENDPOINT_REGEX, instrumentationSink);
14968
15187
  if (batchRequestInfo === undefined) {
14969
15188
  return networkAdapter(resourceRequest, resourceRequestContext);
14970
15189
  }
@@ -15040,9 +15259,9 @@ function recordIdsAllMatch(first, second) {
15040
15259
 
15041
15260
  const RELATED_LIST_RECORDS_BATCH_ENDPOINT_REGEX = /^\/ui-api\/related-list-records\/batch\/?(([a-zA-Z0-9]+))?\//;
15042
15261
  const referenceId = 'LDS_Related_List_Records_AggregateUi';
15043
- function makeNetworkChunkFieldsGetRelatedListRecordsBatch(networkAdapter) {
15262
+ function makeNetworkChunkFieldsGetRelatedListRecordsBatch(networkAdapter, instrumentationSink) {
15044
15263
  return (resourceRequest, resourceRequestContext) => {
15045
- const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RELATED_LIST_RECORDS_BATCH_ENDPOINT_REGEX);
15264
+ const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RELATED_LIST_RECORDS_BATCH_ENDPOINT_REGEX, instrumentationSink);
15046
15265
  if (batchRequestInfo === undefined) {
15047
15266
  return networkAdapter(resourceRequest, resourceRequestContext);
15048
15267
  }
@@ -15065,7 +15284,7 @@ function makeNetworkChunkFieldsGetRelatedListRecordsBatch(networkAdapter) {
15065
15284
  *
15066
15285
  * @param networkAdapter the network adapter to do the call.
15067
15286
  */
15068
- function makeNetworkAdapterChunkRecordFields(networkAdapter) {
15287
+ function makeNetworkAdapterChunkRecordFields(networkAdapter, instrumentationSink) {
15069
15288
  // endpoint handlers that support aggregate-ui field batching
15070
15289
  const batchHandlers = [
15071
15290
  makeNetworkChunkFieldsGetRecord,
@@ -15074,7 +15293,7 @@ function makeNetworkAdapterChunkRecordFields(networkAdapter) {
15074
15293
  makeNetworkChunkFieldsGetRelatedListRecordsBatch,
15075
15294
  ];
15076
15295
  return batchHandlers.reduce((network, handler) => {
15077
- return handler(network);
15296
+ return handler(network, instrumentationSink);
15078
15297
  }, networkAdapter);
15079
15298
  }
15080
15299
 
@@ -15351,6 +15570,11 @@ function reportPrimingConflict(resolutionType, recordCount) {
15351
15570
  resolutionType,
15352
15571
  });
15353
15572
  }
15573
+ /** Network */
15574
+ function reportChunkCandidateUrlLength(urlLength) {
15575
+ const buckets = [8000, 10000, 12000, 14000, 16000];
15576
+ ldsMobileInstrumentation.bucketValue('chunk-candidate-url-length-histogram', urlLength, buckets);
15577
+ }
15354
15578
 
15355
15579
  /**
15356
15580
  * HOF (high-order-function) that instruments any async operation. If the operation
@@ -17561,7 +17785,9 @@ function getRuntime() {
17561
17785
  const { newRecordId, isGenerated } = recordIdGenerator(userId);
17562
17786
  // non-draft-aware base services
17563
17787
  const store = new InMemoryStore();
17564
- lazyNetworkAdapter = platformNetworkAdapter(makeNetworkAdapterChunkRecordFields(NimbusNetworkAdapter));
17788
+ lazyNetworkAdapter = platformNetworkAdapter(makeNetworkAdapterChunkRecordFields(NimbusNetworkAdapter, {
17789
+ reportChunkCandidateUrlLength: reportChunkCandidateUrlLength,
17790
+ }));
17565
17791
  lazyBaseDurableStore = getNimbusDurableStore();
17566
17792
  // specific adapters
17567
17793
  const internalAdapterStore = new InMemoryStore();
@@ -17690,4 +17916,4 @@ register({
17690
17916
  });
17691
17917
 
17692
17918
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
17693
- // version: 1.259.0-921ca6033
17919
+ // version: 1.261.0-faaa0c74a
@@ -3,12 +3,14 @@ declare function error(_err: Error, _userSchemaOrText?: string, _data?: any): vo
3
3
  declare function startActivity(_name: string): any;
4
4
  declare function incrementCounter(_operation: string, _increment?: number, _hasError?: boolean, _tags?: any): void;
5
5
  declare function trackValue(_operation: string, _value: number, _hasError?: boolean, _tags?: any): void;
6
+ declare function bucketValue(_operation: string, _value: number, _buckets: number[]): void;
6
7
  export declare const instrumentation: {
7
8
  log: typeof log;
8
9
  error: typeof error;
9
10
  startActivity: typeof startActivity;
10
11
  incrementCounter: typeof incrementCounter;
11
12
  trackValue: typeof trackValue;
13
+ bucketValue: typeof bucketValue;
12
14
  };
13
15
  export declare const METRIC_KEYS: {};
14
16
  export {};
@@ -15,3 +15,5 @@ export declare function reportPrimingSessionCreated(): void;
15
15
  export declare function reportPrimingError(errorType: string, recordCount: number): void;
16
16
  export declare function reportPrimingSuccess(recordCount: number): void;
17
17
  export declare function reportPrimingConflict(resolutionType: string, recordCount: number): void;
18
+ /** Network */
19
+ export declare function reportChunkCandidateUrlLength(urlLength: number): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-mobile",
3
- "version": "1.259.0",
3
+ "version": "1.261.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS runtime for mobile/hybrid environments.",
6
6
  "main": "dist/main.js",
@@ -32,25 +32,25 @@
32
32
  "release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-mobile"
33
33
  },
34
34
  "dependencies": {
35
- "@salesforce/lds-adapters-uiapi": "^1.259.0",
36
- "@salesforce/lds-bindings": "^1.259.0",
37
- "@salesforce/lds-instrumentation": "^1.259.0",
38
- "@salesforce/lds-priming": "^1.259.0",
35
+ "@salesforce/lds-adapters-uiapi": "^1.261.0",
36
+ "@salesforce/lds-bindings": "^1.261.0",
37
+ "@salesforce/lds-instrumentation": "^1.261.0",
38
+ "@salesforce/lds-priming": "^1.261.0",
39
39
  "@salesforce/user": "0.0.21",
40
40
  "o11y": "244.0.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@salesforce/lds-adapters-graphql": "^1.259.0",
44
- "@salesforce/lds-drafts": "^1.259.0",
45
- "@salesforce/lds-drafts-adapters-uiapi": "^1.259.0",
46
- "@salesforce/lds-graphql-eval": "^1.259.0",
47
- "@salesforce/lds-network-adapter": "^1.259.0",
48
- "@salesforce/lds-network-nimbus": "^1.259.0",
49
- "@salesforce/lds-store-binary": "^1.259.0",
50
- "@salesforce/lds-store-nimbus": "^1.259.0",
51
- "@salesforce/lds-store-sql": "^1.259.0",
52
- "@salesforce/lds-utils-adapters": "^1.259.0",
53
- "@salesforce/nimbus-plugin-lds": "^1.259.0",
43
+ "@salesforce/lds-adapters-graphql": "^1.261.0",
44
+ "@salesforce/lds-drafts": "^1.261.0",
45
+ "@salesforce/lds-drafts-adapters-uiapi": "^1.261.0",
46
+ "@salesforce/lds-graphql-eval": "^1.261.0",
47
+ "@salesforce/lds-network-adapter": "^1.261.0",
48
+ "@salesforce/lds-network-nimbus": "^1.261.0",
49
+ "@salesforce/lds-store-binary": "^1.261.0",
50
+ "@salesforce/lds-store-nimbus": "^1.261.0",
51
+ "@salesforce/lds-store-sql": "^1.261.0",
52
+ "@salesforce/lds-utils-adapters": "^1.261.0",
53
+ "@salesforce/nimbus-plugin-lds": "^1.261.0",
54
54
  "babel-plugin-dynamic-import-node": "^2.3.3",
55
55
  "wait-for-expect": "^3.0.2"
56
56
  },
@@ -59,7 +59,7 @@
59
59
  "path": "./dist/main.js",
60
60
  "maxSize": {
61
61
  "none": "800 kB",
62
- "min": "310 kB",
62
+ "min": "315 kB",
63
63
  "compressed": "150 kB"
64
64
  }
65
65
  },
@@ -67,7 +67,7 @@
67
67
  "path": "./sfdc/main.js",
68
68
  "maxSize": {
69
69
  "none": "800 kB",
70
- "min": "310 kB",
70
+ "min": "315 kB",
71
71
  "compressed": "150 kB"
72
72
  }
73
73
  }
package/sfdc/main.js CHANGED
@@ -19,6 +19,7 @@ import { parseAndVisit, Kind, buildSchema, isObjectType, defaultFieldResolver, v
19
19
  import { RECORD_ID_PREFIX, RECORD_FIELDS_KEY_JUNCTION, isStoreKeyRecordViewEntity, getRecordId18, RECORD_REPRESENTATION_NAME, extractRecordIdFromStoreKey, keyBuilderQuickActionExecutionRepresentation, ingestQuickActionExecutionRepresentation, keyBuilderContentDocumentCompositeRepresentation, getResponseCacheKeysContentDocumentCompositeRepresentation, keyBuilderFromTypeContentDocumentCompositeRepresentation, ingestContentDocumentCompositeRepresentation, keyBuilderRecord, RECORD_VIEW_ENTITY_ID_PREFIX, getTypeCacheKeysRecord, keyBuilderFromTypeRecordRepresentation, ingestRecord, RecordRepresentationRepresentationType, ObjectInfoRepresentationType, getRecordAdapterFactory, getObjectInfoAdapterFactory, getObjectInfosAdapterFactory, getObjectInfoDirectoryAdapterFactory, UiApiNamespace, RecordRepresentationType, RecordRepresentationTTL, RecordRepresentationVersion, getRecordsAdapterFactory } from 'force/ldsAdaptersUiapi';
20
20
  import ldsIdempotencyWriteDisabled from '@salesforce/gate/lds.idempotencyWriteDisabled';
21
21
  import ldsBackdatingEnabled from '@salesforce/gate/lds.backdatingEnabled';
22
+ import FIRST_DAY_OF_WEEK from '@salesforce/i18n/firstDayOfWeek';
22
23
  import caseSensitiveUserId from '@salesforce/user/Id';
23
24
  import { idleDetector, getInstrumentation } from 'o11y/client';
24
25
  import ldsUseShortUrlGate from '@salesforce/gate/lds.useShortUrl';
@@ -7453,16 +7454,21 @@ var DateRange;
7453
7454
  (function (DateRange) {
7454
7455
  DateRange["last_n_days"] = "last_n_days";
7455
7456
  DateRange["next_n_days"] = "next_n_days";
7457
+ DateRange["n_days_ago"] = "n_days_ago";
7456
7458
  DateRange["last_n_weeks"] = "last_n_weeks";
7457
7459
  DateRange["next_n_weeks"] = "next_n_weeks";
7460
+ DateRange["n_weeks_ago"] = "n_weeks_ago";
7458
7461
  DateRange["last_n_months"] = "last_n_months";
7459
7462
  DateRange["next_n_months"] = "next_n_months";
7463
+ DateRange["n_months_ago"] = "n_months_ago";
7460
7464
  DateRange["last_n_quarters"] = "last_n_quarters";
7461
7465
  DateRange["next_n_quarters"] = "next_n_quarters";
7466
+ DateRange["n_quarters_ago"] = "n_quarters_ago";
7462
7467
  DateRange["last_n_fiscal_quarters"] = "last_n_fiscal_quarters";
7463
7468
  DateRange["next_n_fiscal_quarters"] = "next_n_fiscal_quarters";
7464
7469
  DateRange["last_n_years"] = "last_n_years";
7465
7470
  DateRange["next_n_years"] = "next_n_years";
7471
+ DateRange["n_years_ago"] = "n_years_ago";
7466
7472
  DateRange["last_n_fiscal_years"] = "last_n_fiscal_years";
7467
7473
  DateRange["next_n_fiscal_years"] = "next_n_fiscal_years";
7468
7474
  })(DateRange || (DateRange = {}));
@@ -7533,6 +7539,7 @@ function dateTimeRange(input, op, field, alias) {
7533
7539
  dataType: field.dataType,
7534
7540
  };
7535
7541
  }
7542
+ // relative date ranges defined at https://help.salesforce.com/s/articleView?id=sf.filter_dates_relative.htm&type=5
7536
7543
  function dateRangesFrom(dateRange, input, dateFunction) {
7537
7544
  // use 'start of day' to ensure the timestamp is 00:00:00 for date time values
7538
7545
  switch (dateRange) {
@@ -7562,7 +7569,86 @@ function dateRangesFrom(dateRange, input, dateFunction) {
7562
7569
  },
7563
7570
  };
7564
7571
  }
7565
- // 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
7572
+ // n_days_ago
7573
+ // starts 12:00:00 am -(n) days from today
7574
+ // ends 11:59:99 pm -(n) days from today
7575
+ case DateRange.n_days_ago: {
7576
+ return {
7577
+ binding: {
7578
+ upper: `${-input + 1} days`,
7579
+ lower: `-${input} days`,
7580
+ },
7581
+ range: {
7582
+ upper: `${dateFunction}('now', 'start of day', ?, '-1 seconds')`,
7583
+ lower: `${dateFunction}('now', 'start of day', ?)`,
7584
+ },
7585
+ };
7586
+ }
7587
+ // next_n_weeks
7588
+ // starts at 00:00:00 the first day of the week n weeks after the current week
7589
+ // ends 23:59:59 of the last day of week before the current
7590
+ case DateRange.next_n_weeks: {
7591
+ const isStartOfWeek = isTodayStartOfWeek();
7592
+ return {
7593
+ binding: {
7594
+ // weekday FIRST_DAY_OF_WEEK goes to the next weekday of FIRST_DAY_OF_WEEK if not that current day
7595
+ // if that current day then it will be that day
7596
+ // 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
7597
+ upper: `${input * 7 + (isStartOfWeek ? 7 : 0)} days`,
7598
+ //lower bound starts out 00:00:00 of next week
7599
+ lower: `${isStartOfWeek ? 7 : 0} days`,
7600
+ },
7601
+ range: {
7602
+ upper: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?, '-1 seconds')`,
7603
+ lower: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?)`,
7604
+ },
7605
+ };
7606
+ }
7607
+ // last_n_weeks
7608
+ // starts at 00:00:00 of day 0 n weeks before the current week
7609
+ // ends 23:59:59 at last day of the week before the current week
7610
+ case DateRange.last_n_weeks: {
7611
+ const isStartOfWeek = isTodayStartOfWeek();
7612
+ return {
7613
+ binding: {
7614
+ // ending on at 23:59:59 of the week before the current week
7615
+ // -7 more days if today not start of week
7616
+ upper: `${-(isStartOfWeek ? 0 : 7)} days`,
7617
+ // starting on 00:00:00 of n * weeks before current week
7618
+ // -7 more days if today not the start of the week because weekday FIRST_DAY_OF_WEEK puts us next week day 0
7619
+ lower: `${-input * 7 - (isStartOfWeek ? 0 : 7)} days`,
7620
+ },
7621
+ range: {
7622
+ upper: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?, '-1 seconds')`,
7623
+ lower: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?)`,
7624
+ },
7625
+ };
7626
+ }
7627
+ // n_weeks_ago
7628
+ // starts 00:00:00 on day 0 of n weeks before the current week
7629
+ // ends 7 days after the start
7630
+ case DateRange.n_weeks_ago: {
7631
+ const isStartOfWeek = isTodayStartOfWeek();
7632
+ return {
7633
+ binding: {
7634
+ // end of week n weeks before current week
7635
+ // if today is start of the week then we need to -7 from the days given by n
7636
+ // so add 7 to remove a week from -(n)
7637
+ upper: `${-input * 7 + (isStartOfWeek ? 7 : 0)} days`,
7638
+ // start of the week n weeks from the current week
7639
+ // if today is the start of the week then -(n) will do to be the previous week, but
7640
+ // 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
7641
+ lower: `${-input * 7 - (isStartOfWeek ? 0 : 7)} days`,
7642
+ },
7643
+ range: {
7644
+ upper: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?, '-1 seconds')`,
7645
+ lower: `${dateFunction}('now', 'weekday ${FIRST_DAY_OF_WEEK}', 'start of day', ?)`,
7646
+ },
7647
+ };
7648
+ }
7649
+ // next_n_months
7650
+ // starts the first day of the next month at 00:00:00 and
7651
+ // ends end of the nth month 23:59:59
7566
7652
  case DateRange.next_n_months: {
7567
7653
  return {
7568
7654
  binding: {
@@ -7575,7 +7661,8 @@ function dateRangesFrom(dateRange, input, dateFunction) {
7575
7661
  },
7576
7662
  };
7577
7663
  }
7578
- // last_n_months range starts at 00:00:00 first day of n months before the current month and
7664
+ // last_n_months
7665
+ // starts at 00:00:00 first day of n months before the current month and
7579
7666
  // ends at 23:59:59 the last day of the month before the current month
7580
7667
  case DateRange.last_n_months: {
7581
7668
  return {
@@ -7589,11 +7676,125 @@ function dateRangesFrom(dateRange, input, dateFunction) {
7589
7676
  },
7590
7677
  };
7591
7678
  }
7679
+ // n_months_ago
7680
+ // starts at the first day of the month 00:00:00 n months ago from now
7681
+ // ends at 23:59:59 of n months ago
7682
+ case DateRange.n_months_ago: {
7683
+ return {
7684
+ binding: {
7685
+ // need to go 1 less month back then -1 seconds to get the end of it
7686
+ upper: `${-input + 1} months`,
7687
+ lower: `-${input} months`,
7688
+ },
7689
+ range: {
7690
+ upper: `${dateFunction}('now', 'start of month', ?, '-1 seconds')`,
7691
+ lower: `${dateFunction}('now', 'start of month', ?)`,
7692
+ },
7693
+ };
7694
+ }
7695
+ // next_n_years
7696
+ // starts 00:00:00 Jan 1st the year after the current year
7697
+ // ends Dec 31 23:59:59 of the nth year
7698
+ case DateRange.next_n_years: {
7699
+ return {
7700
+ binding: {
7701
+ upper: `+${input + 1} years`,
7702
+ lower: `+1 year`,
7703
+ },
7704
+ range: {
7705
+ upper: `${dateFunction}('now', 'start of year', ?, '-1 seconds')`,
7706
+ lower: `${dateFunction}('now', 'start of year', ?)`,
7707
+ },
7708
+ };
7709
+ }
7710
+ // last_n_years starts
7711
+ // starts 00:00:00 Jan 1 n+1 year ago and
7712
+ // ends dec 31 23:59:59 of the year before the current
7713
+ case DateRange.last_n_years: {
7714
+ return {
7715
+ binding: {
7716
+ upper: `-1 seconds`,
7717
+ lower: `-${input + 1} years`,
7718
+ },
7719
+ range: {
7720
+ upper: `${dateFunction}('now', 'start of year', ?)`,
7721
+ lower: `${dateFunction}('now', 'start of year', ?)`,
7722
+ },
7723
+ };
7724
+ }
7725
+ // n_years_ago
7726
+ // starts 00:00:00 Jan 1 of n years before the current year and
7727
+ // ends Dec 31 23:59:59 of that year
7728
+ case DateRange.n_years_ago: {
7729
+ return {
7730
+ binding: {
7731
+ upper: `-${input - 1} years`,
7732
+ lower: `-${input} years`,
7733
+ },
7734
+ range: {
7735
+ upper: `${dateFunction}('now', 'start of year', ?, '-1 seconds')`,
7736
+ lower: `${dateFunction}('now', 'start of year', ?)`,
7737
+ },
7738
+ };
7739
+ }
7740
+ // next_n_quarters
7741
+ // starts 00:00:00 first day of the quarter after the current quarter
7742
+ // ends 23:59:59 of the last day of n quarters in the future
7743
+ case DateRange.next_n_quarters: {
7744
+ const currentQuarterString = quarterStart(new Date());
7745
+ return {
7746
+ binding: {
7747
+ // add another quarter input to -1 seconds to get the end of the last day of the quarter
7748
+ upper: `${(input + 1) * 3} months`,
7749
+ lower: `3 months`,
7750
+ },
7751
+ range: {
7752
+ upper: `${dateFunction}('${currentQuarterString}', 'start of day', ?, '-1 seconds')`,
7753
+ lower: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
7754
+ },
7755
+ };
7756
+ }
7757
+ // last_n_quarters
7758
+ // starts 00:00:00 the first day of n quarters ago
7759
+ // end 23:59:59 the last day of the quarter before the current quarter
7760
+ case DateRange.last_n_quarters: {
7761
+ const currentQuarterString = quarterStart(new Date());
7762
+ return {
7763
+ binding: {
7764
+ upper: `-1 seconds`,
7765
+ lower: `-${input * 3} months`,
7766
+ },
7767
+ range: {
7768
+ upper: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
7769
+ lower: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
7770
+ },
7771
+ };
7772
+ }
7773
+ // n_quarters_ago
7774
+ // starts 00:00:00 first day of the quarter n quarters before the current
7775
+ // ends 23:59:59 last day of the same quarter
7776
+ case DateRange.n_quarters_ago: {
7777
+ const currentQuarterString = quarterStart(new Date());
7778
+ return {
7779
+ binding: {
7780
+ // minus 1 quarter to be able to -1 seconds to get the end of the nth quarter
7781
+ upper: `-${(input - 1) * 3} months`,
7782
+ lower: `-${input * 3} months`,
7783
+ },
7784
+ range: {
7785
+ upper: `${dateFunction}('${currentQuarterString}', 'start of day', ?, '-1 seconds')`,
7786
+ lower: `${dateFunction}('${currentQuarterString}', 'start of day', ?)`,
7787
+ },
7788
+ };
7789
+ }
7592
7790
  default:
7593
7791
  // eslint-disable-next-line @salesforce/lds/no-error-in-production
7594
7792
  throw new Error(`DateRangeInput ${dateRange} is not supported in local evalutation`);
7595
7793
  }
7596
7794
  }
7795
+ function isTodayStartOfWeek() {
7796
+ return new Date().getDay() === FIRST_DAY_OF_WEEK;
7797
+ }
7597
7798
 
7598
7799
  const JSON_EXTRACT_PATH_INGESTION_TIMESTAMP = '$.ingestionTimestamp';
7599
7800
  const JSON_EXTRACT_PATH_INGESTION_APINAME = '$.apiName';
@@ -14758,11 +14959,14 @@ function mergeBatchRecordsFields(first, second, collectionMergeFunc) {
14758
14959
  * @param endpoint Regular Expression to check the endpoint to aggregate
14759
14960
  * @returns undefined if we should not aggregate. object if we should.
14760
14961
  */
14761
- function createAggregateBatchRequestInfo(resourceRequest, endpoint) {
14962
+ function createAggregateBatchRequestInfo(resourceRequest, endpoint, instrumentationSink) {
14762
14963
  // only handle GETs on the given endpoint regex
14763
14964
  if (!isGetRequestForEndpoint(endpoint, resourceRequest)) {
14764
14965
  return undefined;
14765
14966
  }
14967
+ if (instrumentationSink) {
14968
+ instrumentationSink.reportChunkCandidateUrlLength(calculateEstimatedTotalUrlLength(resourceRequest));
14969
+ }
14766
14970
  const { queryParams: { fields, optionalFields }, } = resourceRequest;
14767
14971
  // only handle requests with fields or optional fields
14768
14972
  if (fields === undefined && optionalFields === undefined) {
@@ -14874,6 +15078,21 @@ function getMaxLengthPerChunkAllowed(request) {
14874
15078
  // MAX_URL_LENGTH - full lenght without fields, optionalFields
14875
15079
  return MAX_URL_LENGTH - roughUrlLengthWithoutFieldsAndOptionFields;
14876
15080
  }
15081
+ // we don't have access to the host so we cannot calculate the exact length of the url
15082
+ // so we will estimate it
15083
+ function calculateEstimatedTotalUrlLength(request) {
15084
+ const { baseUri, basePath, queryParams } = request;
15085
+ let url = `${baseUri}${basePath}`;
15086
+ if (queryParams) {
15087
+ const queryParamString = entries$2(queryParams)
15088
+ .map(([key, value]) => `${key}=${value}`)
15089
+ .join('&');
15090
+ if (queryParamString) {
15091
+ url += `?${queryParamString}`;
15092
+ }
15093
+ }
15094
+ return url.length;
15095
+ }
14877
15096
 
14878
15097
  const RECORD_ENDPOINT_REGEX = /^\/ui-api\/records\/?(([a-zA-Z0-9]+))?$/;
14879
15098
  const referenceId$3 = 'LDS_Records_AggregateUi';
@@ -14898,9 +15117,9 @@ function mergeGetRecordResult(first, second) {
14898
15117
  mergeRecordFields(first, second);
14899
15118
  return first;
14900
15119
  }
14901
- function makeNetworkChunkFieldsGetRecord(networkAdapter) {
15120
+ function makeNetworkChunkFieldsGetRecord(networkAdapter, instrumentationSink) {
14902
15121
  return (resourceRequest, resourceRequestContext) => {
14903
- const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RECORD_ENDPOINT_REGEX);
15122
+ const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RECORD_ENDPOINT_REGEX, instrumentationSink);
14904
15123
  if (batchRequestInfo === undefined) {
14905
15124
  return networkAdapter(resourceRequest, resourceRequestContext);
14906
15125
  }
@@ -14914,9 +15133,9 @@ function makeNetworkChunkFieldsGetRecord(networkAdapter) {
14914
15133
 
14915
15134
  const RECORDS_BATCH_ENDPOINT_REGEX = /^\/ui-api\/records\/batch\/?(([a-zA-Z0-9|,]+))?$/;
14916
15135
  const referenceId$2 = 'LDS_Records_Batch_AggregateUi';
14917
- function makeNetworkChunkFieldsGetRecordsBatch(networkAdapter) {
15136
+ function makeNetworkChunkFieldsGetRecordsBatch(networkAdapter, intrumentationSink) {
14918
15137
  return (resourceRequest, resourceRequestContext) => {
14919
- const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RECORDS_BATCH_ENDPOINT_REGEX);
15138
+ const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RECORDS_BATCH_ENDPOINT_REGEX, intrumentationSink);
14920
15139
  if (batchRequestInfo === undefined) {
14921
15140
  return networkAdapter(resourceRequest, resourceRequestContext);
14922
15141
  }
@@ -14962,9 +15181,9 @@ function mergeRelatedRecordsFields(first, second) {
14962
15181
  throw new Error('Aggregate UI response is invalid');
14963
15182
  }
14964
15183
  }
14965
- function makeNetworkChunkFieldsGetRelatedListRecords(networkAdapter) {
15184
+ function makeNetworkChunkFieldsGetRelatedListRecords(networkAdapter, instrumentationSink) {
14966
15185
  return (resourceRequest, resourceRequestContext) => {
14967
- const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RELATED_LIST_RECORDS_ENDPOINT_REGEX);
15186
+ const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RELATED_LIST_RECORDS_ENDPOINT_REGEX, instrumentationSink);
14968
15187
  if (batchRequestInfo === undefined) {
14969
15188
  return networkAdapter(resourceRequest, resourceRequestContext);
14970
15189
  }
@@ -15040,9 +15259,9 @@ function recordIdsAllMatch(first, second) {
15040
15259
 
15041
15260
  const RELATED_LIST_RECORDS_BATCH_ENDPOINT_REGEX = /^\/ui-api\/related-list-records\/batch\/?(([a-zA-Z0-9]+))?\//;
15042
15261
  const referenceId = 'LDS_Related_List_Records_AggregateUi';
15043
- function makeNetworkChunkFieldsGetRelatedListRecordsBatch(networkAdapter) {
15262
+ function makeNetworkChunkFieldsGetRelatedListRecordsBatch(networkAdapter, instrumentationSink) {
15044
15263
  return (resourceRequest, resourceRequestContext) => {
15045
- const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RELATED_LIST_RECORDS_BATCH_ENDPOINT_REGEX);
15264
+ const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RELATED_LIST_RECORDS_BATCH_ENDPOINT_REGEX, instrumentationSink);
15046
15265
  if (batchRequestInfo === undefined) {
15047
15266
  return networkAdapter(resourceRequest, resourceRequestContext);
15048
15267
  }
@@ -15065,7 +15284,7 @@ function makeNetworkChunkFieldsGetRelatedListRecordsBatch(networkAdapter) {
15065
15284
  *
15066
15285
  * @param networkAdapter the network adapter to do the call.
15067
15286
  */
15068
- function makeNetworkAdapterChunkRecordFields(networkAdapter) {
15287
+ function makeNetworkAdapterChunkRecordFields(networkAdapter, instrumentationSink) {
15069
15288
  // endpoint handlers that support aggregate-ui field batching
15070
15289
  const batchHandlers = [
15071
15290
  makeNetworkChunkFieldsGetRecord,
@@ -15074,7 +15293,7 @@ function makeNetworkAdapterChunkRecordFields(networkAdapter) {
15074
15293
  makeNetworkChunkFieldsGetRelatedListRecordsBatch,
15075
15294
  ];
15076
15295
  return batchHandlers.reduce((network, handler) => {
15077
- return handler(network);
15296
+ return handler(network, instrumentationSink);
15078
15297
  }, networkAdapter);
15079
15298
  }
15080
15299
 
@@ -15351,6 +15570,11 @@ function reportPrimingConflict(resolutionType, recordCount) {
15351
15570
  resolutionType,
15352
15571
  });
15353
15572
  }
15573
+ /** Network */
15574
+ function reportChunkCandidateUrlLength(urlLength) {
15575
+ const buckets = [8000, 10000, 12000, 14000, 16000];
15576
+ ldsMobileInstrumentation.bucketValue('chunk-candidate-url-length-histogram', urlLength, buckets);
15577
+ }
15354
15578
 
15355
15579
  /**
15356
15580
  * HOF (high-order-function) that instruments any async operation. If the operation
@@ -17561,7 +17785,9 @@ function getRuntime() {
17561
17785
  const { newRecordId, isGenerated } = recordIdGenerator(userId);
17562
17786
  // non-draft-aware base services
17563
17787
  const store = new InMemoryStore();
17564
- lazyNetworkAdapter = platformNetworkAdapter(makeNetworkAdapterChunkRecordFields(NimbusNetworkAdapter));
17788
+ lazyNetworkAdapter = platformNetworkAdapter(makeNetworkAdapterChunkRecordFields(NimbusNetworkAdapter, {
17789
+ reportChunkCandidateUrlLength: reportChunkCandidateUrlLength,
17790
+ }));
17565
17791
  lazyBaseDurableStore = getNimbusDurableStore();
17566
17792
  // specific adapters
17567
17793
  const internalAdapterStore = new InMemoryStore();
@@ -17690,4 +17916,4 @@ register({
17690
17916
  });
17691
17917
 
17692
17918
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
17693
- // version: 1.259.0-921ca6033
17919
+ // version: 1.261.0-faaa0c74a
@@ -3,12 +3,14 @@ declare function error(_err: Error, _userSchemaOrText?: string, _data?: any): vo
3
3
  declare function startActivity(_name: string): any;
4
4
  declare function incrementCounter(_operation: string, _increment?: number, _hasError?: boolean, _tags?: any): void;
5
5
  declare function trackValue(_operation: string, _value: number, _hasError?: boolean, _tags?: any): void;
6
+ declare function bucketValue(_operation: string, _value: number, _buckets: number[]): void;
6
7
  export declare const instrumentation: {
7
8
  log: typeof log;
8
9
  error: typeof error;
9
10
  startActivity: typeof startActivity;
10
11
  incrementCounter: typeof incrementCounter;
11
12
  trackValue: typeof trackValue;
13
+ bucketValue: typeof bucketValue;
12
14
  };
13
15
  export declare const METRIC_KEYS: {};
14
16
  export {};
@@ -15,3 +15,5 @@ export declare function reportPrimingSessionCreated(): void;
15
15
  export declare function reportPrimingError(errorType: string, recordCount: number): void;
16
16
  export declare function reportPrimingSuccess(recordCount: number): void;
17
17
  export declare function reportPrimingConflict(resolutionType: string, recordCount: number): void;
18
+ /** Network */
19
+ export declare function reportChunkCandidateUrlLength(urlLength: number): void;