@salesforce/lds-worker-api 1.129.0 → 1.130.8

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.
@@ -761,4 +761,4 @@ if (process.env.NODE_ENV !== 'production') {
761
761
  }
762
762
 
763
763
  export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
764
- // version: 1.129.0-caa83ed0e
764
+ // version: 1.130.8-e6645fb41
@@ -2057,24 +2057,24 @@ class GraphNode {
2057
2057
  object(propertyName) {
2058
2058
  const value = this.data[propertyName];
2059
2059
  if (isNodeLink(value)) {
2060
- throw new Error(`Cannot walk to path ${propertyName}. "${propertyName}" is a link: "${value}"`);
2060
+ throw new Error(`Cannot walk to path ${String(propertyName)}. "${String(propertyName)}" is a link: "${value}"`);
2061
2061
  }
2062
2062
  if (typeof value !== 'object' || value === null) {
2063
- throw new Error(`Cannot walk to path ${propertyName}. "${propertyName}" is a scalar: "${value}"`);
2063
+ throw new Error(`Cannot walk to path ${String(propertyName)}. "${String(propertyName)}" is a scalar: "${value}"`);
2064
2064
  }
2065
2065
  return new GraphNode(this.store, value);
2066
2066
  }
2067
2067
  link(propertyName) {
2068
2068
  const value = this.data[propertyName];
2069
2069
  if (!isNodeLink(value)) {
2070
- throw new Error(`Cannot walk to link ${propertyName}. "${propertyName}" is not a link: "${value}"`);
2070
+ throw new Error(`Cannot walk to link ${String(propertyName)}. "${String(propertyName)}" is not a link: "${value}"`);
2071
2071
  }
2072
2072
  return new GraphLink(this.store, value);
2073
2073
  }
2074
2074
  scalar(propertyName) {
2075
2075
  const value = this.data[propertyName];
2076
2076
  if (typeof value === 'object' && value !== null) {
2077
- throw new Error(`Cannot return value at path ${propertyName}. ${propertyName} is not a scalar.`);
2077
+ throw new Error(`Cannot return value at path ${String(propertyName)}. ${String(propertyName)} is not a scalar.`);
2078
2078
  }
2079
2079
  return value;
2080
2080
  }
@@ -3649,7 +3649,7 @@ class Luvio {
3649
3649
  return this.environment.buildStructuredKey(namespace, representationName, idValues);
3650
3650
  }
3651
3651
  }
3652
- // engine version: 0.138.3-dee50acf
3652
+ // engine version: 0.138.7-42a753b0
3653
3653
 
