@salesforce/lds-adapters-uiapi 1.321.0 → 1.323.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-uiapi",
3
- "version": "1.321.0",
3
+ "version": "1.323.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "Wire adapters for record related UI API endpoints",
6
6
  "main": "dist/es/es2018/uiapi-records-service.js",
@@ -68,20 +68,20 @@
68
68
  }
69
69
  },
70
70
  "dependencies": {
71
- "@salesforce/lds-bindings": "^1.321.0",
72
- "@salesforce/lds-default-luvio": "^1.321.0"
71
+ "@salesforce/lds-bindings": "^1.323.0",
72
+ "@salesforce/lds-default-luvio": "^1.323.0"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@databases/sqlite": "^3.0.0",
76
- "@salesforce/lds-compiler-plugins": "^1.321.0",
77
- "@salesforce/lds-jest": "^1.321.0",
78
- "@salesforce/lds-store-binary": "^1.321.0"
76
+ "@salesforce/lds-compiler-plugins": "^1.323.0",
77
+ "@salesforce/lds-jest": "^1.323.0",
78
+ "@salesforce/lds-store-binary": "^1.323.0"
79
79
  },
80
80
  "luvioBundlesize": [
81
81
  {
82
82
  "path": "./sfdc/index.js",
83
83
  "maxSize": {
84
- "none": "1.65 MB",
84
+ "none": "1.7 MB",
85
85
  "min": "850 kB",
86
86
  "compressed": "120 kB"
87
87
  }
@@ -210,7 +210,7 @@ function createPageInfo(edges, startOffset, endOffset, maxOffset, metadata) {
210
210
  if (edges === undefined) {
211
211
  return undefined;
212
212
  }
213
- const listIsIncomplete = ((metadata === null || metadata === void 0 ? void 0 : metadata.__END__) === undefined);
213
+ const listIsIncomplete = (metadata?.__END__ === undefined);
214
214
  const hasNextPage = listIsIncomplete || (endOffset !== undefined && maxOffset !== undefined && (endOffset - 1 < maxOffset));
215
215
  const hasPreviousPage = startOffset !== undefined && startOffset > 0;
216
216
  let startCursor = null;
@@ -246,7 +246,7 @@ function findMaxOffset(metadata) {
246
246
  }
247
247
  // end is included in the above case.
248
248
  return Object.values(metadata)
249
- .reduce((acc, value) => Math.max(value !== null && value !== void 0 ? value : -1, acc), -1);
249
+ .reduce((acc, value) => Math.max(value ?? -1, acc), -1);
250
250
  }
251
251
  function getPageTokenAndOffset(paginationMetadata, token) {
252
252
  if (token === undefined) {
@@ -6656,14 +6656,13 @@ function mergeData$O(existingData, newData) {
6656
6656
  };
6657
6657
  }
6658
6658
  function ingestPaginationMetadata$3(astNode, state, key, sink, existingData) {
6659
- var _a;
6660
6659
  const { data, luvio, store } = state;
6661
6660
  const { pageInfo: { hasNextPage, startCursor }, edges } = data;
6662
6661
  if (!hasGraphQLPaginationFields(data))
6663
6662
  return;
6664
6663
  const paginationKey = key + '__pagination';
6665
6664
  let existingPaginationMetadata = store.readEntry(paginationKey);
6666
- const afterArg = (_a = astNode.arguments) === null || _a === void 0 ? void 0 : _a.find(argument => { return argument.name.value === 'after'; });
6665
+ const afterArg = astNode.arguments?.find(argument => { return argument.name.value === 'after'; });
6667
6666
  const afterArgVal = evaluateArgumentValue(afterArg, 'StringValue', state.variables);
6668
6667
  const isPagedResponse = afterArgVal !== undefined &&
6669
6668
  existingPaginationMetadata !== undefined &&
@@ -11918,14 +11917,13 @@ function mergeData$t(existingData, newData) {
11918
11917
  };
11919
11918
  }
11920
11919
  function ingestPaginationMetadata$2(astNode, state, key, sink, existingData) {
11921
- var _a;
11922
11920
  const { data, luvio, store } = state;
11923
11921
  const { pageInfo: { hasNextPage, startCursor }, edges } = data;
11924
11922
  if (!hasGraphQLPaginationFields(data))
11925
11923
  return;
11926
11924
  const paginationKey = key + '__pagination';
11927
11925
  let existingPaginationMetadata = store.readEntry(paginationKey);
11928
- const afterArg = (_a = astNode.arguments) === null || _a === void 0 ? void 0 : _a.find(argument => { return argument.name.value === 'after'; });
11926
+ const afterArg = astNode.arguments?.find(argument => { return argument.name.value === 'after'; });
11929
11927
  const afterArgVal = evaluateArgumentValue(afterArg, 'StringValue', state.variables);
11930
11928
  const isPagedResponse = afterArgVal !== undefined &&
11931
11929
  existingPaginationMetadata !== undefined &&
@@ -16832,14 +16830,13 @@ function mergeData$8(existingData, newData) {
16832
16830
  };
16833
16831
  }
16834
16832
  function ingestPaginationMetadata$1(astNode, state, key, sink, existingData) {
16835
- var _a;
16836
16833
  const { data, luvio, store } = state;
16837
16834
  const { pageInfo: { hasNextPage, startCursor }, edges } = data;
16838
16835
  if (!hasGraphQLPaginationFields(data))
16839
16836
  return;
16840
16837
  const paginationKey = key + '__pagination';
16841
16838
  let existingPaginationMetadata = store.readEntry(paginationKey);
16842
- const afterArg = (_a = astNode.arguments) === null || _a === void 0 ? void 0 : _a.find(argument => { return argument.name.value === 'after'; });
16839
+ const afterArg = astNode.arguments?.find(argument => { return argument.name.value === 'after'; });
16843
16840
  const afterArgVal = evaluateArgumentValue(afterArg, 'StringValue', state.variables);
16844
16841
  const isPagedResponse = afterArgVal !== undefined &&
16845
16842
  existingPaginationMetadata !== undefined &&
@@ -18187,14 +18184,13 @@ function mergeData$3(existingData, newData) {
18187
18184
  };
18188
18185
  }
18189
18186
  function ingestPaginationMetadata(astNode, state, key, sink, existingData) {
18190
- var _a;
18191
18187
  const { data, luvio, store } = state;
18192
18188
  const { pageInfo: { hasNextPage, startCursor }, edges } = data;
18193
18189
  if (!hasGraphQLPaginationFields(data))
18194
18190
  return;
18195
18191
  const paginationKey = key + '__pagination';
18196
18192
  let existingPaginationMetadata = store.readEntry(paginationKey);
18197
- const afterArg = (_a = astNode.arguments) === null || _a === void 0 ? void 0 : _a.find(argument => { return argument.name.value === 'after'; });
18193
+ const afterArg = astNode.arguments?.find(argument => { return argument.name.value === 'after'; });
18198
18194
  const afterArgVal = evaluateArgumentValue(afterArg, 'StringValue', state.variables);
18199
18195
  const isPagedResponse = afterArgVal !== undefined &&
18200
18196
  existingPaginationMetadata !== undefined &&
@@ -18440,6 +18436,23 @@ function getInContextFragmentType$d(fragment, fragmentMap) {
18440
18436
  return sharedGetFragmentType(fragment, fragmentMap);
18441
18437
  }
18442
18438
 
18439
+ function getFieldType$b(field) {
18440
+ switch (field.name.value) {
18441
+ case '__typename': {
18442
+ return {
18443
+ isArray: false,
18444
+ typename: 'String',
18445
+ };
18446
+ }
18447
+ default: {
18448
+ return {
18449
+ isArray: false,
18450
+ typename: 'Setup__SetupAggregateConnection',
18451
+ };
18452
+ }
18453
+ }
18454
+ }
18455
+
18443
18456
  const name$2 = 'Setup__SetupQueryAggregate';
18444
18457
  const VERSION$a = '0592284764c8e58016880e291b9ffb64';
18445
18458
  function keyBuilder$6(luvio, path, data) {
@@ -18557,24 +18570,6 @@ function getTypeCacheKeys$3(cacheKeySink, astNode, state) {
18557
18570
  }
18558
18571
  // Deal with mapped types' cache keys
18559
18572
  }
18560
- function getFieldType$b(field) {
18561
- switch (field.name.value) {
18562
- case '__typename': {
18563
- return {
18564
- isArray: false,
18565
- typename: 'String'
18566
- };
18567
- }
18568
- case 'recordQueryAggregate': {
18569
- return {
18570
- isArray: false,
18571
- typename: 'Setup__SetupAggregateConnection'
18572
- };
18573
- }
18574
- default:
18575
- return undefined;
18576
- }
18577
- }
18578
18573
  function ingestFieldByType$2(typename, parentKey, requestedField, sink, fieldKey, fieldData, state) {
18579
18574
  // TODO: add validation logic to only allow nullable fields to be null in the future
18580
18575
  if (fieldData === null) {
@@ -19612,8 +19607,7 @@ function applyToSelection$4(selection, directive, variables) {
19612
19607
  }
19613
19608
 
19614
19609
  function applyToSelection$3(selection, directive, variables) {
19615
- var _a;
19616
- const ifArg = (_a = directive.arguments) === null || _a === void 0 ? void 0 : _a.find(argument => argument.name.value === "if");
19610
+ const ifArg = directive.arguments?.find(argument => argument.name.value === "if");
19617
19611
  if (ifArg && ifArg.value) {
19618
19612
  if (ifArg.value.kind === "BooleanValue") {
19619
19613
  return ifArg.value.value ? selection : undefined;
@@ -19626,8 +19620,7 @@ function applyToSelection$3(selection, directive, variables) {
19626
19620
  }
19627
19621
 
19628
19622
  function applyToSelection$2(selection, directive, variables) {
19629
- var _a;
19630
- const ifArg = (_a = directive.arguments) === null || _a === void 0 ? void 0 : _a.find(argument => argument.name.value === "if");
19623
+ const ifArg = directive.arguments?.find(argument => argument.name.value === "if");
19631
19624
  if (ifArg && ifArg.value) {
19632
19625
  if (ifArg.value.kind === "BooleanValue") {
19633
19626
  return ifArg.value.value ? undefined : selection;
@@ -19801,7 +19794,7 @@ function injectSelectionSet(selectionSetNode, queryTransformHelper, fragmentMap)
19801
19794
  selections: queryTransformHelper.getMinimumSelections()
19802
19795
  };
19803
19796
  const mergedSelections = mergeSelectionSets(selectionSetNode, minimumSelectionSet);
19804
- mergedSelections === null || mergedSelections === void 0 ? void 0 : mergedSelections.selections.forEach(selection => {
19797
+ mergedSelections?.selections.forEach(selection => {
19805
19798
  if (selection.kind === 'Field') {
19806
19799
  const fieldType = queryTransformHelper.getFieldType(selection);
19807
19800
  const fieldTransformHelper = fieldType === undefined ? undefined : getQueryTransformerForType(fieldType.typename);
@@ -20438,13 +20431,12 @@ function evaluateArgumentValue(argumentNode, expectedKind, variables) {
20438
20431
  }
20439
20432
  // Shared export for getting the offset of the current page in the edges array
20440
20433
  function getArrayOffsetForPage(state, node, key) {
20441
- var _a;
20442
20434
  const { variables, data, store } = state;
20443
20435
  // if we have pagination metadata, see if we can locate either the start or
20444
20436
  // after cursor in it to determine the correct index to use for the fullPath
20445
20437
  const paginationKey = key + '__pagination';
20446
20438
  let existingPaginationMetadata = store.readEntry(paginationKey);
20447
- const afterArg = (_a = node.arguments) === null || _a === void 0 ? void 0 : _a.find(argument => { return argument.name.value === 'after'; });
20439
+ const afterArg = node.arguments?.find(argument => { return argument.name.value === 'after'; });
20448
20440
  const afterArgVal = evaluateArgumentValue(afterArg, 'StringValue', variables);
20449
20441
  if (existingPaginationMetadata !== undefined) {
20450
20442
  // if the starting cursor for current page exists in the existing metadata use that as offset
@@ -20574,8 +20566,7 @@ function augmentDefaultVariableValues(variableDefinitions, variables) {
20574
20566
  });
20575
20567
  }
20576
20568
  function selectCalculateSink(sink, field, buildSelectionForNodeFn, source, reader, variables, fragments, parentRecordId) {
20577
- var _a;
20578
- (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
20569
+ field.selectionSet?.selections.forEach((sel) => {
20579
20570
  const builtSelection = buildSelectionForNodeFn(source, reader, field, sel, variables, fragments, parentRecordId);
20580
20571
  if (builtSelection !== undefined) {
20581
20572
  deepMerge(sink, builtSelection);
@@ -20584,7 +20575,6 @@ function selectCalculateSink(sink, field, buildSelectionForNodeFn, source, reade
20584
20575
  return sink;
20585
20576
  }
20586
20577
  function selectTypeLinkWithPagination(resolvedLink, sel, fieldData, reader, key, sink, variables, fragments, selectFn) {
20587
- var _a, _b, _c, _d, _e;
20588
20578
  const source = resolvedLink.data.data;
20589
20579
  const parentRecordId = resolvedLink.recordId;
20590
20580
  const totalEdges = source.edges !== undefined ? source.edges.length : 0;
@@ -20594,10 +20584,10 @@ function selectTypeLinkWithPagination(resolvedLink, sel, fieldData, reader, key,
20594
20584
  reader.markMissing();
20595
20585
  return;
20596
20586
  }
20597
- const firstArg = (_a = sel.arguments) === null || _a === void 0 ? void 0 : _a.find(argument => { return argument.name.value === 'first'; });
20587
+ const firstArg = sel.arguments?.find(argument => { return argument.name.value === 'first'; });
20598
20588
  const firstArgVal = evaluateArgumentValue(firstArg, 'IntValue', variables);
20599
20589
  const pageSize = firstArgVal !== undefined ? firstArgVal : totalEdges;
20600
- const afterArg = (_b = sel.arguments) === null || _b === void 0 ? void 0 : _b.find(argument => { return argument.name.value === 'after'; });
20590
+ const afterArg = sel.arguments?.find(argument => { return argument.name.value === 'after'; });
20601
20591
  const afterArgVal = evaluateArgumentValue(afterArg, 'StringValue', variables);
20602
20592
  const paginationParams = {
20603
20593
  pageSize: parseInt(pageSize, 10),
@@ -20659,7 +20649,7 @@ function selectTypeLinkWithPagination(resolvedLink, sel, fieldData, reader, key,
20659
20649
  reader.markMissingLink(fieldData.__ref);
20660
20650
  reader.markMissing();
20661
20651
  // optimize pagination when "first" and "after" args are part of the variable
20662
- if (((_c = firstArg === null || firstArg === void 0 ? void 0 : firstArg.value) === null || _c === void 0 ? void 0 : _c.kind) === 'Variable' && ((_d = afterArg === null || afterArg === void 0 ? void 0 : afterArg.value) === null || _d === void 0 ? void 0 : _d.kind) === 'Variable') {
20652
+ if (firstArg?.value?.kind === 'Variable' && afterArg?.value?.kind === 'Variable') {
20663
20653
  optimizePagination(metadata, firstArg.value.name.value, afterArg.value.name.value, variables);
20664
20654
  }
20665
20655
  return;
@@ -20675,9 +20665,9 @@ function selectTypeLinkWithPagination(resolvedLink, sel, fieldData, reader, key,
20675
20665
  };
20676
20666
  reader.markSeenId(parentRecordId);
20677
20667
  const result = selectFn(sel, variables, fragments)(paginatedData, reader, parentRecordId);
20678
- const pageInfo = createPageInfo(result === null || result === void 0 ? void 0 : result.edges, startOffset, endOffset, maxOffset, metadata);
20668
+ const pageInfo = createPageInfo(result?.edges, startOffset, endOffset, maxOffset, metadata);
20679
20669
  if (pageInfo !== undefined) {
20680
- const selectedPageInfo = selectPageInfo((_e = sel.selectionSet) === null || _e === void 0 ? void 0 : _e.selections, fragments, pageInfo);
20670
+ const selectedPageInfo = selectPageInfo(sel.selectionSet?.selections, fragments, pageInfo);
20681
20671
  if (selectedPageInfo !== undefined) {
20682
20672
  reader.assignNonScalar(result, 'pageInfo', selectedPageInfo);
20683
20673
  }
@@ -20685,11 +20675,10 @@ function selectTypeLinkWithPagination(resolvedLink, sel, fieldData, reader, key,
20685
20675
  reader.assignNonScalar(sink, key, result);
20686
20676
  }
20687
20677
  function selectPageInfo(selections, fragments, pageInfo) {
20688
- var _a;
20689
20678
  const pageInfoSelection = getSelectionNode(selections, fragments, 'pageInfo');
20690
20679
  if (pageInfo === undefined || pageInfoSelection === undefined || pageInfoSelection.kind !== 'Field')
20691
20680
  return undefined;
20692
- const pageInfoSelections = (_a = pageInfoSelection.selectionSet) === null || _a === void 0 ? void 0 : _a.selections;
20681
+ const pageInfoSelections = pageInfoSelection.selectionSet?.selections;
20693
20682
  const selectedPageInfo = Object.assign({}, pageInfo);
20694
20683
  Object.keys(pageInfo).forEach((fieldName) => {
20695
20684
  if (getSelectionNode(pageInfoSelections, fragments, fieldName) === undefined) {
@@ -20708,7 +20697,7 @@ function getSelectionNode(selections, fragments, fieldName) {
20708
20697
  }
20709
20698
  else if (selection.kind === 'FragmentSpread') {
20710
20699
  const fragment = fragments[selection.name.value];
20711
- return getSelectionNode(fragment === null || fragment === void 0 ? void 0 : fragment.selectionSet.selections, fragments, fieldName);
20700
+ return getSelectionNode(fragment?.selectionSet.selections, fragments, fieldName);
20712
20701
  }
20713
20702
  else if (selection.kind === 'InlineFragment') {
20714
20703
  return getSelectionNode(selection.selectionSet.selections, fragments, fieldName);
@@ -21005,12 +20994,11 @@ function buildNetworkSnapshot$1(luvio, config, options) {
21005
20994
  const request = createResourceRequest$1(resourceParams);
21006
20995
  return luvio.dispatchResourceRequest(request, options)
21007
20996
  .then((response) => {
21008
- var _a, _b;
21009
- const graphqlErrors = (_a = response === null || response === void 0 ? void 0 : response.body) === null || _a === void 0 ? void 0 : _a.errors;
20997
+ const graphqlErrors = response?.body?.errors;
21010
20998
  if ((graphqlErrors || []).length === 0) {
21011
20999
  return response;
21012
21000
  }
21013
- return Promise.reject({ errorType: 'adapterError', error: (_b = response === null || response === void 0 ? void 0 : response.body) === null || _b === void 0 ? void 0 : _b.errors });
21001
+ return Promise.reject({ errorType: 'adapterError', error: response?.body?.errors });
21014
21002
  })
21015
21003
  .then((response) => {
21016
21004
  return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
@@ -22269,4 +22257,4 @@ register({
22269
22257
  });
22270
22258
 
22271
22259
  export { configurationForGraphQLAdapters as configuration, graphql, factory$1 as graphqlAdapterFactory, graphqlBatch, graphqlBatch_imperative, graphql_imperative };
22272
- // version: 1.321.0-40847d67a8
22260
+ // version: 1.323.0-34d96539ec