@salesforce/lds-adapters-uiapi 1.228.0 → 1.229.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.
@@ -1,6 +1,6 @@
1
1
  import { StoreLink as $64$luvio_engine_StoreLink, IngestPath as $64$luvio_engine_IngestPath, Luvio as $64$luvio_engine_Luvio, Store as $64$luvio_engine_Store, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata, SelectionPropertyKey as $64$luvio_engine_SelectionPropertyKey, Reader as $64$luvio_engine_Reader } from '@luvio/engine';
2
- import { FragmentDefinitionNode as $64$luvio_graphql$45$parser_FragmentDefinitionNode, InlineFragmentNode as $64$luvio_graphql$45$parser_InlineFragmentNode, FieldNode as $64$luvio_graphql$45$parser_FieldNode, FragmentSpreadNode as $64$luvio_graphql$45$parser_FragmentSpreadNode, SelectionNode as $64$luvio_graphql$45$parser_SelectionNode, OperationDefinitionNode as $64$luvio_graphql$45$parser_OperationDefinitionNode, DocumentNode as $64$luvio_graphql$45$parser_DocumentNode, SelectionSetNode as $64$luvio_graphql$45$parser_SelectionSetNode, ArgumentNode as $64$luvio_graphql$45$parser_ArgumentNode, VariableDefinitionNode as $64$luvio_graphql$45$parser_VariableDefinitionNode } from '@luvio/graphql-parser';
3
- import { GraphQLVariables as $64$luvio_graphql_GraphQLVariables, GraphQLFragmentMap as $64$luvio_graphql_GraphQLFragmentMap } from '@luvio/graphql';
2
+ import { GraphQLVariables as $64$luvio_graphql_GraphQLVariables, GraphQLFragmentMap as $64$luvio_graphql_GraphQLFragmentMap, IsFragmentApplicableType as $64$luvio_graphql_IsFragmentApplicableType } from '@luvio/graphql';
3
+ import { FieldNode as $64$luvio_graphql$45$parser_FieldNode, FragmentSpreadNode as $64$luvio_graphql$45$parser_FragmentSpreadNode, InlineFragmentNode as $64$luvio_graphql$45$parser_InlineFragmentNode, SelectionNode as $64$luvio_graphql$45$parser_SelectionNode, OperationDefinitionNode as $64$luvio_graphql$45$parser_OperationDefinitionNode, DocumentNode as $64$luvio_graphql$45$parser_DocumentNode, SelectionSetNode as $64$luvio_graphql$45$parser_SelectionSetNode, ArgumentNode as $64$luvio_graphql$45$parser_ArgumentNode, FragmentDefinitionNode as $64$luvio_graphql$45$parser_FragmentDefinitionNode, VariableDefinitionNode as $64$luvio_graphql$45$parser_VariableDefinitionNode } from '@luvio/graphql-parser';
4
4
  import { PaginationMetadata as pagination_cursor_PaginationMetadata, PaginationParams as pagination_cursor_PaginationParams, PageMetadata as pagination_cursor_PageMetadata } from '../../pagination/cursor';