3654
3654
  /**
3655
3655
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -3776,7 +3776,7 @@ function withDefaultLuvio(callback) {
3776
3776
  }
3777
3777
  callbacks.push(callback);
3778
3778
  }
3779
- // version: 1.129.0-caa83ed0e
3779
+ // version: 1.130.8-e6645fb41
3780
3780
 
3781
3781
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
3782
3782
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15200,7 +15200,7 @@ function parseAndVisit(source) {
15200
15200
  updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
15201
15201
  return luvioDocumentNode;
15202
15202
  }
15203
- // version: 1.129.0-caa83ed0e
15203
+ // version: 1.130.8-e6645fb41
15204
15204
 
15205
15205
  function unwrap(data) {
15206
15206
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16113,7 +16113,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
16113
16113
  const { apiFamily, name } = metadata;
16114
16114
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16115
16115
  }
16116
- // version: 1.129.0-caa83ed0e
16116
+ // version: 1.130.8-e6645fb41
16117
16117
 
16118
16118
  /**
16119
16119
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -16196,7 +16196,7 @@ var FragmentReadResultState;
16196
16196
  ({
16197
16197
  state: FragmentReadResultState.Missing,
16198
16198
  });
16199
- // engine version: 0.138.3-dee50acf
16199
+ // engine version: 0.138.7-42a753b0
16200
16200
 
16201
16201
  const { keys: ObjectKeys$3, freeze: ObjectFreeze$3, create: ObjectCreate$3 } = Object;
16202
16202
 
@@ -44412,7 +44412,7 @@ withDefaultLuvio((luvio) => {
44412
44412
  dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
44413
44413
  });
44414
44414
  });
44415
- // version: 1.129.0-e6ee02f30
44415
+ // version: 1.130.8-4b70f5879
44416
44416
 
44417
44417
  var caseSensitiveUserId = '005B0000000GR4OIAW';
44418
44418
 
@@ -46536,6 +46536,7 @@ const recordPrefix = '.data.uiapi.query';
46536
46536
  const recordSuffix = 'edges';
46537
46537
  const pathPrefix = '$';
46538
46538
  const recordsCTE = 'recordsCTE';
46539
+ const MultiPickListValueSeparator$1 = ';';
46539
46540
  function cteSql() {
46540
46541
  return (`WITH ${recordsCTE} AS NOT materialized ` +
46541
46542
  `(select data from lds_data where key like 'UiApi::RecordRepresentation:%')`);
@@ -46704,16 +46705,26 @@ function existsPredicateToSql(exists) {
46704
46705
  }
46705
46706
  function comparisonPredicateToSql(predicate) {
46706
46707
  const operator = comparisonOperatorToSql(predicate.operator);
46707
- const { sql: left, bindings: leftBindings } = expressionToSql(predicate.left);
46708
+ let { sql: left, bindings: leftBindings } = expressionToSql(predicate.left, undefined, predicate.operator);
46708
46709
  if (predicate.right.type === ValueType.DateEnum ||
46709
46710
  predicate.right.type === ValueType.DateTimeEnum ||
46710
46711
  predicate.right.type === ValueType.DateArray ||
46711
46712
  predicate.right.type === ValueType.DateTimeArray ||
46712
- predicate.right.type === ValueType.DateValue) {
46713
- const fieldDateValue = `date(${left})`;
46713
+ predicate.right.type === ValueType.DateValue ||
46714
+ predicate.right.type === ValueType.DateTimeValue) {
46715
+ const dateFunction = predicate.right.type === ValueType.DateTimeEnum ||
46716
+ predicate.right.type === ValueType.DateTimeArray ||
46717
+ predicate.right.type === ValueType.DateTimeValue
46718
+ ? 'datetime'
46719
+ : 'date';
46720
+ const fieldDateValue = `${dateFunction}(${left})`;
46714
46721
  return comparisonDateLiteralToSql(fieldDateValue, predicate.operator, predicate.right);
46715
46722
  }
46716
- const { sql: right, bindings: rightBindings } = expressionToSql(predicate.right);
46723
+ if (predicate.right.type === ValueType.RelativeDate) {
46724
+ const dateFunc = predicate.right.hasTime ? 'datetime' : 'date';
46725
+ left = `${dateFunc}(${left})`;
46726
+ }
46727
+ const { sql: right, bindings: rightBindings } = expressionToSql(predicate.right, undefined, predicate.operator);
46717
46728
  let bindings = leftBindings.concat(rightBindings);
46718
46729
  if (predicate.operator === ComparisonOperator.eq &&
46719
46730
  predicate.right.type === ValueType.StringLiteral &&
@@ -46798,11 +46809,21 @@ function coerceToTargetDataType(initialSql, targetDataType) {
46798
46809
  return initialSql;
46799
46810
  }
46800
46811
  }
46801
- function expressionToSql(expression, targetDataType) {
46812
+ function expressionToSql(expression, targetDataType, operator) {
46802
46813
  switch (expression.type) {
46803
46814
  case ValueType.Extract: {
46815
+ // displayValue's for Booleans are special, they return null
46816
+ if (expression.subfield === 'displayValue' && targetDataType === 'Boolean') {
46817
+ return { sql: 'null', bindings: [] };
46818
+ }
46804
46819
  let path = extractPath(expression.field, expression.subfield);
46805
- let sql = `json_extract("${expression.jsonAlias}.JSON", '${pathPrefix}.${path}')`;
46820
+ // For multiple picklist includes/excluding filtering, we need to prefix and suffix the field value with ';'
46821
+ // to make the match safe.
46822
+ // sample: field value: 'item12;item123', input value is 'item1'; they need to be converted to
46823
+ // ';item12;item123;' and '%;item1;%' first, then do sqlite like operation.
46824
+ let sql = operator === ComparisonOperator.includes || operator === ComparisonOperator.excludes
46825
+ ? `'${MultiPickListValueSeparator$1}' || json_extract("${expression.jsonAlias}.JSON", '${pathPrefix}.${path}') || '${MultiPickListValueSeparator$1}'`
46826
+ : `json_extract("${expression.jsonAlias}.JSON", '${pathPrefix}.${path}')`;
46806
46827
  if (targetDataType !== undefined) {
46807
46828
  sql = coerceToTargetDataType(sql, targetDataType);
46808
46829
  }
@@ -46849,7 +46870,7 @@ function expressionToSql(expression, targetDataType) {
46849
46870
  case ValueType.StringLiteral:
46850
46871
  return stringLiteralToSql(expression);
46851
46872
  case ValueType.MultiPicklistSet:
46852
- return multiPicklistToSql$1(expression);
46873
+ return multiPicklistToSql$1(expression, operator);
46853
46874
  }
46854
46875
  }
46855
46876
  function stringLiteralToSql(string) {
@@ -46865,14 +46886,18 @@ function expressionArrayToSql(expressions, toSql) {
46865
46886
  const bindings = results.length > 0 ? results.map((v) => v.bindings).reduce(flatten$1) : [];
46866
46887
  return { sql, bindings };
46867
46888
  }
46868
- function multiPicklistToSql$1({ value }) {
46889
+ function multiPicklistToSql$1({ value }, operator) {
46869
46890
  // Individual multipicklist terms that delimited by semicolon are stored server-side
46870
46891
  // as lexically sorted strings and treated like logical ANDs. We can approximate this
46871
46892
  // behavior in SQL with wildcarded `LIKE` SQL operators. Terms with no delimiter can
46872
46893
  // be treated as string literals. Multiple terms are logically OR'd together to
46873
46894
  // match the behavior described in SOQL documentation (https://sfdc.co/c9j0r)
46895
+ // To make sure the match is safe for includes/excludes. the value is prefix and
46896
+ // suffix with ';', like 'abc' to '%;abc;%'. raw value for eq and ne.
46874
46897
  const sql = '?';
46875
- const binding = value && value.includes(';') ? `'%${value.split(';').join('%')}%'` : `'%${value}%'`;
46898
+ const binding = operator === ComparisonOperator.includes || operator === ComparisonOperator.excludes
46899
+ ? `%${MultiPickListValueSeparator$1}${value}${MultiPickListValueSeparator$1}%`
46900
+ : value;
46876
46901
  return { sql, bindings: [binding] };
46877
46902
  }
46878
46903
  function relativeDateToSql(expression) {
@@ -46943,8 +46968,12 @@ function comparisonDateLiteralToSql(leftOperand, operator, dateInput) {
46943
46968
  }
46944
46969
  }
46945
46970
  if (dateInput.type === ValueType.DateValue || dateInput.type === ValueType.DateTimeValue) {
46971
+ const dateFunction = dateInput.type === ValueType.DateTimeValue ? 'datetime' : 'date';
46946
46972
  const compOperator = comparisonOperatorToSql(operator);
46947
- return { sql: leftOperand + ` ${compOperator} ` + '?', bindings: [`${dateInput.value}`] };
46973
+ return {
46974
+ sql: leftOperand + ` ${compOperator} ` + `${dateFunction}(?)`,
46975
+ bindings: [`${dateInput.value}`],
46976
+ };
46948
46977
  }
46949
46978
  return { sql: '', bindings: [] };
46950
46979
  }
@@ -47175,15 +47204,41 @@ function fieldFilter(fieldName, fieldNode, alias, apiName, input, joins) {
47175
47204
  return dateRangeComparison(op.value, op.operator, extract);
47176
47205
  }
47177
47206
  if (op.type === 'MultiPicklistSetOperator') {
47207
+ const operator = op.operator === ComparisonOperator.includes
47208
+ ? CompoundOperator.or
47209
+ : CompoundOperator.and;
47210
+ const children = [];
47211
+ const length = op.value.value.length;
47212
+ for (let i = 0; i < length; i++) {
47213
+ const term = op.value.value[i];
47214
+ if (term !== null) {
47215
+ const splittedValue = term.split(MultiPickListValueSeparator$1);
47216
+ if (splittedValue.length === 1) {
47217
+ children.push(comparison(extract, op.operator, {
47218
+ type: ValueType.MultiPicklistSet,
47219
+ value: term,
47220
+ }));
47221
+ }
47222
+ else {
47223
+ children.push({
47224
+ type: PredicateType$1.compound,
47225
+ operator: op.operator === ComparisonOperator.includes
47226
+ ? CompoundOperator.and
47227
+ : CompoundOperator.or,
47228
+ children: splittedValue.map((singleValue) => {
47229
+ return comparison(extract, op.operator, {
47230
+ type: ValueType.MultiPicklistSet,
47231
+ value: singleValue,
47232
+ });
47233
+ }),
47234
+ });
47235
+ }
47236
+ }
47237
+ }
47178
47238
  return {
47179
47239
  type: PredicateType$1.compound,
47180
- operator: CompoundOperator.or,
47181
- children: op.value.value.map((term) => {
47182
- return comparison(extract, op.operator, {
47183
- type: ValueType.MultiPicklistSet,
47184
- value: term,
47185
- });
47186
- }),
47240
+ operator,
47241
+ children,
47187
47242
  };
47188
47243
  }
47189
47244
  if (op.type === 'StringSetOperator' && op.value.value.includes(null)) {
@@ -47247,8 +47302,6 @@ function dateRangeComparison(dateRange, operator, compareDate) {
47247
47302
  return comparison(compareDate, gte, dateRange.start);
47248
47303
  }
47249
47304
  }
47250
- const dateRegEx = /^([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))$/;
47251
- const dateTimeRegEx = /^([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))T(2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9](\.[0-9]{3})?Z$/;
47252
47305
  function dateFunctions(operatorNode, extract, dataType) {
47253
47306
  if (dataType !== 'Date' && dataType !== 'DateTime') {
47254
47307
  return success([]);
@@ -47326,7 +47379,7 @@ function isStringOperatorType(value) {
47326
47379
  return isScalarOperatorType(value) || value === like;
47327
47380
  }
47328
47381
  function isPicklistOperatorType(value) {
47329
- let values = [eq, ne];
47382
+ let values = [eq, ne, like, lt, gt, lte, gte];
47330
47383
  return values.includes(value);
47331
47384
  }
47332
47385
  function isCurrencyOperatorType(value) {
@@ -47677,8 +47730,11 @@ function operatorWithValue(operator, valueNode, objectInfoDataType) {
47677
47730
  message(`Comparison operator ${operator} is not supported for type ${objectInfoDataType}.`),
47678
47731
  ]);
47679
47732
  }
47733
+ function isValidDate(value) {
47734
+ return isNaN(Date.parse(value)) === false;
47735
+ }
47680
47736
  function dateInput(node) {
47681
- return parseDateNode(node, dateRegEx, false, 'YYYY-MM-DD').map((result) => {
47737
+ return parseDateNode(node, false, 'YYYY-MM-DD', isValidDate).map((result) => {
47682
47738
  switch (result.type) {
47683
47739
  case ValueType.NullValue:
47684
47740
  return result;
@@ -47692,7 +47748,7 @@ function dateInput(node) {
47692
47748
  });
47693
47749
  }
47694
47750
  function dateTimeInput(node) {
47695
- return parseDateNode(node, dateTimeRegEx, true, 'YYYY-MM-DDTHH:MM:SS.SSSZ or YYYY-MM-DDTHH:MM:SSZ').map((result) => {
47751
+ return parseDateNode(node, true, 'YYYY-MM-DDTHH:MM:SS.SSSZ, YYYY-MM-DDTHH:MM:SSZ, YYYY-MM-DDTHH:MM:SS.SSS+|-HH:MM, or YYYY-MM-DDTHH:MM:SS+|-HH:MM', isValidDate).map((result) => {
47696
47752
  switch (result.type) {
47697
47753
  case ValueType.NullValue:
47698
47754
  return result;
@@ -47717,7 +47773,7 @@ function parseNullValue(op) {
47717
47773
  }
47718
47774
  return failure(message(`Null can not be compared with ${op}`));
47719
47775
  }
47720
- function parseDateNode(node, regex, hasTime, dateFormat) {
47776
+ function parseDateNode(node, hasTime, dateFormat, isValidDate) {
47721
47777
  const typeName = hasTime ? 'DateTime' : 'Date';
47722
47778
  if (!isObjectValueNode$1(node)) {
47723
47779
  return failure(message(`Comparison value must be a ${typeName} input.`));
@@ -47725,7 +47781,12 @@ function parseDateNode(node, regex, hasTime, dateFormat) {
47725
47781
  const valueField = node.fields.value;
47726
47782
  if (valueField !== undefined) {
47727
47783
  if (is(valueField, 'StringValue')) {
47728
- if (valueField.value.match(regex)) {
47784
+ // check the date is valid
47785
+ // then make sure if it isnt suppose to contain time stamps that it doesnt
47786
+ // and if it should have a timestamp it should contain it
47787
+ const includesTimeStamp = valueField.value.includes('T');
47788
+ if (isValidDate(valueField.value) &&
47789
+ ((hasTime && includesTimeStamp) || (!hasTime && !includesTimeStamp))) {
47729
47790
  return success(stringLiteral(valueField.value));
47730
47791
  }
47731
47792
  return failure(message(`${typeName} format must be ${dateFormat}.`));
@@ -48717,7 +48778,20 @@ function makeStoreEval(preconditioner, objectInfoService, userId, contextProvide
48717
48778
  // await it here to normalize the input to a snapshot
48718
48779
  const nonEvaluatedSnapshot = await nonEvaluatedSnapshotOrPromise;
48719
48780
  // if the non-eval result has errors we want to return to caller
48720
- if (isErrorSnapshotThatShouldGetReturnedToCaller$1(nonEvaluatedSnapshot)) {
48781
+ const nonEvaluatedGQLSnapshot = nonEvaluatedSnapshot;
48782
+ if (isErrorSnapshotThatShouldGetReturnedToCaller$1(nonEvaluatedGQLSnapshot)) {
48783
+ const { data: gqlData } = nonEvaluatedGQLSnapshot;
48784
+ if (hasGraphQlErrors$1(gqlData) && gqlData !== undefined) {
48785
+ return {
48786
+ ...nonEvaluatedSnapshot,
48787
+ data: undefined,
48788
+ state: 'Error',
48789
+ error: {
48790
+ errorType: 'adapterError',
48791
+ error: gqlData.errors,
48792
+ },
48793
+ };
48794
+ }
48721
48795
  return nonEvaluatedSnapshot;
48722
48796
  }
48723
48797
  let rootQuery;
@@ -51298,9 +51372,18 @@ function filterToPredicates(where, recordType, alias, objectInfoMap, joins, draf
51298
51372
  const makePredicate = fieldInfo.dataType === 'MultiPicklist'
51299
51373
  ? createMultiPicklistPredicate
51300
51374
  : createSinglePredicate;
51301
- predicates.push(makePredicate(idProcessingNeeded
51302
- ? sanitizePredicateIDValue(value, draftFunctions)
51303
- : value, operator, fieldInfo, alias));
51375
+ const predicate = makePredicate(idProcessingNeeded ? sanitizePredicateIDValue(value, draftFunctions) : value, operator, fieldInfo, alias);
51376
+ // for the case where we have a not equals predicate that's value is not null
51377
+ // we need to compound into an or statement to also inlcude the null values for that field
51378
+ if (operator === '!=' && typeof value === 'string') {
51379
+ // create a is null predicate
51380
+ const isNullPredicate = createSinglePredicate(null, '=', fieldInfo, alias);
51381
+ // compound the predicates into an or predicate
51382
+ predicates.push(transformCompoundPredicate('or', [predicate, isNullPredicate]));
51383
+ }
51384
+ else {
51385
+ predicates.push(predicate);
51386
+ }
51304
51387
  }
51305
51388
  }
51306
51389
  }
@@ -59925,7 +60008,7 @@ register({
59925
60008
  id: '@salesforce/lds-network-adapter',
59926
60009
  instrument: instrument$1,
59927
60010
  });
59928
- // version: 1.129.0-caa83ed0e
60011
+ // version: 1.130.8-e6645fb41
59929
60012
 
59930
60013
  const { create: create$2, keys: keys$2 } = Object;
59931
60014
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -60235,16 +60318,27 @@ function trimEdges(edges, startOffset, endOffset) {
60235
60318
  return trimmedEdges;
60236
60319
  }
60237
60320
  function optimizePagination(metadata, firstArgName, afterArgName, variables) {
60238
- if (typeof metadata === 'object' && metadata !== null && offsetFromToken(metadata, variables[afterArgName]) >= 0) {
60321
+ if (typeof metadata === 'object' && metadata !== null) {
60322
+ const requestedAfterCursor = variables[afterArgName];
60323
+ const afterCursorOffset = offsetFromToken(metadata, requestedAfterCursor);
60239
60324
  // optimize only if after cursor is unspecified in the request or it's already loaded in metadata
60240
- const length = Object.keys(metadata).length;
60241
- const lastTokenAndOffset = tokenForAtMost(metadata, length);
60242
- if (lastTokenAndOffset !== undefined) {
60243
- const [token, offset] = lastTokenAndOffset;
60244
- variables[firstArgName + '_original'] = variables[firstArgName];
60245
- variables[afterArgName + '_original'] = variables[afterArgName];
60246
- variables[firstArgName] -= variables[afterArgName] === null ? (offset + 1) : (offset - 1);
60247
- variables[afterArgName] = token;
60325
+ if (afterCursorOffset >= 0) {
60326
+ const requestedItems = variables[firstArgName];
60327
+ const atMostOffset = afterCursorOffset + requestedItems; // The largest offset we care about for this page.
60328
+ const lastTokenAndOffset = tokenForAtMost(metadata, atMostOffset);
60329
+ if (lastTokenAndOffset !== undefined) {
60330
+ const [token, offset] = lastTokenAndOffset;
60331
+ const isSubpage = atMostOffset === offset; // We already have all the cursors we seem to need
60332
+ const isExactPagination = atMostOffset === offset + requestedItems; // Using the last cursor we have to paginate
60333
+ if (!(isSubpage || isExactPagination)) { // If we're asking for more than we have, only request what we're missing.
60334
+ const existingItems = afterCursorOffset === 0 ? offset + 1 : offset - afterCursorOffset;
60335
+ const itemsToRequest = requestedItems - existingItems;
60336
+ variables[firstArgName + '_original'] = requestedItems;
60337
+ variables[firstArgName] = itemsToRequest;
60338
+ variables[afterArgName + '_original'] = requestedAfterCursor;
60339
+ variables[afterArgName] = token;
60340
+ }
60341
+ }
60248
60342
  }
60249
60343
  }
60250
60344
  }
@@ -66482,7 +66576,13 @@ function ingestPaginationMetadata(astNode, state, key, sink, existingData) {
66482
66576
  : 0;
66483
66577
  const nextOffset = startOffset + edges.length;
66484
66578
  const incomingPaginationMetadata = createPaginationMetadata(startOffset, edges);
66485
- if (!hasNextPage) {
66579
+ if (hasNextPage) {
66580
+ // Cleanup any __END__ cursors that are before than the newly ingested page
66581
+ if (existingPaginationMetadata !== undefined && existingPaginationMetadata.__END__ !== undefined && existingPaginationMetadata.__END__ < nextOffset) {
66582
+ delete existingPaginationMetadata.__END__;
66583
+ }
66584
+ }
66585
+ else {
66486
66586
  incomingPaginationMetadata.__END__ = nextOffset;
66487
66587
  }
66488
66588
  // store the updated pagination metadata
@@ -72759,6 +72859,25 @@ function selectTypeLink(sel, fieldData, reader, key, sink, variables, fragments,
72759
72859
  reader.markMissing();
72760
72860
  }
72761
72861
  }
72862
+ function augmentDefaultVariableValues(variableDefinitions, variables) {
72863
+ variableDefinitions.forEach(({ defaultValue, variable }) => {
72864
+ if (defaultValue !== undefined && variables[variable.name.value] === undefined) {
72865
+ switch (defaultValue.kind) {
72866
+ case ("IntValue"):
72867
+ case ("FloatValue"):
72868
+ variables[variable.name.value] = Number(defaultValue.value);
72869
+ break;
72870
+ case ("NullValue"):
72871
+ variables[variable.name.value] = null;
72872
+ break;
72873
+ case ("BooleanValue"):
72874
+ case ("StringValue"):
72875
+ case ("EnumValue"):
72876
+ variables[variable.name.value] = defaultValue.value;
72877
+ }
72878
+ }
72879
+ });
72880
+ }
72762
72881
  function selectTypeLinkWithPagination(resolvedLink, sel, fieldData, reader, key, sink, variables, fragments, selectFn) {
72763
72882
  var _a, _b, _c, _d, _e;
72764
72883
  const source = resolvedLink.data.data;
@@ -72926,6 +73045,9 @@ function select$8(luvio, query, variables) {
72926
73045
  }
72927
73046
  function ingestOperationNode(luvio, input, node, state) {
72928
73047
  if (node.operation === 'query') {
73048
+ if (node.variableDefinitions !== undefined) {
73049
+ augmentDefaultVariableValues(node.variableDefinitions, state.variables);
73050
+ }
72929
73051
  ingest$1(node, {
72930
73052
  ...state,
72931
73053
  path: {
@@ -74194,7 +74316,7 @@ register({
74194
74316
  configuration: { ...configurationForGraphQLAdapters },
74195
74317
  instrument,
74196
74318
  });
74197
- // version: 1.129.0-e6ee02f30
74319
+ // version: 1.130.8-4b70f5879
74198
74320
 
74199
74321
  // On core the unstable adapters are re-exported with different names,
74200
74322
 
@@ -76323,7 +76445,7 @@ withDefaultLuvio((luvio) => {
76323
76445
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
76324
76446
  graphQLImperative = ldsAdapter;
76325
76447
  });
76326
- // version: 1.129.0-e6ee02f30
76448
+ // version: 1.130.8-4b70f5879
76327
76449
 
76328
76450
  var gqlApi = /*#__PURE__*/Object.freeze({
76329
76451
  __proto__: null,
@@ -77015,4 +77137,4 @@ const { luvio } = getRuntime();
77015
77137
  setDefaultLuvio({ luvio });
77016
77138
 
77017
77139
  export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
77018
- // version: 1.129.0-caa83ed0e
77140
+ // version: 1.130.8-e6645fb41
@@ -2063,24 +2063,24 @@
2063
2063
  object(propertyName) {
2064
2064
  const value = this.data[propertyName];
2065
2065
  if (isNodeLink(value)) {
2066
- throw new Error(`Cannot walk to path ${propertyName}. "${propertyName}" is a link: "${value}"`);
2066
+ throw new Error(`Cannot walk to path ${String(propertyName)}. "${String(propertyName)}" is a link: "${value}"`);
2067
2067
  }
2068
2068
  if (typeof value !== 'object' || value === null) {
2069
- throw new Error(`Cannot walk to path ${propertyName}. "${propertyName}" is a scalar: "${value}"`);
2069
+ throw new Error(`Cannot walk to path ${String(propertyName)}. "${String(propertyName)}" is a scalar: "${value}"`);
2070
2070
  }
2071
2071
  return new GraphNode(this.store, value);
2072
2072
  }
2073
2073
  link(propertyName) {
2074
2074
  const value = this.data[propertyName];
2075
2075
  if (!isNodeLink(value)) {
2076
- throw new Error(`Cannot walk to link ${propertyName}. "${propertyName}" is not a link: "${value}"`);
2076
+ throw new Error(`Cannot walk to link ${String(propertyName)}. "${String(propertyName)}" is not a link: "${value}"`);
2077
2077
  }
2078
2078
  return new GraphLink(this.store, value);
2079
2079
  }
2080
2080
  scalar(propertyName) {
2081
2081
  const value = this.data[propertyName];
2082
2082
  if (typeof value === 'object' && value !== null) {
2083
- throw new Error(`Cannot return value at path ${propertyName}. ${propertyName} is not a scalar.`);
2083
+ throw new Error(`Cannot return value at path ${String(propertyName)}. ${String(propertyName)} is not a scalar.`);
2084
2084
  }
2085
2085
  return value;
2086
2086
  }
@@ -3655,7 +3655,7 @@
3655
3655
  return this.environment.buildStructuredKey(namespace, representationName, idValues);
3656
3656
  }
3657
3657
  }
