@salesforce/lds-adapters-uiapi 1.142.0 → 1.142.1

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.
@@ -5,9 +5,9 @@ import { PartialInterface as graphql_types_Query_PartialInterface } from '../gra
5
5
  export declare const TTL = 900000;
6
6
  export declare const VERSION = "b440235e7e724631f92002fe50e3e096";
7
7
  export declare const RepresentationType: string;
8
- export declare function select(luvio: $64$luvio_engine_Luvio, query: $64$luvio_graphql$45$parser_DocumentNode, variables: $64$luvio_graphql_GraphQLVariables): $64$luvio_engine_ReaderFragment;
9
- export declare const ingest: (query: $64$luvio_graphql$45$parser_DocumentNode, variables: $64$luvio_graphql_GraphQLVariables) => $64$luvio_engine_ResourceIngest;
10
- export declare function getTypeCacheKeys(luvio: $64$luvio_engine_Luvio, query: $64$luvio_graphql$45$parser_DocumentNode, variables: $64$luvio_graphql_GraphQLVariables, data: GraphQLRepresentation): $64$luvio_engine_DurableStoreKeyMetadataMap;
8
+ export declare function select(luvio: $64$luvio_engine_Luvio, document: $64$luvio_graphql$45$parser_DocumentNode, variables: $64$luvio_graphql_GraphQLVariables, operationName?: string): $64$luvio_engine_ReaderFragment;
9
+ export declare const ingest: (document: $64$luvio_graphql$45$parser_DocumentNode, variables: $64$luvio_graphql_GraphQLVariables, operationName?: string) => $64$luvio_engine_ResourceIngest;
10
+ export declare function getTypeCacheKeys(luvio: $64$luvio_engine_Luvio, document: $64$luvio_graphql$45$parser_DocumentNode, variables: $64$luvio_graphql_GraphQLVariables, data: GraphQLRepresentation, operationName?: string): $64$luvio_engine_DurableStoreKeyMetadataMap;
11
11
  export type GraphQLRepresentation = GraphQLRepresentationData | GraphQLRepresentationErrors;