5
5
  export type NormalizedGraphQL<D = undefined> = {
6
6
  data: Record<string, any>;
@@ -11,7 +11,6 @@ export type GraphQLTypeDetails = {
11
11
  isArray: boolean;
12
12
  typename: string;
13
13
  };
14
- type IsFragmentApplicableType = (fragment: $64$luvio_graphql$45$parser_FragmentDefinitionNode | $64$luvio_graphql$45$parser_InlineFragmentNode, typename: string) => boolean;
15
14
  export interface GraphQLState<D = unknown> {
16
15
  data: D;
17
16
  path: $64$luvio_engine_IngestPath;
@@ -44,7 +43,7 @@ export declare function createLink(ref: string | $64$luvio_engine_NormalizedKeyM
44
43
  };
45
44
  interface IngestBaseParams<AstNodeType, StateType> {
46
45
  key: string | $64$luvio_engine_NormalizedKeyMetadata;
47
- isFragmentApplicable: IsFragmentApplicableType;
46
+ isFragmentApplicable: $64$luvio_graphql_IsFragmentApplicableType;
48
47
  isMappedFieldImport: (field: $64$luvio_graphql$45$parser_FieldNode) => boolean;
49
48
  getFieldType: (field: $64$luvio_graphql$45$parser_FieldNode) => {
50
49
  isArray: boolean;
@@ -80,7 +79,6 @@ export declare function injectSelectionSet(selectionSetNode: $64$luvio_graphql$4
80
79
  export declare function getPageMetadata(paginationMetadata: pagination_cursor_PaginationMetadata | undefined, paginationParams: pagination_cursor_PaginationParams): pagination_cursor_PageMetadata;
81
80
  export declare function isCursorConnectionType(fieldType: GraphQLTypeDetails | undefined): boolean;
82
81
  export declare function getSerializedKeyForField(field: $64$luvio_graphql$45$parser_FieldNode, variables: $64$luvio_graphql_GraphQLVariables, fieldType: GraphQLTypeDetails | undefined): string;
83
- export declare function getRequestedFieldsForType(typename: string, selectionSet: $64$luvio_graphql$45$parser_SelectionSetNode, namedFragmentsMap: $64$luvio_graphql_GraphQLFragmentMap, isFragmentApplicable: IsFragmentApplicableType): Map<string, $64$luvio_graphql$45$parser_FieldNode>;
84
82
  export declare function getQueryTransformerForType(typename: string, fragmentMap: $64$luvio_graphql_GraphQLFragmentMap): QueryTransformHelper | undefined;
85
83
  export declare function sharedGetFragmentType(fragment: $64$luvio_graphql$45$parser_FragmentSpreadNode | $64$luvio_graphql$45$parser_InlineFragmentNode, fragmentMap: $64$luvio_graphql_GraphQLFragmentMap): string | undefined;
86
84
  export declare function getSelectionSetFromFragment(fragment: $64$luvio_graphql$45$parser_FragmentSpreadNode | $64$luvio_graphql$45$parser_InlineFragmentNode, fragmentMap: $64$luvio_graphql_GraphQLFragmentMap): $64$luvio_graphql$45$parser_SelectionSetNode | undefined;
@@ -88,7 +86,7 @@ export declare function getCursorConnectionMinimumSelections(): $64$luvio_graphq
88
86
  export declare function evaluateArgumentValue(argumentNode: $64$luvio_graphql$45$parser_ArgumentNode | undefined, expectedKind: 'IntValue' | 'FloatValue' | 'StringValue' | 'BooleanValue' | 'EnumValue', variables: $64$luvio_graphql_GraphQLVariables): any | undefined;
89
87
  export declare function getArrayOffsetForPage(state: GraphQLIngestState<any>, node: $64$luvio_graphql$45$parser_FieldNode, key: string | $64$luvio_engine_NormalizedKeyMetadata): number;
90
88
  export declare function isFragmentApplicable(fragmentNode: $64$luvio_graphql$45$parser_FragmentDefinitionNode | $64$luvio_graphql$45$parser_InlineFragmentNode, implementedInterfaces: string[], graphqlTypeName: string, typename?: string): boolean;
91
- export declare function buildSelectionForNode<D = undefined>(source: NormalizedGraphQL<D>, reader: $64$luvio_engine_Reader<any>, parentNode: $64$luvio_graphql$45$parser_FieldNode | $64$luvio_graphql$45$parser_OperationDefinitionNode, selectionNode: $64$luvio_graphql$45$parser_SelectionNode, variables: $64$luvio_graphql_GraphQLVariables, fragments: $64$luvio_graphql_GraphQLFragmentMap, isFragmentApplicable: IsFragmentApplicableType, buildSelectionForField: (source: NormalizedGraphQL<D>, reader: $64$luvio_engine_Reader<any>, sel: $64$luvio_graphql$45$parser_FieldNode, variables: $64$luvio_graphql_GraphQLVariables, fragments: $64$luvio_graphql_GraphQLFragmentMap, parentRecordId: string) => unknown, parentRecordId: string): Record<string, any> | undefined;
89
+ export declare function buildSelectionForNode<D = undefined>(source: NormalizedGraphQL<D>, reader: $64$luvio_engine_Reader<any>, parentNode: $64$luvio_graphql$45$parser_FieldNode | $64$luvio_graphql$45$parser_OperationDefinitionNode, selectionNode: $64$luvio_graphql$45$parser_SelectionNode, variables: $64$luvio_graphql_GraphQLVariables, fragments: $64$luvio_graphql_GraphQLFragmentMap, isFragmentApplicable: $64$luvio_graphql_IsFragmentApplicableType, buildSelectionForField: (source: NormalizedGraphQL<D>, reader: $64$luvio_engine_Reader<any>, sel: $64$luvio_graphql$45$parser_FieldNode, variables: $64$luvio_graphql_GraphQLVariables, fragments: $64$luvio_graphql_GraphQLFragmentMap, parentRecordId: string) => unknown, parentRecordId: string): Record<string, any> | undefined;
92
90
  export declare function buildSelectionForField<SourceType>(source: SourceType, reader: $64$luvio_engine_Reader<any>, sel: $64$luvio_graphql$45$parser_FieldNode, variables: $64$luvio_graphql_GraphQLVariables, fragments: $64$luvio_graphql_GraphQLFragmentMap, isCursorConnectionType: boolean, getFieldData: (source: SourceType, sel: $64$luvio_graphql$45$parser_FieldNode, variables: $64$luvio_graphql_GraphQLVariables) => any, getFieldType: (field: $64$luvio_graphql$45$parser_FieldNode) => {
93
91
  isArray: boolean;
94
92
  typename: string;
@@ -1,3 +1,3 @@
1
1
  import type { FragmentSpreadNode, InlineFragmentNode } from '@luvio/graphql-parser';
2
- import type { GraphQLFragmentMap } from '../../../generated/graphql/types/type-util';
2
+ import type { GraphQLFragmentMap } from '@luvio/graphql';
3
3
  export declare function getInContextFragmentType(fragment: FragmentSpreadNode | InlineFragmentNode, fragmentMap: GraphQLFragmentMap): string | undefined;
@@ -7,7 +7,7 @@
7
7
  import { register } from '@salesforce/lds-default-luvio';
8
8
  import { serializeStructuredKey, ingestShape, coerceConfig as coerceConfig$1, typeCheckConfig as typeCheckConfig$13, createResourceParams as createResourceParams$Z, StoreKeyMap, StoreKeySet, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$R, coerceAdapterRequestContext, Wildcard } from '@luvio/engine';
9
9
  import { print, visit, parse as parse$1 } from '@luvio/graphql-parser';
10
- import { buildFieldState, createFragmentMap, serializeFieldArguments, buildQueryTypeStringKey, getOperationFromDocument } from '@luvio/graphql';
10
+ import { getRequestedFieldsForType, buildFieldState, createFragmentMap, mergeSelectionSets, serializeFieldArguments, deepMerge, buildQueryTypeStringKey, getOperationFromDocument } from '@luvio/graphql';
11
11
 
12
12
  /**
13
13
  * Defines configuration for the module with a default value which can be overridden by the runtime environment.
@@ -42441,13 +42441,12 @@ function injectSelectionSet(selectionSetNode, queryTransformHelper, fragmentMap)
42441
42441
  selectionSetNode === undefined) {
42442
42442
  return;
42443
42443
  }
42444
- const { selections } = selectionSetNode;
42445
- if (selections === undefined ||
42446
- selections === null) {
42447
- return;
42448
- }
42449
- const mergedSelections = mergeSelections(queryTransformHelper.getMinimumSelections(), selections);
42450
- mergedSelections.forEach(selection => {
42444
+ const minimumSelectionSet = {
42445
+ kind: 'SelectionSet',
42446
+ selections: queryTransformHelper.getMinimumSelections()
42447
+ };
42448
+ const mergedSelections = mergeSelectionSets(selectionSetNode, minimumSelectionSet);
42449
+ mergedSelections === null || mergedSelections === void 0 ? void 0 : mergedSelections.selections.forEach(selection => {
42451
42450
  if (selection.kind === 'Field') {
42452
42451
  const fieldType = queryTransformHelper.getFieldType(selection);
42453
42452
  const fieldTransformHelper = fieldType === undefined ? undefined : getQueryTransformerForType(fieldType.typename);
@@ -42476,46 +42475,7 @@ function injectSelectionSet(selectionSetNode, queryTransformHelper, fragmentMap)
42476
42475
  }
42477
42476
  }
42478
42477
  });
42479
- Object.assign(selectionSetNode, {
42480
- selections: mergedSelections.length > 0 ? mergedSelections : undefined
42481
- });
42482
- }
42483
- function mergeSelections(minimumSelections, querySelections) {
42484
- const mergedSelections = [...querySelections];
42485
- for (let i = 0; i < minimumSelections.length; i++) {
42486
- const minimumSelection = minimumSelections[i];
42487
- if (minimumSelection.kind === 'Field') {
42488
- const existingNode = mergedSelections.find(selection => {
42489
- return selection.kind === 'Field' && selection.name.value === minimumSelection.name.value && (selection.directives === undefined || selection.directives.length === 0);
42490
- });
42491
- if (existingNode !== undefined && existingNode.kind === 'Field') { // Maybe do better type narrowing above
42492
- const existingNodeHasSubselections = existingNode.selectionSet !== undefined && existingNode.selectionSet.selections.length > 0;
42493
- const minimumFieldNodeHasSubselections = minimumSelection.selectionSet !== undefined && minimumSelection.selectionSet.selections.length > 0;
42494
- // TODO(correctness enhancement): this doesn't handle arugments. Add alias if arguments disagree?
42495
- if (existingNodeHasSubselections && minimumFieldNodeHasSubselections) {
42496
- const mergedChildSelections = mergeSelections(minimumSelection.selectionSet.selections, existingNode.selectionSet.selections);
42497
- Object.assign(existingNode.selectionSet, {
42498
- selections: mergedChildSelections
42499
- });
42500
- }
42501
- }
42502
- else {
42503
- mergedSelections.push(minimumSelection);
42504
- }
42505
- }
42506
- if (minimumSelection.kind === 'InlineFragment') {
42507
- mergedSelections.push(minimumSelection);
42508
- }
42509
- if (minimumSelection.kind === 'FragmentSpread') {
42510
- if (process.env.NODE_ENV !== 'production') {
42511
- console.error('named fragment minimum selections are not supported and will not be added to the query.');
42512
- }
42513
- }
42514
- }
42515
- return mergedSelections;
42516
- }
42517
- function getRequestedField(responseDataFieldName, requestedFields) {
42518
- return requestedFields.find(fieldNode => (fieldNode.alias && fieldNode.alias.value === responseDataFieldName) || (!fieldNode.alias && fieldNode.name.value === responseDataFieldName));
42478
+ Object.assign(selectionSetNode, mergedSelections);
42519
42479
  }
42520
42480
  function getPageMetadata(paginationMetadata, paginationParams) {
42521
42481
  const metadataProperties = {};
@@ -42561,67 +42521,6 @@ function getSerializedKeyForField(field, variables, fieldType) {
42561
42521
  const argumentString = mutableArgumentNodes.length > 0 ? '__' + serializeFieldArguments(mutableArgumentNodes, variables) : '';
42562
42522
  return field.name.value + argumentString; // It should be safe to always use the fieldName - If an alias is meaningful, there will be arguments on the key also.
42563
42523
  }
42564
- function mergeFragmentWithExistingSelections(fragmentFieldSelection, existingSelections) {
42565
- // Check if there is an existing selection for this field we can merge with
42566
- // If this isn't done, we will see issues such as W-12293630 & W-12236456 as examples
42567
- const existingField = getRequestedField(fragmentFieldSelection.name.value, existingSelections);
42568
- if (existingField === undefined) {
42569
- existingSelections.push(fragmentFieldSelection);
42570
- }
42571
- else {
42572
- if (existingField.selectionSet === undefined) {
42573
- existingField.selectionSet === fragmentFieldSelection.selectionSet;
42574
- }
42575
- else if (fragmentFieldSelection.selectionSet !== undefined) {
42576
- existingField.selectionSet.selections = mergeSelections(fragmentFieldSelection.selectionSet.selections, existingField.selectionSet.selections);
42577
- }
42578
- }
42579
- }
42580
- function calculateRequestedFieldsForType(typename, selectionSet, namedFragmentsMap, isFragmentApplicable) {
42581
- const selections = [];
42582
- selectionSet.selections.forEach(selection => {
42583
- if (selection.kind === "Field") {
42584
- selections.push(selection);
42585
- }
42586
- if (selection.kind === "InlineFragment" && isFragmentApplicable(selection, typename)) {
42587
- // loops over the map to get the values.
42588
- getRequestedFieldsForType(typename, selection.selectionSet, namedFragmentsMap, isFragmentApplicable)
42589
- .forEach(fragmentFieldSelection => { mergeFragmentWithExistingSelections(fragmentFieldSelection, selections); });
42590
- }
42591
- if (selection.kind === "FragmentSpread") {
42592
- const namedFragment = namedFragmentsMap[selection.name.value];
42593
- if (namedFragment && isFragmentApplicable(namedFragment, typename)) {
42594
- // loops over the map to get the values.
42595
- getRequestedFieldsForType(typename, namedFragment.selectionSet, namedFragmentsMap, isFragmentApplicable)
42596
- .forEach(fragmentFieldSelection => { mergeFragmentWithExistingSelections(fragmentFieldSelection, selections); });
42597
- }
42598
- }
42599
- });
42600
- // Needs to happen after the selections are merged.
42601
- return selections.reduce((acc, fieldNode) => {
42602
- const fieldName = fieldNode.alias ? fieldNode.alias.value : fieldNode.name.value;
42603
- // TODO: W-13485835. Some fields are not being merged, and this logic reproduces the current behavior in which the first field with name is being used.
42604
- if (!acc.has(fieldName)) {
42605
- acc.set(fieldName, fieldNode);
42606
- }
42607
- return acc;
42608
- }, new Map());
42609
- }
42610
- let selectionSetRequestedFieldsWeakMap = new WeakMap();
42611
- function getRequestedFieldsForType(typename, selectionSet, namedFragmentsMap, isFragmentApplicable) {
42612
- let cachedRequestedFieldsConfigurations = selectionSetRequestedFieldsWeakMap.get(selectionSet);
42613
- if (cachedRequestedFieldsConfigurations === undefined) {
42614
- cachedRequestedFieldsConfigurations = new Map();
42615
- selectionSetRequestedFieldsWeakMap.set(selectionSet, cachedRequestedFieldsConfigurations);
42616
- }
42617
- const cachedRequestedFieldsForType = cachedRequestedFieldsConfigurations.get(typename);
42618
- if (cachedRequestedFieldsForType !== undefined) {
42619
- return cachedRequestedFieldsForType;
42620
- }
42621
- const selections = calculateRequestedFieldsForType(typename, selectionSet, namedFragmentsMap, isFragmentApplicable);
42622
- cachedRequestedFieldsConfigurations.set(typename, selections);
42623
- return selections;
42624
- }
42625
42524
  function getQueryTransformerForType(typename, fragmentMap) {
42626
42525
  switch (typename) {
42627
42526
  case "PercentAggregate": return {
@@ -43167,6 +43066,7 @@ function buildSelectionForField$7(source, reader, sel, variables, fragments, isC
43167
43066
  }
43168
43067
  if (fieldData === null) {
43169
43068
  reader.assignScalar(requestedFieldName, sink, fieldData);
43069
+ reader.exitPath();
43170
43070
  return sink;
43171
43071
  }
43172
43072
  const fieldType = getFieldType(sel);
@@ -43240,18 +43140,7 @@ function selectCalculateSink(sink, field, buildSelectionForNodeFn, source, reade
43240
43140
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
43241
43141
  const builtSelection = buildSelectionForNodeFn(source, reader, field, sel, variables, fragments, parentRecordId);
43242
43142
  if (builtSelection !== undefined) {
43243
- if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
43244
- Object.keys(builtSelection).forEach((key, value) => {
43245
- // We only assign a field selection in the fragment if it doesn't already exist in sink
43246
- // The non-fragment selection already got the merged selections in getRequestedFieldsForType
43247
- if (sink[key] === undefined) {
43248
- sink[key] = builtSelection[key];
43249
- }
43250
- });
43251
- }
43252
- else {
43253
- Object.assign(sink, builtSelection);
43254
- }
43143
+ deepMerge(sink, builtSelection);
43255
43144
  }
43256
43145
  });
43257
43146
  return sink;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-uiapi",
3
- "version": "1.228.0",
3
+ "version": "1.229.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",
@@ -17,7 +17,7 @@ import { print, visit, parse, astResolver } from 'force/ldsGraphqlParser';
17
17
  import { createInstrumentedAdapter, createLDSAdapter, createGraphQLWireAdapterConstructor, createGraphQLImperativeAdapter } from 'force/ldsBindings';
18
18
  export { refresh as refreshGraphQL } from 'force/ldsBindings';
19
19
  import { serializeStructuredKey, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$2, StoreKeyMap, createResourceParams as createResourceParams$2, StoreKeySet } from 'force/luvioEngine';
20
- import { buildFieldState, createFragmentMap, serializeFieldArguments, buildQueryTypeStringKey, getOperationFromDocument } from 'force/luvioGraphql';
20
+ import { getRequestedFieldsForType, buildFieldState, createFragmentMap, mergeSelectionSets, serializeFieldArguments, deepMerge, buildQueryTypeStringKey, getOperationFromDocument } from 'force/luvioGraphql';
21
21
  import { createIngestRecordWithFields } from 'force/ldsAdaptersUiapi';
22
22
 
23
23
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
@@ -13768,13 +13768,12 @@ function injectSelectionSet(selectionSetNode, queryTransformHelper, fragmentMap)
13768
13768
  selectionSetNode === undefined) {
13769
13769
  return;
13770
13770
  }
13771
- const { selections } = selectionSetNode;
13772
- if (selections === undefined ||
13773
- selections === null) {
13774
- return;
13775
- }
13776
- const mergedSelections = mergeSelections(queryTransformHelper.getMinimumSelections(), selections);
13777
- mergedSelections.forEach(selection => {
13771
+ const minimumSelectionSet = {
13772
+ kind: 'SelectionSet',
13773
+ selections: queryTransformHelper.getMinimumSelections()
13774
+ };
13775
+ const mergedSelections = mergeSelectionSets(selectionSetNode, minimumSelectionSet);
13776
+ mergedSelections === null || mergedSelections === void 0 ? void 0 : mergedSelections.selections.forEach(selection => {
13778
13777
  if (selection.kind === 'Field') {
13779
13778
  const fieldType = queryTransformHelper.getFieldType(selection);
13780
13779
  const fieldTransformHelper = fieldType === undefined ? undefined : getQueryTransformerForType(fieldType.typename);
@@ -13803,46 +13802,7 @@ function injectSelectionSet(selectionSetNode, queryTransformHelper, fragmentMap)
13803
13802
  }
13804
13803
  }
13805
13804
  });
13806
- Object.assign(selectionSetNode, {
13807
- selections: mergedSelections.length > 0 ? mergedSelections : undefined
13808
- });
13809
- }
13810
- function mergeSelections(minimumSelections, querySelections) {
13811
- const mergedSelections = [...querySelections];
13812
- for (let i = 0; i < minimumSelections.length; i++) {
13813
- const minimumSelection = minimumSelections[i];
13814
- if (minimumSelection.kind === 'Field') {
13815
- const existingNode = mergedSelections.find(selection => {
13816
- return selection.kind === 'Field' && selection.name.value === minimumSelection.name.value && (selection.directives === undefined || selection.directives.length === 0);
13817
- });
13818
- if (existingNode !== undefined && existingNode.kind === 'Field') { // Maybe do better type narrowing above
13819
- const existingNodeHasSubselections = existingNode.selectionSet !== undefined && existingNode.selectionSet.selections.length > 0;
13820
- const minimumFieldNodeHasSubselections = minimumSelection.selectionSet !== undefined && minimumSelection.selectionSet.selections.length > 0;
13821
- // TODO(correctness enhancement): this doesn't handle arugments. Add alias if arguments disagree?
13822
- if (existingNodeHasSubselections && minimumFieldNodeHasSubselections) {
13823
- const mergedChildSelections = mergeSelections(minimumSelection.selectionSet.selections, existingNode.selectionSet.selections);
13824
- Object.assign(existingNode.selectionSet, {
13825
- selections: mergedChildSelections
13826
- });
13827
- }
13828
- }
13829
- else {
13830
- mergedSelections.push(minimumSelection);
13831
- }
13832
- }
13833
- if (minimumSelection.kind === 'InlineFragment') {
13834
- mergedSelections.push(minimumSelection);
13835
- }
13836
- if (minimumSelection.kind === 'FragmentSpread') {
13837
- if (process.env.NODE_ENV !== 'production') {
13838
- console.error('named fragment minimum selections are not supported and will not be added to the query.');
13839
- }
13840
- }
13841
- }
13842
- return mergedSelections;
13843
- }
13844
- function getRequestedField(responseDataFieldName, requestedFields) {
13845
- return requestedFields.find(fieldNode => (fieldNode.alias && fieldNode.alias.value === responseDataFieldName) || (!fieldNode.alias && fieldNode.name.value === responseDataFieldName));
13805
+ Object.assign(selectionSetNode, mergedSelections);
13846
13806
  }
13847
13807
  function getPageMetadata(paginationMetadata, paginationParams) {
13848
13808
  const metadataProperties = {};
@@ -13888,67 +13848,6 @@ function getSerializedKeyForField(field, variables, fieldType) {
13888
13848
  const argumentString = mutableArgumentNodes.length > 0 ? '__' + serializeFieldArguments(mutableArgumentNodes, variables) : '';
13889
13849
  return field.name.value + argumentString; // It should be safe to always use the fieldName - If an alias is meaningful, there will be arguments on the key also.
13890
13850
  }
13891
- function mergeFragmentWithExistingSelections(fragmentFieldSelection, existingSelections) {
13892
- // Check if there is an existing selection for this field we can merge with
13893
- // If this isn't done, we will see issues such as W-12293630 & W-12236456 as examples
13894
- const existingField = getRequestedField(fragmentFieldSelection.name.value, existingSelections);
13895
- if (existingField === undefined) {
13896
- existingSelections.push(fragmentFieldSelection);
13897
- }
13898
- else {
13899
- if (existingField.selectionSet === undefined) {
13900
- existingField.selectionSet === fragmentFieldSelection.selectionSet;
13901
- }
13902
- else if (fragmentFieldSelection.selectionSet !== undefined) {
13903
- existingField.selectionSet.selections = mergeSelections(fragmentFieldSelection.selectionSet.selections, existingField.selectionSet.selections);
13904
- }
13905
- }
13906
- }
13907
- function calculateRequestedFieldsForType(typename, selectionSet, namedFragmentsMap, isFragmentApplicable) {
13908
- const selections = [];
13909
- selectionSet.selections.forEach(selection => {
13910
- if (selection.kind === "Field") {
13911
- selections.push(selection);
13912
- }
13913
- if (selection.kind === "InlineFragment" && isFragmentApplicable(selection, typename)) {
13914
- // loops over the map to get the values.
13915
- getRequestedFieldsForType(typename, selection.selectionSet, namedFragmentsMap, isFragmentApplicable)
13916
- .forEach(fragmentFieldSelection => { mergeFragmentWithExistingSelections(fragmentFieldSelection, selections); });
13917
- }
13918
- if (selection.kind === "FragmentSpread") {
13919
- const namedFragment = namedFragmentsMap[selection.name.value];
13920
- if (namedFragment && isFragmentApplicable(namedFragment, typename)) {
13921
- // loops over the map to get the values.
13922
- getRequestedFieldsForType(typename, namedFragment.selectionSet, namedFragmentsMap, isFragmentApplicable)
13923
- .forEach(fragmentFieldSelection => { mergeFragmentWithExistingSelections(fragmentFieldSelection, selections); });
13924
- }
13925
- }
13926
- });
13927
- // Needs to happen after the selections are merged.
13928
- return selections.reduce((acc, fieldNode) => {
13929
- const fieldName = fieldNode.alias ? fieldNode.alias.value : fieldNode.name.value;
13930
- // TODO: W-13485835. Some fields are not being merged, and this logic reproduces the current behavior in which the first field with name is being used.
13931
- if (!acc.has(fieldName)) {
13932
- acc.set(fieldName, fieldNode);
13933
- }
13934
- return acc;
13935
- }, new Map());
13936
- }
13937
- let selectionSetRequestedFieldsWeakMap = new WeakMap();
13938
- function getRequestedFieldsForType(typename, selectionSet, namedFragmentsMap, isFragmentApplicable) {
13939
- let cachedRequestedFieldsConfigurations = selectionSetRequestedFieldsWeakMap.get(selectionSet);
13940
- if (cachedRequestedFieldsConfigurations === undefined) {
13941
- cachedRequestedFieldsConfigurations = new Map();
13942
- selectionSetRequestedFieldsWeakMap.set(selectionSet, cachedRequestedFieldsConfigurations);
13943
- }
13944
- const cachedRequestedFieldsForType = cachedRequestedFieldsConfigurations.get(typename);
13945
- if (cachedRequestedFieldsForType !== undefined) {
13946
- return cachedRequestedFieldsForType;
13947
- }
13948
- const selections = calculateRequestedFieldsForType(typename, selectionSet, namedFragmentsMap, isFragmentApplicable);
13949
- cachedRequestedFieldsConfigurations.set(typename, selections);
13950
- return selections;
13951
- }
13952
13851
  function getQueryTransformerForType(typename, fragmentMap) {
13953
13852
  switch (typename) {
13954
13853
  case "PercentAggregate": return {
@@ -14494,6 +14393,7 @@ function buildSelectionForField$7(source, reader, sel, variables, fragments, isC
14494
14393
  }
14495
14394
  if (fieldData === null) {
14496
14395
  reader.assignScalar(requestedFieldName, sink, fieldData);
14396
+ reader.exitPath();
14497
14397
  return sink;
14498
14398
  }
14499
14399
  const fieldType = getFieldType(sel);
@@ -14567,18 +14467,7 @@ function selectCalculateSink(sink, field, buildSelectionForNodeFn, source, reade
14567
14467
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
14568
14468
  const builtSelection = buildSelectionForNodeFn(source, reader, field, sel, variables, fragments, parentRecordId);
14569
14469
  if (builtSelection !== undefined) {
14570
- if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
14571
- Object.keys(builtSelection).forEach((key, value) => {
14572
- // We only assign a field selection in the fragment if it doesn't already exist in sink
14573
- // The non-fragment selection already got the merged selections in getRequestedFieldsForType
14574
- if (sink[key] === undefined) {
14575
- sink[key] = builtSelection[key];
14576
- }
14577
- });
14578
- }
14579
- else {
14580
- Object.assign(sink, builtSelection);
14581
- }
14470
+ deepMerge(sink, builtSelection);
14582
14471
  }
14583
14472
  });
14584
14473
  return sink;
@@ -18233,4 +18122,4 @@ register({
18233
18122
  });
18234
18123
 
18235
18124
  export { configurationForGraphQLAdapters as configuration, graphql, factory$1 as graphqlAdapterFactory, graphqlBatch, graphqlBatch_imperative, graphql_imperative };
18236
- // version: 1.228.0-946298e9a
18125
+ // version: 1.229.0-41a436d3f
package/sfdc/index.js CHANGED
@@ -32847,4 +32847,4 @@ withDefaultLuvio((luvio) => {
32847
32847
  });
32848
32848
 
32849
32849
  export { InMemoryRecordRepresentationQueryEvaluator, MRU, RepresentationType$J as ObjectInfoRepresentationType, RepresentationType$O as RecordRepresentationRepresentationType, TTL$w as RecordRepresentationTTL, RepresentationType$O as RecordRepresentationType, VERSION$17 as RecordRepresentationVersion, keyPrefix as UiApiNamespace, configurationForRestAdapters as configuration, createContentDocumentAndVersion, createContentVersion, createIngestRecordWithFields, createRecord, deleteRecord, getActionOverrides, getActionOverrides_imperative, getAllApps, getAllApps_imperative, getAppDetails, getAppDetails_imperative, getDuplicateConfiguration, getDuplicateConfiguration_imperative, getDuplicates, getDuplicates_imperative, getGlobalActions, getGlobalActions_imperative, getKeywordSearchResults, getKeywordSearchResults_imperative, getLayout, getLayoutUserState, getLayoutUserState_imperative, getLayout_imperative, getListInfoByName, getListInfoByName_imperative, getListInfosByName, getListInfosByName_imperative, getListObjectInfo, getListObjectInfo_imperative, getListRecordsByName, getListRecordsByName_imperative, getListUi, getListUi_imperative, getLookupActions, getLookupActions_imperative, getLookupMetadata, getLookupMetadata_imperative, getLookupRecords, getLookupRecords_imperative, getNavItems, getNavItems_imperative, getObjectCreateActions, getObjectCreateActions_imperative, getObjectInfo, getObjectInfoAdapterFactory, getObjectInfo_imperative, getObjectInfos, getObjectInfosAdapterFactory, getObjectInfos_imperative, getPicklistValues, getPicklistValuesByRecordType, getPicklistValuesByRecordType_imperative, getPicklistValues_imperative, getQuickActionDefaults, getQuickActionDefaults_imperative, getQuickActionLayout, getQuickActionLayout_imperative, getRecord, getRecordActions, getRecordActions_imperative, factory$e as getRecordAdapterFactory, getRecordAvatars, getRecordAvatars_imperative, getRecordCreateDefaults, getRecordCreateDefaults_imperative, getRecordEditActions, getRecordEditActions_imperative, getRecordId18, getRecordNotifyChange, getRecordTemplateClone, getRecordTemplateClone_imperative, getRecordTemplateCreate, getRecordTemplateCreate_imperative, getRecordUi, getRecordUi_imperative, getRecord_imperative, getRecords, getRecordsAdapterFactory, getRecords_imperative, getRelatedListActions, getRelatedListActions_imperative, getRelatedListCount, getRelatedListCount_imperative, getRelatedListInfo, getRelatedListInfoBatch, getRelatedListInfoBatch_imperative, getRelatedListInfo_imperative, getRelatedListPreferences, getRelatedListPreferencesBatch, getRelatedListPreferencesBatch_imperative, getRelatedListPreferences_imperative, getRelatedListRecordActions, getRelatedListRecordActions_imperative, getRelatedListRecords, getRelatedListRecordsBatch, getRelatedListRecordsBatch_imperative, getRelatedListRecords_imperative, getRelatedListsActions, getRelatedListsActions_imperative, getRelatedListsCount, getRelatedListsCount_imperative, getRelatedListsInfo, getRelatedListsInfo_imperative, getResponseCacheKeys as getResponseCacheKeysContentDocumentCompositeRepresentation, getSearchFilterMetadata, getSearchFilterMetadata_imperative, getSearchFilterOptions, getSearchFilterOptions_imperative, getSearchResults, getSearchResults_imperative, getTypeCacheKeys$Q as getTypeCacheKeysRecord, ingest as ingestContentDocumentCompositeRepresentation, ingest$C as ingestObjectInfo, ingest$y as ingestQuickActionExecutionRepresentation, ingest$H as ingestRecord, instrument, keyBuilder as keyBuilderContentDocumentCompositeRepresentation, keyBuilderFromType as keyBuilderFromTypeContentDocumentCompositeRepresentation, keyBuilderFromType$y as keyBuilderFromTypeRecordRepresentation, keyBuilder$1J as keyBuilderObjectInfo, keyBuilder$1D as keyBuilderQuickActionExecutionRepresentation, keyBuilder$1U as keyBuilderRecord, notifyListInfoUpdateAvailable, notifyListViewSummaryUpdateAvailable, notifyQuickActionDefaultsUpdateAvailable, notifyRecordUpdateAvailable, performQuickAction, performUpdateRecordQuickAction, refresh, updateLayoutUserState, updateListInfoByName, updateRecord, updateRecordAvatar, updateRelatedListInfo, updateRelatedListPreferences };
32850
- // version: 1.228.0-946298e9a
32850
+ // version: 1.229.0-41a436d3f
@@ -95,7 +95,7 @@ var TypeCheckShapes;
95
95
  TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
96
96
  TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
97
97
  })(TypeCheckShapes || (TypeCheckShapes = {}));
98
- // engine version: 0.145.0-a2297ae0
98
+ // engine version: 0.145.3-1693bfb7
99
99
 
100
100
  const { keys: ObjectKeys, create: ObjectCreate } = Object;
101
101