3658
- // engine version: 0.138.3-dee50acf
3658
+ // engine version: 0.138.7-42a753b0
3659
3659
 
3660
3660
  /**
3661
3661
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -3782,7 +3782,7 @@
3782
3782
  }
3783
3783
  callbacks.push(callback);
3784
3784
  }
3785
- // version: 1.129.0-caa83ed0e
3785
+ // version: 1.130.8-e6645fb41
3786
3786
 
3787
3787
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
3788
3788
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15206,7 +15206,7 @@
15206
15206
  updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
15207
15207
  return luvioDocumentNode;
15208
15208
  }
15209
- // version: 1.129.0-caa83ed0e
15209
+ // version: 1.130.8-e6645fb41
15210
15210
 
15211
15211
  function unwrap(data) {
15212
15212
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16119,7 +16119,7 @@
16119
16119
  const { apiFamily, name } = metadata;
16120
16120
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16121
16121
  }
16122
- // version: 1.129.0-caa83ed0e
16122
+ // version: 1.130.8-e6645fb41
16123
16123
 
16124
16124
  /**
16125
16125
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -16202,7 +16202,7 @@
16202
16202
  ({
16203
16203
  state: FragmentReadResultState.Missing,
16204
16204
  });
16205
- // engine version: 0.138.3-dee50acf
16205
+ // engine version: 0.138.7-42a753b0
16206
16206
 
16207
16207
  const { keys: ObjectKeys$3, freeze: ObjectFreeze$3, create: ObjectCreate$3 } = Object;
16208
16208
 
@@ -44418,7 +44418,7 @@
44418
44418
  dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
44419
44419
  });
44420
44420
  });
44421
- // version: 1.129.0-e6ee02f30
44421
+ // version: 1.130.8-4b70f5879
44422
44422
 
44423
44423
  var caseSensitiveUserId = '005B0000000GR4OIAW';
44424
44424
 
@@ -46542,6 +46542,7 @@
46542
46542
  const recordSuffix = 'edges';
46543
46543
  const pathPrefix = '$';
46544
46544
  const recordsCTE = 'recordsCTE';
46545
+ const MultiPickListValueSeparator$1 = ';';
46545
46546
  function cteSql() {
46546
46547
  return (`WITH ${recordsCTE} AS NOT materialized ` +
46547
46548
  `(select data from lds_data where key like 'UiApi::RecordRepresentation:%')`);
@@ -46710,16 +46711,26 @@
46710
46711
  }
46711
46712
  function comparisonPredicateToSql(predicate) {
46712
46713
  const operator = comparisonOperatorToSql(predicate.operator);
46713
- const { sql: left, bindings: leftBindings } = expressionToSql(predicate.left);
46714
+ let { sql: left, bindings: leftBindings } = expressionToSql(predicate.left, undefined, predicate.operator);
46714
46715
  if (predicate.right.type === ValueType.DateEnum ||
46715
46716
  predicate.right.type === ValueType.DateTimeEnum ||
46716
46717
  predicate.right.type === ValueType.DateArray ||
46717
46718
  predicate.right.type === ValueType.DateTimeArray ||
46718
- predicate.right.type === ValueType.DateValue) {
46719
- const fieldDateValue = `date(${left})`;
46719
+ predicate.right.type === ValueType.DateValue ||
46720
+ predicate.right.type === ValueType.DateTimeValue) {
46721
+ const dateFunction = predicate.right.type === ValueType.DateTimeEnum ||
46722
+ predicate.right.type === ValueType.DateTimeArray ||
46723
+ predicate.right.type === ValueType.DateTimeValue
46724
+ ? 'datetime'
46725
+ : 'date';
46726
+ const fieldDateValue = `${dateFunction}(${left})`;
46720
46727
  return comparisonDateLiteralToSql(fieldDateValue, predicate.operator, predicate.right);
46721
46728
  }
46722
- const { sql: right, bindings: rightBindings } = expressionToSql(predicate.right);
46729
+ if (predicate.right.type === ValueType.RelativeDate) {
46730
+ const dateFunc = predicate.right.hasTime ? 'datetime' : 'date';
46731
+ left = `${dateFunc}(${left})`;
46732
+ }
46733
+ const { sql: right, bindings: rightBindings } = expressionToSql(predicate.right, undefined, predicate.operator);
46723
46734
  let bindings = leftBindings.concat(rightBindings);
46724
46735
  if (predicate.operator === ComparisonOperator.eq &&
46725
46736
  predicate.right.type === ValueType.StringLiteral &&
@@ -46804,11 +46815,21 @@
46804
46815
  return initialSql;
46805
46816
  }
46806
46817
  }
46807
- function expressionToSql(expression, targetDataType) {
46818
+ function expressionToSql(expression, targetDataType, operator) {
46808
46819
  switch (expression.type) {
46809
46820
  case ValueType.Extract: {
46821
+ // displayValue's for Booleans are special, they return null
46822
+ if (expression.subfield === 'displayValue' && targetDataType === 'Boolean') {
46823
+ return { sql: 'null', bindings: [] };
46824
+ }
46810
46825
  let path = extractPath(expression.field, expression.subfield);
46811
- let sql = `json_extract("${expression.jsonAlias}.JSON", '${pathPrefix}.${path}')`;
46826
+ // For multiple picklist includes/excluding filtering, we need to prefix and suffix the field value with ';'
46827
+ // to make the match safe.
46828
+ // sample: field value: 'item12;item123', input value is 'item1'; they need to be converted to
46829
+ // ';item12;item123;' and '%;item1;%' first, then do sqlite like operation.
46830
+ let sql = operator === ComparisonOperator.includes || operator === ComparisonOperator.excludes
46831
+ ? `'${MultiPickListValueSeparator$1}' || json_extract("${expression.jsonAlias}.JSON", '${pathPrefix}.${path}') || '${MultiPickListValueSeparator$1}'`
46832
+ : `json_extract("${expression.jsonAlias}.JSON", '${pathPrefix}.${path}')`;
46812
46833
  if (targetDataType !== undefined) {
46813
46834
  sql = coerceToTargetDataType(sql, targetDataType);
46814
46835
  }
@@ -46855,7 +46876,7 @@
46855
46876
  case ValueType.StringLiteral:
46856
46877
  return stringLiteralToSql(expression);
46857
46878
  case ValueType.MultiPicklistSet:
46858
- return multiPicklistToSql$1(expression);
46879
+ return multiPicklistToSql$1(expression, operator);
46859
46880
  }
46860
46881
  }
46861
46882
  function stringLiteralToSql(string) {
@@ -46871,14 +46892,18 @@
46871
46892
  const bindings = results.length > 0 ? results.map((v) => v.bindings).reduce(flatten$1) : [];
46872
46893
  return { sql, bindings };
46873
46894
  }
46874
- function multiPicklistToSql$1({ value }) {
46895
+ function multiPicklistToSql$1({ value }, operator) {
46875
46896
  // Individual multipicklist terms that delimited by semicolon are stored server-side
46876
46897
  // as lexically sorted strings and treated like logical ANDs. We can approximate this
46877
46898
  // behavior in SQL with wildcarded `LIKE` SQL operators. Terms with no delimiter can
46878
46899
  // be treated as string literals. Multiple terms are logically OR'd together to
46879
46900
  // match the behavior described in SOQL documentation (https://sfdc.co/c9j0r)
46901
+ // To make sure the match is safe for includes/excludes. the value is prefix and
46902
+ // suffix with ';', like 'abc' to '%;abc;%'. raw value for eq and ne.
46880
46903
  const sql = '?';
46881
- const binding = value && value.includes(';') ? `'%${value.split(';').join('%')}%'` : `'%${value}%'`;
46904
+ const binding = operator === ComparisonOperator.includes || operator === ComparisonOperator.excludes
46905
+ ? `%${MultiPickListValueSeparator$1}${value}${MultiPickListValueSeparator$1}%`
46906
+ : value;
46882
46907
  return { sql, bindings: [binding] };
46883
46908
  }
46884
46909
  function relativeDateToSql(expression) {
@@ -46949,8 +46974,12 @@
46949
46974
  }
46950
46975
  }
46951
46976
  if (dateInput.type === ValueType.DateValue || dateInput.type === ValueType.DateTimeValue) {
46977
+ const dateFunction = dateInput.type === ValueType.DateTimeValue ? 'datetime' : 'date';
46952
46978
  const compOperator = comparisonOperatorToSql(operator);
46953
- return { sql: leftOperand + ` ${compOperator} ` + '?', bindings: [`${dateInput.value}`] };
46979
+ return {
46980
+ sql: leftOperand + ` ${compOperator} ` + `${dateFunction}(?)`,
46981
+ bindings: [`${dateInput.value}`],
46982
+ };
46954
46983
  }
46955
46984
  return { sql: '', bindings: [] };
46956
46985
  }
@@ -47181,15 +47210,41 @@
47181
47210
  return dateRangeComparison(op.value, op.operator, extract);
47182
47211
  }
47183
47212
  if (op.type === 'MultiPicklistSetOperator') {
47213
+ const operator = op.operator === ComparisonOperator.includes
47214
+ ? CompoundOperator.or
47215
+ : CompoundOperator.and;
47216
+ const children = [];
47217
+ const length = op.value.value.length;
47218
+ for (let i = 0; i < length; i++) {
47219
+ const term = op.value.value[i];
47220
+ if (term !== null) {
47221
+ const splittedValue = term.split(MultiPickListValueSeparator$1);
47222
+ if (splittedValue.length === 1) {
47223
+ children.push(comparison(extract, op.operator, {
47224
+ type: ValueType.MultiPicklistSet,
47225
+ value: term,
47226
+ }));
47227
+ }
47228
+ else {
47229
+ children.push({
47230
+ type: PredicateType$1.compound,
47231
+ operator: op.operator === ComparisonOperator.includes
47232
+ ? CompoundOperator.and
47233
+ : CompoundOperator.or,
47234
+ children: splittedValue.map((singleValue) => {
47235
+ return comparison(extract, op.operator, {
47236
+ type: ValueType.MultiPicklistSet,
47237
+ value: singleValue,
47238
+ });
47239
+ }),
47240
+ });
47241
+ }
47242
+ }
47243
+ }
47184
47244
  return {
47185
47245
  type: PredicateType$1.compound,
47186
- operator: CompoundOperator.or,
47187
- children: op.value.value.map((term) => {
47188
- return comparison(extract, op.operator, {
47189
- type: ValueType.MultiPicklistSet,
47190
- value: term,
47191
- });
47192
- }),
47246
+ operator,
47247
+ children,
47193
47248
  };
47194
47249
  }
47195
47250
  if (op.type === 'StringSetOperator' && op.value.value.includes(null)) {
@@ -47253,8 +47308,6 @@
47253
47308
  return comparison(compareDate, gte, dateRange.start);
47254
47309
  }
47255
47310
  }
47256
- const dateRegEx = /^([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))$/;
47257
- const dateTimeRegEx = /^([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))T(2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9](\.[0-9]{3})?Z$/;
47258
47311
  function dateFunctions(operatorNode, extract, dataType) {
47259
47312
  if (dataType !== 'Date' && dataType !== 'DateTime') {
47260
47313
  return success([]);
@@ -47332,7 +47385,7 @@
47332
47385
  return isScalarOperatorType(value) || value === like;
47333
47386
  }
47334
47387
  function isPicklistOperatorType(value) {
47335
- let values = [eq, ne];
47388
+ let values = [eq, ne, like, lt, gt, lte, gte];
47336
47389
  return values.includes(value);
47337
47390
  }
47338
47391
  function isCurrencyOperatorType(value) {
@@ -47683,8 +47736,11 @@
47683
47736
  message(`Comparison operator ${operator} is not supported for type ${objectInfoDataType}.`),
47684
47737
  ]);
47685
47738
  }
47739
+ function isValidDate(value) {
47740
+ return isNaN(Date.parse(value)) === false;
47741
+ }
47686
47742
  function dateInput(node) {
47687
- return parseDateNode(node, dateRegEx, false, 'YYYY-MM-DD').map((result) => {
47743
+ return parseDateNode(node, false, 'YYYY-MM-DD', isValidDate).map((result) => {
47688
47744
  switch (result.type) {
47689
47745
  case ValueType.NullValue:
47690
47746
  return result;
@@ -47698,7 +47754,7 @@
47698
47754
  });
47699
47755
  }
47700
47756
  function dateTimeInput(node) {
47701
- return parseDateNode(node, dateTimeRegEx, true, 'YYYY-MM-DDTHH:MM:SS.SSSZ or YYYY-MM-DDTHH:MM:SSZ').map((result) => {
47757
+ return parseDateNode(node, true, 'YYYY-MM-DDTHH:MM:SS.SSSZ, YYYY-MM-DDTHH:MM:SSZ, YYYY-MM-DDTHH:MM:SS.SSS+|-HH:MM, or YYYY-MM-DDTHH:MM:SS+|-HH:MM', isValidDate).map((result) => {
47702
47758
  switch (result.type) {
47703
47759
  case ValueType.NullValue:
47704
47760
  return result;
@@ -47723,7 +47779,7 @@
47723
47779
  }
47724
47780
  return failure(message(`Null can not be compared with ${op}`));
47725
47781
  }
47726
- function parseDateNode(node, regex, hasTime, dateFormat) {
47782
+ function parseDateNode(node, hasTime, dateFormat, isValidDate) {
47727
47783
  const typeName = hasTime ? 'DateTime' : 'Date';
47728
47784
  if (!isObjectValueNode$1(node)) {
47729
47785
  return failure(message(`Comparison value must be a ${typeName} input.`));
@@ -47731,7 +47787,12 @@
47731
47787
  const valueField = node.fields.value;
47732
47788
  if (valueField !== undefined) {
47733
47789
  if (is(valueField, 'StringValue')) {
47734
- if (valueField.value.match(regex)) {
47790
+ // check the date is valid
47791
+ // then make sure if it isnt suppose to contain time stamps that it doesnt
47792
+ // and if it should have a timestamp it should contain it
47793
+ const includesTimeStamp = valueField.value.includes('T');
47794
+ if (isValidDate(valueField.value) &&
47795
+ ((hasTime && includesTimeStamp) || (!hasTime && !includesTimeStamp))) {
47735
47796
  return success(stringLiteral(valueField.value));
47736
47797
  }
47737
47798
  return failure(message(`${typeName} format must be ${dateFormat}.`));
@@ -48723,7 +48784,20 @@
48723
48784
  // await it here to normalize the input to a snapshot
48724
48785
  const nonEvaluatedSnapshot = await nonEvaluatedSnapshotOrPromise;
48725
48786
  // if the non-eval result has errors we want to return to caller
48726
- if (isErrorSnapshotThatShouldGetReturnedToCaller$1(nonEvaluatedSnapshot)) {
48787
+ const nonEvaluatedGQLSnapshot = nonEvaluatedSnapshot;
48788
+ if (isErrorSnapshotThatShouldGetReturnedToCaller$1(nonEvaluatedGQLSnapshot)) {
48789
+ const { data: gqlData } = nonEvaluatedGQLSnapshot;
48790
+ if (hasGraphQlErrors$1(gqlData) && gqlData !== undefined) {
48791
+ return {
48792
+ ...nonEvaluatedSnapshot,
48793
+ data: undefined,
48794
+ state: 'Error',
48795
+ error: {
48796
+ errorType: 'adapterError',
48797
+ error: gqlData.errors,
48798
+ },
48799
+ };
48800
+ }
48727
48801
  return nonEvaluatedSnapshot;
48728
48802
  }
48729
48803
  let rootQuery;
@@ -51304,9 +51378,18 @@
51304
51378
  const makePredicate = fieldInfo.dataType === 'MultiPicklist'
51305
51379
  ? createMultiPicklistPredicate
51306
51380
  : createSinglePredicate;
51307
- predicates.push(makePredicate(idProcessingNeeded
51308
- ? sanitizePredicateIDValue(value, draftFunctions)
51309
- : value, operator, fieldInfo, alias));
51381
+ const predicate = makePredicate(idProcessingNeeded ? sanitizePredicateIDValue(value, draftFunctions) : value, operator, fieldInfo, alias);
51382
+ // for the case where we have a not equals predicate that's value is not null
51383
+ // we need to compound into an or statement to also inlcude the null values for that field
51384
+ if (operator === '!=' && typeof value === 'string') {
51385
+ // create a is null predicate
51386
+ const isNullPredicate = createSinglePredicate(null, '=', fieldInfo, alias);
51387
+ // compound the predicates into an or predicate
51388
+ predicates.push(transformCompoundPredicate('or', [predicate, isNullPredicate]));
51389
+ }
51390
+ else {
51391
+ predicates.push(predicate);
51392
+ }
51310
51393
  }
51311
51394
  }
51312
51395
  }
@@ -59931,7 +60014,7 @@
59931
60014
  id: '@salesforce/lds-network-adapter',
59932
60015
  instrument: instrument$1,
59933
60016
  });
59934
- // version: 1.129.0-caa83ed0e
60017
+ // version: 1.130.8-e6645fb41
59935
60018
 
59936
60019
  const { create: create$2, keys: keys$2 } = Object;
59937
60020
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -60241,16 +60324,27 @@
60241
60324
  return trimmedEdges;
60242
60325
  }
60243
60326
  function optimizePagination(metadata, firstArgName, afterArgName, variables) {
60244
- if (typeof metadata === 'object' && metadata !== null && offsetFromToken(metadata, variables[afterArgName]) >= 0) {
60327
+ if (typeof metadata === 'object' && metadata !== null) {
60328
+ const requestedAfterCursor = variables[afterArgName];
60329
+ const afterCursorOffset = offsetFromToken(metadata, requestedAfterCursor);
60245
60330
  // optimize only if after cursor is unspecified in the request or it's already loaded in metadata
60246
- const length = Object.keys(metadata).length;
60247
- const lastTokenAndOffset = tokenForAtMost(metadata, length);
60248
- if (lastTokenAndOffset !== undefined) {
60249
- const [token, offset] = lastTokenAndOffset;
60250
- variables[firstArgName + '_original'] = variables[firstArgName];
60251
- variables[afterArgName + '_original'] = variables[afterArgName];
60252
- variables[firstArgName] -= variables[afterArgName] === null ? (offset + 1) : (offset - 1);
60253
- variables[afterArgName] = token;
60331
+ if (afterCursorOffset >= 0) {
60332
+ const requestedItems = variables[firstArgName];
60333
+ const atMostOffset = afterCursorOffset + requestedItems; // The largest offset we care about for this page.
60334
+ const lastTokenAndOffset = tokenForAtMost(metadata, atMostOffset);
60335
+ if (lastTokenAndOffset !== undefined) {
60336
+ const [token, offset] = lastTokenAndOffset;
60337
+ const isSubpage = atMostOffset === offset; // We already have all the cursors we seem to need
60338
+ const isExactPagination = atMostOffset === offset + requestedItems; // Using the last cursor we have to paginate
60339
+ if (!(isSubpage || isExactPagination)) { // If we're asking for more than we have, only request what we're missing.
60340
+ const existingItems = afterCursorOffset === 0 ? offset + 1 : offset - afterCursorOffset;
60341
+ const itemsToRequest = requestedItems - existingItems;
60342
+ variables[firstArgName + '_original'] = requestedItems;
60343
+ variables[firstArgName] = itemsToRequest;
60344
+ variables[afterArgName + '_original'] = requestedAfterCursor;
60345
+ variables[afterArgName] = token;
60346
+ }
60347
+ }
60254
60348
  }
60255
60349
  }
60256
60350
  }
@@ -66488,7 +66582,13 @@
66488
66582
  : 0;
66489
66583
  const nextOffset = startOffset + edges.length;
66490
66584
  const incomingPaginationMetadata = createPaginationMetadata(startOffset, edges);
66491
- if (!hasNextPage) {
66585
+ if (hasNextPage) {
66586
+ // Cleanup any __END__ cursors that are before than the newly ingested page
66587
+ if (existingPaginationMetadata !== undefined && existingPaginationMetadata.__END__ !== undefined && existingPaginationMetadata.__END__ < nextOffset) {
66588
+ delete existingPaginationMetadata.__END__;
66589
+ }
66590
+ }
66591
+ else {
66492
66592
  incomingPaginationMetadata.__END__ = nextOffset;
66493
66593
  }
66494
66594
  // store the updated pagination metadata
@@ -72765,6 +72865,25 @@
72765
72865
  reader.markMissing();
72766
72866
  }
72767
72867
  }
72868
+ function augmentDefaultVariableValues(variableDefinitions, variables) {
72869
+ variableDefinitions.forEach(({ defaultValue, variable }) => {
72870
+ if (defaultValue !== undefined && variables[variable.name.value] === undefined) {
72871
+ switch (defaultValue.kind) {
72872
+ case ("IntValue"):
72873
+ case ("FloatValue"):
72874
+ variables[variable.name.value] = Number(defaultValue.value);
72875
+ break;
72876
+ case ("NullValue"):
72877
+ variables[variable.name.value] = null;
72878
+ break;
72879
+ case ("BooleanValue"):
72880
+ case ("StringValue"):
72881
+ case ("EnumValue"):
72882
+ variables[variable.name.value] = defaultValue.value;
72883
+ }
72884
+ }
72885
+ });
72886
+ }
72768
72887
  function selectTypeLinkWithPagination(resolvedLink, sel, fieldData, reader, key, sink, variables, fragments, selectFn) {
72769
72888
  var _a, _b, _c, _d, _e;
72770
72889
  const source = resolvedLink.data.data;
@@ -72932,6 +73051,9 @@
72932
73051
  }
72933
73052
  function ingestOperationNode(luvio, input, node, state) {
72934
73053
  if (node.operation === 'query') {
73054
+ if (node.variableDefinitions !== undefined) {
73055
+ augmentDefaultVariableValues(node.variableDefinitions, state.variables);
73056
+ }
72935
73057
  ingest$1(node, {
72936
73058
  ...state,
72937
73059
  path: {
@@ -74200,7 +74322,7 @@
74200
74322
  configuration: { ...configurationForGraphQLAdapters },
74201
74323
  instrument,
74202
74324
  });
74203
- // version: 1.129.0-e6ee02f30
74325
+ // version: 1.130.8-4b70f5879
74204
74326
 
74205
74327
  // On core the unstable adapters are re-exported with different names,
74206
74328
 
@@ -76329,7 +76451,7 @@
76329
76451
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
76330
76452
  graphQLImperative = ldsAdapter;
76331
76453
  });
76332
- // version: 1.129.0-e6ee02f30
76454
+ // version: 1.130.8-4b70f5879
76333
76455
 
76334
76456
  var gqlApi = /*#__PURE__*/Object.freeze({
76335
76457
  __proto__: null,
@@ -77038,4 +77160,4 @@
77038
77160
  Object.defineProperty(exports, '__esModule', { value: true });
77039
77161
 
77040
77162
  }));
77041
- // version: 1.129.0-caa83ed0e
77163
+ // version: 1.130.8-e6645fb41
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-worker-api",
3
- "version": "1.129.0",
3
+ "version": "1.130.8",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "",
6
6
  "main": "dist/standalone/es/lds-worker-api.js",