12
12
  export interface GraphQLRepresentationData {
13
13
  data: graphql_types_Query_PartialInterface;
@@ -7,7 +7,7 @@
7
7
  import { register } from '@salesforce/lds-default-luvio';
8
8
  import { serializeStructuredKey, StoreKeyMap, StoreKeySet, deepFreeze, coerceAdapterRequestContext, Wildcard } from '@luvio/engine';
9
9
  import { print, visit, parse as parse$1 } from '@luvio/graphql-parser';
10
- import { createFragmentMap, serializeFieldArguments, buildQueryTypeStringKey } from '@luvio/graphql';
10
+ import { createFragmentMap, serializeFieldArguments, 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.
@@ -50509,43 +50509,38 @@ function getInContextFragmentType(fragment, fragmentMap) {
50509
50509
  const TTL$5 = 900000;
50510
50510
  const VERSION$b = "b440235e7e724631f92002fe50e3e096";
50511
50511
  const RepresentationType$c = 'GraphQLRepresentation';
50512
- function select$8(luvio, query, variables) {
50513
- const definitions = query.definitions === undefined ? [] : query.definitions;
50512
+ function select$8(luvio, document, variables, operationName) {
50513
+ const operationToExecute = getOperationFromDocument(document, operationName);
50514
50514
  return {
50515
50515
  kind: 'Fragment',
50516
50516
  synthetic: true,
50517
50517
  reader: true,
50518
50518
  read: (builder) => {
50519
50519
  builder.enterPath('data');
50520
- let sink = {};
50521
- const fragments = createFragmentMap(query);
50522
- for (let i = 0, len = definitions.length; i < len; i += 1) {
50523
- const def = definitions[i];
50524
- if (def.kind === 'OperationDefinition') {
50525
- const queryTypeRecordId = keyBuilder$e(luvio, def, variables, fragments);
50526
- const snapshot = builder.read({
50527
- recordId: queryTypeRecordId,
50528
- node: {
50529
- kind: 'Fragment',
50530
- private: [],
50531
- opaque: true,
50532
- version: VERSION$c
50533
- },
50534
- variables: {}
50535
- });
50536
- if (snapshot.data === undefined) {
50537
- builder.markMissingLink(queryTypeRecordId);
50538
- break;
50539
- }
50540
- const data = select$9(def, variables, fragments)(snapshot.data, builder, queryTypeRecordId);
50541
- sink = {
50542
- ...sink,
50543
- ...data,
50544
- };
50545
- }
50546
- }
50547
50520
  const gqlData = {};
50548
- builder.assignNonScalar(gqlData, 'data', sink);
50521
+ if (operationToExecute === undefined) {
50522
+ builder.markMissing(); // Never give a cache hit for an undefined operation
50523
+ return gqlData;
50524
+ }
50525
+ const fragments = createFragmentMap(document);
50526
+ const queryTypeRecordId = keyBuilder$e(luvio, operationToExecute, variables, fragments);
50527
+ const snapshot = builder.read({
50528
+ recordId: queryTypeRecordId,
50529
+ node: {
50530
+ kind: 'Fragment',
50531
+ private: [],
50532
+ opaque: true,
50533
+ version: VERSION$c
50534
+ },
50535
+ variables: {}
50536
+ });
50537
+ if (snapshot.data === undefined) {
50538
+ builder.markMissingLink(queryTypeRecordId);
50539
+ }
50540
+ else {
50541
+ const data = select$9(operationToExecute, variables, fragments)(snapshot.data, builder, queryTypeRecordId);
50542
+ builder.assignNonScalar(gqlData, 'data', data);
50543
+ }
50549
50544
  builder.exitPath();
50550
50545
  return gqlData;
50551
50546
  }
@@ -50565,10 +50560,10 @@ function ingestOperationNode(luvio, input, node, state) {
50565
50560
  });
50566
50561
  }
50567
50562
  }
50568
- const ingest$7 = function GraphQLRepresentationIngest(query, variables) {
50563
+ const ingest$7 = function GraphQLRepresentationIngest(document, variables, operationName) {
50569
50564
  return (input, path, luvio, store, timestamp) => {
50570
50565
  if (input.data) {
50571
- const fragments = createFragmentMap(query);
50566
+ const fragments = createFragmentMap(document);
50572
50567
  const state = {
50573
50568
  data: input.data,
50574
50569
  luvio,
@@ -50578,44 +50573,42 @@ const ingest$7 = function GraphQLRepresentationIngest(query, variables) {
50578
50573
  variables,
50579
50574
  fragments,
50580
50575
  };
50581
- query.definitions.forEach((node) => {
50582
- if (node.kind === 'OperationDefinition') {
50583
- ingestOperationNode(luvio, input, node, state);
50584
- }
50585
- });
50576
+ const operationToExecute = getOperationFromDocument(document, operationName);
50577
+ if (operationToExecute !== undefined) {
50578
+ ingestOperationNode(luvio, input, operationToExecute, state);
50579
+ }
50586
50580
  }
50587
50581
  return {
50588
50582
  __ref: undefined
50589
50583
  };
50590
50584
  };
50591
50585
  };
50592
- function getTypeCacheKeys$8(luvio, query, variables, data) {
50586
+ function getTypeCacheKeys$8(luvio, document, variables, data, operationName) {
50593
50587
  const sink = new StoreKeyMap();
50594
50588
  if (data.data) {
50595
- const fragments = createFragmentMap(query);
50596
- query.definitions.forEach((node) => {
50597
- if (node.kind === 'OperationDefinition') {
50598
- const state = {
50599
- luvio,
50600
- variables,
50601
- fragments,
50602
- data: data.data,
50603
- path: {
50604
- parent: null,
50605
- propertyName: null,
50606
- fullPath: '' // TODO: W-13079691 - Need to take another pass at what we want to do for structured keys
50607
- }
50608
- };
50609
- sink.merge(getTypeCacheKeys$9(node, state));
50610
- }
50611
- });
50589
+ const fragments = createFragmentMap(document);
50590
+ const operationToExecute = getOperationFromDocument(document, operationName);
50591
+ if (operationToExecute !== undefined) {
50592
+ const state = {
50593
+ luvio,
50594
+ variables,
50595
+ fragments,
50596
+ data: data.data,
50597
+ path: {
50598
+ parent: null,
50599
+ propertyName: null,
50600
+ fullPath: '' // TODO: W-13079691 - Need to take another pass at what we want to do for structured keys
50601
+ }
50602
+ };
50603
+ sink.merge(getTypeCacheKeys$9(operationToExecute, state));
50604
+ }
50612
50605
  }
50613
50606
  return sink;
50614
50607
  }
50615
50608
 
50616
50609
  function select$7(luvio, config) {
50617
- const { query, variables } = config;
50618
- return select$8(luvio, query, variables);
50610
+ const { query, variables, operationName } = config;
50611
+ return select$8(luvio, query, variables, operationName);
50619
50612
  }
50620
50613
  function keyBuilder$d(luvio, params) {
50621
50614
  return keyPrefix + '::' + 'GraphQLRepresentation';
@@ -50623,13 +50616,14 @@ function keyBuilder$d(luvio, params) {
50623
50616
  function getResponseCacheKeys$b(luvio, resourceParams, response) {
50624
50617
  const query = resourceParams.body.query;
50625
50618
  const variables = resourceParams.body.variables || {};
50626
- return getTypeCacheKeys$8(luvio, query, variables, response);
50619
+ const operationName = resourceParams.body.operationName;
50620
+ return getTypeCacheKeys$8(luvio, query, variables, response, operationName);
50627
50621
  }
50628
50622
  function ingestSuccess$5(luvio, config, resourceParams, response, snapshotRefresh) {
50629
50623
  const { body } = response;
50630
50624
  const key = keyBuilder$d();
50631
- const { query, variables } = resourceParams.body;
50632
- luvio.storeIngest(key, ingest$7(query, variables), body);
50625
+ const { query, variables, operationName } = resourceParams.body;
50626
+ luvio.storeIngest(key, ingest$7(query, variables, operationName), body);
50633
50627
  // revert the optimized pagination variables back to its original so that subsequent store lookup will include all records, not just the ones loaded by an optimized query
50634
50628
  // see optimizePagination for initial update to optimize the query
50635
50629
  revertPaginationOptimization(variables);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-uiapi",
3
- "version": "1.142.0",
3
+ "version": "1.142.1",
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, StoreKeyMap, deepFreeze, StoreKeySet } from 'force/luvioEngine';
20
- import { createFragmentMap, serializeFieldArguments, buildQueryTypeStringKey } from 'force/luvioGraphql';
20
+ import { createFragmentMap, serializeFieldArguments, buildQueryTypeStringKey, getOperationFromDocument } from 'force/luvioGraphql';
21
21
  import { createIngestRecordWithFields } from 'force/ldsAdaptersUiapi';
22
22
 
23
23
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
@@ -19471,43 +19471,38 @@ function getInContextFragmentType(fragment, fragmentMap) {
19471
19471
  const TTL = 900000;
19472
19472
  const VERSION$6 = "b440235e7e724631f92002fe50e3e096";
19473
19473
  const RepresentationType = 'GraphQLRepresentation';
19474
- function select$8(luvio, query, variables) {
19475
- const definitions = query.definitions === undefined ? [] : query.definitions;
19474
+ function select$8(luvio, document, variables, operationName) {
19475
+ const operationToExecute = getOperationFromDocument(document, operationName);
19476
19476
  return {
19477
19477
  kind: 'Fragment',
19478
19478
  synthetic: true,
19479
19479
  reader: true,
19480
19480
  read: (builder) => {
19481
19481
  builder.enterPath('data');
19482
- let sink = {};
19483
- const fragments = createFragmentMap(query);
19484
- for (let i = 0, len = definitions.length; i < len; i += 1) {
19485
- const def = definitions[i];
19486
- if (def.kind === 'OperationDefinition') {
19487
- const queryTypeRecordId = keyBuilder$4(luvio, def, variables, fragments);
19488
- const snapshot = builder.read({
19489
- recordId: queryTypeRecordId,
19490
- node: {
19491
- kind: 'Fragment',
19492
- private: [],
19493
- opaque: true,
19494
- version: VERSION$7
19495
- },
19496
- variables: {}
19497
- });
19498
- if (snapshot.data === undefined) {
19499
- builder.markMissingLink(queryTypeRecordId);
19500
- break;
19501
- }
19502
- const data = select$9(def, variables, fragments)(snapshot.data, builder, queryTypeRecordId);
19503
- sink = {
19504
- ...sink,
19505
- ...data,
19506
- };
19507
- }
19508
- }
19509
19482
  const gqlData = {};
19510
- builder.assignNonScalar(gqlData, 'data', sink);
19483
+ if (operationToExecute === undefined) {
19484
+ builder.markMissing(); // Never give a cache hit for an undefined operation
19485
+ return gqlData;
19486
+ }
19487
+ const fragments = createFragmentMap(document);
19488
+ const queryTypeRecordId = keyBuilder$4(luvio, operationToExecute, variables, fragments);
19489
+ const snapshot = builder.read({
19490
+ recordId: queryTypeRecordId,
19491
+ node: {
19492
+ kind: 'Fragment',
19493
+ private: [],
19494
+ opaque: true,
19495
+ version: VERSION$7
19496
+ },
19497
+ variables: {}
19498
+ });
19499
+ if (snapshot.data === undefined) {
19500
+ builder.markMissingLink(queryTypeRecordId);
19501
+ }
19502
+ else {
19503
+ const data = select$9(operationToExecute, variables, fragments)(snapshot.data, builder, queryTypeRecordId);
19504
+ builder.assignNonScalar(gqlData, 'data', data);
19505
+ }
19511
19506
  builder.exitPath();
19512
19507
  return gqlData;
19513
19508
  }
@@ -19527,10 +19522,10 @@ function ingestOperationNode(luvio, input, node, state) {
19527
19522
  });
19528
19523
  }
19529
19524
  }
19530
- const ingest = function GraphQLRepresentationIngest(query, variables) {
19525
+ const ingest = function GraphQLRepresentationIngest(document, variables, operationName) {
19531
19526
  return (input, path, luvio, store, timestamp) => {
19532
19527
  if (input.data) {
19533
- const fragments = createFragmentMap(query);
19528
+ const fragments = createFragmentMap(document);
19534
19529
  const state = {
19535
19530
  data: input.data,
19536
19531
  luvio,
@@ -19540,44 +19535,42 @@ const ingest = function GraphQLRepresentationIngest(query, variables) {
19540
19535
  variables,
19541
19536
  fragments,
19542
19537
  };
19543
- query.definitions.forEach((node) => {
19544
- if (node.kind === 'OperationDefinition') {
19545
- ingestOperationNode(luvio, input, node, state);
19546
- }
19547
- });
19538
+ const operationToExecute = getOperationFromDocument(document, operationName);
19539
+ if (operationToExecute !== undefined) {
19540
+ ingestOperationNode(luvio, input, operationToExecute, state);
19541
+ }
19548
19542
  }
19549
19543
  return {
19550
19544
  __ref: undefined
19551
19545
  };
19552
19546
  };
19553
19547
  };
19554
- function getTypeCacheKeys(luvio, query, variables, data) {
19548
+ function getTypeCacheKeys(luvio, document, variables, data, operationName) {
19555
19549
  const sink = new StoreKeyMap();
19556
19550
  if (data.data) {
19557
- const fragments = createFragmentMap(query);
19558
- query.definitions.forEach((node) => {
19559
- if (node.kind === 'OperationDefinition') {
19560
- const state = {
19561
- luvio,
19562
- variables,
19563
- fragments,
19564
- data: data.data,
19565
- path: {
19566
- parent: null,
19567
- propertyName: null,
19568
- fullPath: '' // TODO: W-13079691 - Need to take another pass at what we want to do for structured keys
19569
- }
19570
- };
19571
- sink.merge(getTypeCacheKeys$1(node, state));
19572
- }
19573
- });
19551
+ const fragments = createFragmentMap(document);
19552
+ const operationToExecute = getOperationFromDocument(document, operationName);
19553
+ if (operationToExecute !== undefined) {
19554
+ const state = {
19555
+ luvio,
19556
+ variables,
19557
+ fragments,
19558
+ data: data.data,
19559
+ path: {
19560
+ parent: null,
19561
+ propertyName: null,
19562
+ fullPath: '' // TODO: W-13079691 - Need to take another pass at what we want to do for structured keys
19563
+ }
19564
+ };
19565
+ sink.merge(getTypeCacheKeys$1(operationToExecute, state));
19566
+ }
19574
19567
  }
19575
19568
  return sink;
19576
19569
  }
19577
19570
 
19578
19571
  function select$7(luvio, config) {
19579
- const { query, variables } = config;
19580
- return select$8(luvio, query, variables);
19572
+ const { query, variables, operationName } = config;
19573
+ return select$8(luvio, query, variables, operationName);
19581
19574
  }
19582
19575
  function keyBuilder$3(luvio, params) {
19583
19576
  return keyPrefix + '::' + 'GraphQLRepresentation';
@@ -19585,13 +19578,14 @@ function keyBuilder$3(luvio, params) {
19585
19578
  function getResponseCacheKeys$1(luvio, resourceParams, response) {
19586
19579
  const query = resourceParams.body.query;
19587
19580
  const variables = resourceParams.body.variables || {};
19588
- return getTypeCacheKeys(luvio, query, variables, response);
19581
+ const operationName = resourceParams.body.operationName;
19582
+ return getTypeCacheKeys(luvio, query, variables, response, operationName);
19589
19583
  }
19590
19584
  function ingestSuccess$1(luvio, config, resourceParams, response, snapshotRefresh) {
19591
19585
  const { body } = response;
19592
19586
  const key = keyBuilder$3();
19593
- const { query, variables } = resourceParams.body;
19594
- luvio.storeIngest(key, ingest(query, variables), body);
19587
+ const { query, variables, operationName } = resourceParams.body;
19588
+ luvio.storeIngest(key, ingest(query, variables, operationName), body);
19595
19589
  // revert the optimized pagination variables back to its original so that subsequent store lookup will include all records, not just the ones loaded by an optimized query
19596
19590
  // see optimizePagination for initial update to optimize the query
19597
19591
  revertPaginationOptimization(variables);
@@ -20811,4 +20805,4 @@ register({
20811
20805
  });
20812
20806
 
20813
20807
  export { configurationForGraphQLAdapters as configuration, graphql, factory$1 as graphqlAdapterFactory, graphqlBatch, graphqlBatch_imperative, graphql_imperative };
20814
- // version: 1.142.0-9f43a65a3
20808
+ // version: 1.142.1-1511d83f4
package/sfdc/index.js CHANGED
@@ -35769,4 +35769,4 @@ withDefaultLuvio((luvio) => {
35769
35769
  });
35770
35770
 
35771
35771
  export { InMemoryRecordRepresentationQueryEvaluator, MRU, RepresentationType$I as ObjectInfoRepresentationType, RepresentationType$N as RecordRepresentationRepresentationType, TTL$v as RecordRepresentationTTL, RepresentationType$N as RecordRepresentationType, VERSION$14 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, getListRecordsByName, getListRecordsByName_imperative, getListUi, getListUi_imperative, getListViewSummaryCollection, getListViewSummaryCollection_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, 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$P as getTypeCacheKeysRecord, ingest as ingestContentDocumentCompositeRepresentation, ingest$B as ingestObjectInfo, ingest$x as ingestQuickActionExecutionRepresentation, ingest$G as ingestRecord, instrument, keyBuilder as keyBuilderContentDocumentCompositeRepresentation, keyBuilderFromType as keyBuilderFromTypeContentDocumentCompositeRepresentation, keyBuilderFromType$x as keyBuilderFromTypeRecordRepresentation, keyBuilder$1F as keyBuilderObjectInfo, keyBuilder$1z as keyBuilderQuickActionExecutionRepresentation, keyBuilder$1Q as keyBuilderRecord, notifyRecordUpdateAvailable, performQuickAction, performUpdateRecordQuickAction, refresh, updateLayoutUserState, updateRecord, updateRecordAvatar, updateRelatedListInfo, updateRelatedListPreferences };
35772
- // version: 1.142.0-9f43a65a3
35772
+ // version: 1.142.1-1511d83f4
@@ -79,7 +79,7 @@ var FragmentReadResultState;
79
79
  ({
80
80
  state: FragmentReadResultState.Missing,
81
81
  });
82
- // engine version: 0.140.3-86f83ec8
82
+ // engine version: 0.142.3-97d0da6c
83
83
 
84
84
  const { keys: ObjectKeys, create: ObjectCreate } = Object;
85
85