@salesforce/lds-adapters-uiapi 1.309.0-dev15 → 1.309.0-dev16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/es2018/types/src/helpers/RecordRepresentation/merge.d.ts +8 -2
- package/dist/es/es2018/types/src/util/records.d.ts +2 -1
- package/dist/es/es2018/uiapi-records-service.js +55 -11
- package/package.json +6 -6
- package/sfdc/graphqlAdapters.js +7 -1
- package/sfdc/index.js +60 -25
- package/sfdc/uiapi-static-functions.js +1 -1
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import type { Luvio, IngestPath, StoreRecordError } from '@luvio/engine';
|
|
2
|
-
import type { RecordRepresentationNormalized } from '../../generated/types/RecordRepresentation';
|
|
1
|
+
import type { Luvio, IngestPath, StoreRecordError, ProxyGraphNode } from '@luvio/engine';
|
|
2
|
+
import type { RecordRepresentationNormalized, RecordRepresentation } from '../../generated/types/RecordRepresentation';
|
|
3
3
|
import type { RecordConflictMap } from './resolveConflict';
|
|
4
|
+
export type RecordProxyGraphNode = ProxyGraphNode<RecordRepresentationNormalized, RecordRepresentation>;
|
|
5
|
+
declare function mergePendingFields(newRecord: RecordRepresentationNormalized, oldRecord: RecordRepresentationNormalized, existingNode?: RecordProxyGraphNode): RecordRepresentationNormalized;
|
|
4
6
|
export default function merge(existing: RecordRepresentationNormalized | undefined | StoreRecordError, incoming: RecordRepresentationNormalized, luvio: Luvio, _path: IngestPath, recordConflictMap: RecordConflictMap): RecordRepresentationNormalized;
|
|
5
7
|
export declare function dependencyKeyBuilder(config: {
|
|
6
8
|
/** The ID of this record. */
|
|
7
9
|
recordId: string;
|
|
8
10
|
}): string;
|
|
11
|
+
export declare const forTesting: {
|
|
12
|
+
mergePendingFields: typeof mergePendingFields;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -37,9 +37,10 @@ export interface TrackedFieldsConfig {
|
|
|
37
37
|
maxDepth: number;
|
|
38
38
|
onlyFetchLeafNodeIdAndName: boolean;
|
|
39
39
|
}
|
|
40
|
-
export declare function isGraphNode(node: ProxyGraphNode<unknown>): node is GraphNode<unknown>;
|
|
40
|
+
export declare function isGraphNode(node: ProxyGraphNode<unknown> | undefined | null): node is GraphNode<unknown>;
|
|
41
41
|
export declare function extractTrackedFields(node: ProxyGraphNode<RecordRepresentationNormalized, RecordRepresentation>, parentFieldName: string, fieldsList?: string[], visitedRecordIds?: Record<string, boolean>, depth?: number): string[];
|
|
42
42
|
export declare function extractTrackedFieldsToTrie(recordId: string | NormalizedKeyMetadata, node: ProxyGraphNode<FieldMapRepresentationNormalized, FieldMapRepresentation>, root: RecordFieldTrie, config: TrackedFieldsConfig, visitedRecordIds?: Record<string, boolean>, depth?: number): void;
|
|
43
|
+
export declare function isExternalLookupFieldKey(spanningNode: ProxyGraphNode<RecordRepresentationNormalized, RecordRepresentation>): boolean;
|
|
43
44
|
export declare function convertTrieToFields(root: RecordFieldTrie): string[];
|
|
44
45
|
export declare function convertTrieToFieldsRecursively(root: RecordFieldTrie): string[];
|
|
45
46
|
export declare const BLANK_RECORD_FIELDS_TRIE: Readonly<{
|
|
@@ -4758,7 +4758,7 @@ const RECORD_REPRESENTATION_ERROR_STORE_METADATA_PARAMS = {
|
|
|
4758
4758
|
version: RECORD_REPRESENTATION_ERROR_VERSION,
|
|
4759
4759
|
};
|
|
4760
4760
|
function isGraphNode(node) {
|
|
4761
|
-
return node
|
|
4761
|
+
return !!node && node.type === 'Node';
|
|
4762
4762
|
}
|
|
4763
4763
|
function addScalarFieldId(current) {
|
|
4764
4764
|
addScalarField(current, 'Id');
|
|
@@ -4825,6 +4825,8 @@ function extractTrackedFieldsToTrie(recordId, node, root, config, visitedRecordI
|
|
|
4825
4825
|
const spanning = spanningLink.follow();
|
|
4826
4826
|
// W-8058425, do not include external lookups added by getTrackedFields
|
|
4827
4827
|
if (isExternalLookupFieldKey(spanning)) {
|
|
4828
|
+
// NOTE: the logic to get here is mimicked in RecordRepresentation/merge::mergePendingFields as of
|
|
4829
|
+
// W-11899329 due to issues with external lookups being marked pending but never fetched
|
|
4828
4830
|
continue;
|
|
4829
4831
|
}
|
|
4830
4832
|
extractTrackedFieldsToTrie(spanningLink.data.__ref, spanning, next, config, spanningVisitedRecordIds, depth + 1);
|
|
@@ -4857,6 +4859,8 @@ function extractTrackedFieldsToTrie(recordId, node, root, config, visitedRecordI
|
|
|
4857
4859
|
const { fields } = state;
|
|
4858
4860
|
// W-8058425, do not include external lookups added by getTrackedFields
|
|
4859
4861
|
if (includes.call(fields, 'ExternalId')) {
|
|
4862
|
+
// NOTE: the logic to get here is mimicked in RecordRepresentation/merge::mergePendingFields as of
|
|
4863
|
+
// W-11899329 due to issues with external lookups being marked pending but never fetched
|
|
4860
4864
|
continue;
|
|
4861
4865
|
}
|
|
4862
4866
|
for (let s = 0, len = fields.length; s < len; s += 1) {
|
|
@@ -5307,15 +5311,49 @@ function ingestRecordResponse(luvio, response, recordId, recordIngest, conflictM
|
|
|
5307
5311
|
|
|
5308
5312
|
// This function sets fields that we are refreshing to pending
|
|
5309
5313
|
// These values will go into the store
|
|
5310
|
-
function mergePendingFields(newRecord, oldRecord) {
|
|
5311
|
-
// TODO [W-6900046]: avoid casting to any by updating
|
|
5312
|
-
// RecordRepresentationNormalized['fields'] to include `pending:true` property
|
|
5314
|
+
function mergePendingFields(newRecord, oldRecord, existingNode) {
|
|
5313
5315
|
const mergedFields = { ...newRecord.fields };
|
|
5314
5316
|
const merged = { ...newRecord, fields: mergedFields };
|
|
5315
5317
|
const existingFields = keys(oldRecord.fields);
|
|
5316
5318
|
for (let i = 0, len = existingFields.length; i < len; i += 1) {
|
|
5317
5319
|
const spanningFieldName = existingFields[i];
|
|
5318
5320
|
if (newRecord.fields[spanningFieldName] === undefined) {
|
|
5321
|
+
/*
|
|
5322
|
+
* Per W-8058425 external lookups fields are excluded from the tracked fields. However, as covered in
|
|
5323
|
+
* W-11899329, situations can arise in which a merge conflict occurs when the existing record has a
|
|
5324
|
+
* reference to an external lookup field. The exclusion ultimately results in a snapshot stuck in the
|
|
5325
|
+
* pending state. This is an approach to prevent that situation.
|
|
5326
|
+
*
|
|
5327
|
+
* The same logic checks for W-8058425 to "continue" as it relates to not tracking external lookups is
|
|
5328
|
+
* mimicked here as it relates to not marking them as pending.
|
|
5329
|
+
*/
|
|
5330
|
+
// make sure external lookups are NOT marked as pending when `existingNode` is provided
|
|
5331
|
+
if (isGraphNode(existingNode)) {
|
|
5332
|
+
// get the node for the spanning field
|
|
5333
|
+
const fieldValueRep = existingNode
|
|
5334
|
+
.object('fields')
|
|
5335
|
+
.link(spanningFieldName);
|
|
5336
|
+
const field = fieldValueRep.follow();
|
|
5337
|
+
if (isGraphNode(field)) {
|
|
5338
|
+
if (field.isScalar('value') === false) {
|
|
5339
|
+
const record = field
|
|
5340
|
+
.link('value')
|
|
5341
|
+
.follow();
|
|
5342
|
+
if (isExternalLookupFieldKey(record)) {
|
|
5343
|
+
continue;
|
|
5344
|
+
}
|
|
5345
|
+
}
|
|
5346
|
+
}
|
|
5347
|
+
else {
|
|
5348
|
+
const state = fieldValueRep.linkData();
|
|
5349
|
+
if (state !== undefined) {
|
|
5350
|
+
const { fields } = state;
|
|
5351
|
+
if (includes.call(fields, 'ExternalId')) {
|
|
5352
|
+
continue;
|
|
5353
|
+
}
|
|
5354
|
+
}
|
|
5355
|
+
}
|
|
5356
|
+
}
|
|
5319
5357
|
// TODO [W-6900046]: fix above casting issue so we're not stuffing arbitrary things
|
|
5320
5358
|
// into RecordRepresentationNormalized['fields']
|
|
5321
5359
|
mergedFields[spanningFieldName] = {
|
|
@@ -5329,7 +5367,7 @@ function mergePendingFields(newRecord, oldRecord) {
|
|
|
5329
5367
|
// This method gets called
|
|
5330
5368
|
// when incoming record has a higher version
|
|
5331
5369
|
// than the record that is currently in the store
|
|
5332
|
-
function mergeAndRefreshHigherVersionRecord(incoming, existing, incomingTrackedFieldsTrieRoot, existingTrackedFieldsTrieRoot, recordConflictMap) {
|
|
5370
|
+
function mergeAndRefreshHigherVersionRecord(incoming, existing, incomingTrackedFieldsTrieRoot, existingTrackedFieldsTrieRoot, recordConflictMap, existingNode) {
|
|
5333
5371
|
// If the higher version (incoming) does not contain a superset of fields as existing
|
|
5334
5372
|
// then we need to refresh to get updated versions of fields in existing
|
|
5335
5373
|
if (isSuperRecordFieldTrie(incomingTrackedFieldsTrieRoot, existingTrackedFieldsTrieRoot) ===
|
|
@@ -5346,14 +5384,14 @@ function mergeAndRefreshHigherVersionRecord(incoming, existing, incomingTrackedF
|
|
|
5346
5384
|
};
|
|
5347
5385
|
// We want to mark fields in the store as pending
|
|
5348
5386
|
// Because we don't want to emit any data to components
|
|
5349
|
-
return mergePendingFields(incoming, existing);
|
|
5387
|
+
return mergePendingFields(incoming, existing, existingNode);
|
|
5350
5388
|
}
|
|
5351
5389
|
return incoming;
|
|
5352
5390
|
}
|
|
5353
5391
|
// This method gets called
|
|
5354
5392
|
// when incoming record has a lower version
|
|
5355
5393
|
// than the record that is currently in the store
|
|
5356
|
-
function mergeAndRefreshLowerVersionRecord(luvio, incoming, existing, incomingTrackedFieldsTrieRoot, existingTrackedFieldsTrieRoot, recordConflictMap) {
|
|
5394
|
+
function mergeAndRefreshLowerVersionRecord(luvio, incoming, existing, incomingTrackedFieldsTrieRoot, existingTrackedFieldsTrieRoot, recordConflictMap, existingNode) {
|
|
5357
5395
|
// If the higher version (existing) does not have a superset of fields as incoming
|
|
5358
5396
|
// then we need to refresh to get updated versions of fields on incoming
|
|
5359
5397
|
if (isSuperRecordFieldTrie(existingTrackedFieldsTrieRoot, incomingTrackedFieldsTrieRoot) ===
|
|
@@ -5363,7 +5401,7 @@ function mergeAndRefreshLowerVersionRecord(luvio, incoming, existing, incomingTr
|
|
|
5363
5401
|
if (isSupportedEntity(incoming.apiName) === false) {
|
|
5364
5402
|
return mergeRecordFields(existing, incoming);
|
|
5365
5403
|
}
|
|
5366
|
-
const merged = mergePendingFields(existing, incoming);
|
|
5404
|
+
const merged = mergePendingFields(existing, incoming, existingNode);
|
|
5367
5405
|
// update the conflict map to resolve the record conflict in resolveConflict
|
|
5368
5406
|
if (recordConflictMap) {
|
|
5369
5407
|
recordConflictMap.conflicts[incoming.id] = {
|
|
@@ -5402,7 +5440,7 @@ function mergeRecordConflict(luvio, incoming, existing, recordConflictMap) {
|
|
|
5402
5440
|
extractTrackedFieldsToTrie(recordKey, incomingNode, incomingTrackedFieldsTrieRoot, trackedFieldsConfig);
|
|
5403
5441
|
extractTrackedFieldsToTrie(recordKey, existingNode, existingTrackedFieldsTrieRoot, trackedFieldsConfig);
|
|
5404
5442
|
if (incoming.weakEtag > existing.weakEtag) {
|
|
5405
|
-
return mergeAndRefreshHigherVersionRecord(incoming, existing, incomingTrackedFieldsTrieRoot, existingTrackedFieldsTrieRoot, recordConflictMap);
|
|
5443
|
+
return mergeAndRefreshHigherVersionRecord(incoming, existing, incomingTrackedFieldsTrieRoot, existingTrackedFieldsTrieRoot, recordConflictMap, existingNode);
|
|
5406
5444
|
}
|
|
5407
5445
|
return mergeAndRefreshLowerVersionRecord(luvio, incoming, existing, incomingTrackedFieldsTrieRoot, existingTrackedFieldsTrieRoot, recordConflictMap);
|
|
5408
5446
|
}
|
|
@@ -21010,11 +21048,11 @@ function validateAdapterConfig$S(untrustedConfig, _configPropertyNames) {
|
|
|
21010
21048
|
if (config === null) {
|
|
21011
21049
|
return null;
|
|
21012
21050
|
}
|
|
21013
|
-
// recordTypeId coercion is nuts: if `null` (but not undefined) then use MASTER record type id
|
|
21014
21051
|
let recordTypeId = config.recordTypeId;
|
|
21015
21052
|
if (recordTypeId === undefined) {
|
|
21016
21053
|
// must check untrusted bc config has been coerced
|
|
21017
|
-
if (untrustedConfig.recordTypeId !== null
|
|
21054
|
+
if (untrustedConfig.recordTypeId !== null &&
|
|
21055
|
+
untrustedConfig.recordTypeId !== undefined) {
|
|
21018
21056
|
return null;
|
|
21019
21057
|
}
|
|
21020
21058
|
recordTypeId = MAIN_RECORD_TYPE_ID;
|
|
@@ -55826,6 +55864,12 @@ function selectTypeLinkWithPagination(resolvedLink, sel, fieldData, reader, key,
|
|
|
55826
55864
|
return;
|
|
55827
55865
|
}
|
|
55828
55866
|
}
|
|
55867
|
+
else if (totalEdges === 0 && !listIsComplete) {
|
|
55868
|
+
// empty edge list, but the list isn't complete?
|
|
55869
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
55870
|
+
throw new Error("page size of zero, but pageInfo .hasNextPage is true.");
|
|
55871
|
+
}
|
|
55872
|
+
}
|
|
55829
55873
|
else {
|
|
55830
55874
|
if (startOffset === undefined || endOffset === undefined) {
|
|
55831
55875
|
reader.markMissingLink(fieldData.__ref);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-adapters-uiapi",
|
|
3
|
-
"version": "1.309.0-
|
|
3
|
+
"version": "1.309.0-dev16",
|
|
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,14 +68,14 @@
|
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@salesforce/lds-bindings": "^1.309.0-
|
|
72
|
-
"@salesforce/lds-default-luvio": "^1.309.0-
|
|
71
|
+
"@salesforce/lds-bindings": "^1.309.0-dev16",
|
|
72
|
+
"@salesforce/lds-default-luvio": "^1.309.0-dev16"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@databases/sqlite": "^3.0.0",
|
|
76
|
-
"@salesforce/lds-compiler-plugins": "^1.309.0-
|
|
77
|
-
"@salesforce/lds-jest": "^1.309.0-
|
|
78
|
-
"@salesforce/lds-store-binary": "^1.309.0-
|
|
76
|
+
"@salesforce/lds-compiler-plugins": "^1.309.0-dev16",
|
|
77
|
+
"@salesforce/lds-jest": "^1.309.0-dev16",
|
|
78
|
+
"@salesforce/lds-store-binary": "^1.309.0-dev16"
|
|
79
79
|
},
|
|
80
80
|
"luvioBundlesize": [
|
|
81
81
|
{
|
package/sfdc/graphqlAdapters.js
CHANGED
|
@@ -21934,6 +21934,12 @@ function selectTypeLinkWithPagination(resolvedLink, sel, fieldData, reader, key,
|
|
|
21934
21934
|
return;
|
|
21935
21935
|
}
|
|
21936
21936
|
}
|
|
21937
|
+
else if (totalEdges === 0 && !listIsComplete) {
|
|
21938
|
+
// empty edge list, but the list isn't complete?
|
|
21939
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
21940
|
+
throw new Error("page size of zero, but pageInfo .hasNextPage is true.");
|
|
21941
|
+
}
|
|
21942
|
+
}
|
|
21937
21943
|
else {
|
|
21938
21944
|
if (startOffset === undefined || endOffset === undefined) {
|
|
21939
21945
|
reader.markMissingLink(fieldData.__ref);
|
|
@@ -23556,4 +23562,4 @@ register({
|
|
|
23556
23562
|
});
|
|
23557
23563
|
|
|
23558
23564
|
export { configurationForGraphQLAdapters as configuration, graphql, factory$1 as graphqlAdapterFactory, graphqlBatch, graphqlBatch_imperative, graphql_imperative };
|
|
23559
|
-
// version: 1.309.0-
|
|
23565
|
+
// version: 1.309.0-dev16-189d0681ed
|
package/sfdc/index.js
CHANGED
|
@@ -4815,7 +4815,7 @@ const RECORD_REPRESENTATION_ERROR_STORE_METADATA_PARAMS = {
|
|
|
4815
4815
|
version: RECORD_REPRESENTATION_ERROR_VERSION,
|
|
4816
4816
|
};
|
|
4817
4817
|
function isGraphNode(node) {
|
|
4818
|
-
return node
|
|
4818
|
+
return !!node && node.type === 'Node';
|
|
4819
4819
|
}
|
|
4820
4820
|
function addScalarFieldId(current) {
|
|
4821
4821
|
addScalarField(current, 'Id');
|
|
@@ -4882,6 +4882,8 @@ function extractTrackedFieldsToTrie(recordId, node, root, config, visitedRecordI
|
|
|
4882
4882
|
const spanning = spanningLink.follow();
|
|
4883
4883
|
// W-8058425, do not include external lookups added by getTrackedFields
|
|
4884
4884
|
if (isExternalLookupFieldKey(spanning)) {
|
|
4885
|
+
// NOTE: the logic to get here is mimicked in RecordRepresentation/merge::mergePendingFields as of
|
|
4886
|
+
// W-11899329 due to issues with external lookups being marked pending but never fetched
|
|
4885
4887
|
continue;
|
|
4886
4888
|
}
|
|
4887
4889
|
extractTrackedFieldsToTrie(spanningLink.data.__ref, spanning, next, config, spanningVisitedRecordIds, depth + 1);
|
|
@@ -4914,6 +4916,8 @@ function extractTrackedFieldsToTrie(recordId, node, root, config, visitedRecordI
|
|
|
4914
4916
|
const { fields } = state;
|
|
4915
4917
|
// W-8058425, do not include external lookups added by getTrackedFields
|
|
4916
4918
|
if (includes.call(fields, 'ExternalId')) {
|
|
4919
|
+
// NOTE: the logic to get here is mimicked in RecordRepresentation/merge::mergePendingFields as of
|
|
4920
|
+
// W-11899329 due to issues with external lookups being marked pending but never fetched
|
|
4917
4921
|
continue;
|
|
4918
4922
|
}
|
|
4919
4923
|
for (let s = 0, len = fields.length; s < len; s += 1) {
|
|
@@ -5182,15 +5186,49 @@ function ingestRecordResponse(luvio, response, recordId, recordIngest, conflictM
|
|
|
5182
5186
|
|
|
5183
5187
|
// This function sets fields that we are refreshing to pending
|
|
5184
5188
|
// These values will go into the store
|
|
5185
|
-
function mergePendingFields(newRecord, oldRecord) {
|
|
5186
|
-
// TODO [W-6900046]: avoid casting to any by updating
|
|
5187
|
-
// RecordRepresentationNormalized['fields'] to include `pending:true` property
|
|
5189
|
+
function mergePendingFields(newRecord, oldRecord, existingNode) {
|
|
5188
5190
|
const mergedFields = { ...newRecord.fields };
|
|
5189
5191
|
const merged = { ...newRecord, fields: mergedFields };
|
|
5190
5192
|
const existingFields = keys(oldRecord.fields);
|
|
5191
5193
|
for (let i = 0, len = existingFields.length; i < len; i += 1) {
|
|
5192
5194
|
const spanningFieldName = existingFields[i];
|
|
5193
5195
|
if (newRecord.fields[spanningFieldName] === undefined) {
|
|
5196
|
+
/*
|
|
5197
|
+
* Per W-8058425 external lookups fields are excluded from the tracked fields. However, as covered in
|
|
5198
|
+
* W-11899329, situations can arise in which a merge conflict occurs when the existing record has a
|
|
5199
|
+
* reference to an external lookup field. The exclusion ultimately results in a snapshot stuck in the
|
|
5200
|
+
* pending state. This is an approach to prevent that situation.
|
|
5201
|
+
*
|
|
5202
|
+
* The same logic checks for W-8058425 to "continue" as it relates to not tracking external lookups is
|
|
5203
|
+
* mimicked here as it relates to not marking them as pending.
|
|
5204
|
+
*/
|
|
5205
|
+
// make sure external lookups are NOT marked as pending when `existingNode` is provided
|
|
5206
|
+
if (isGraphNode(existingNode)) {
|
|
5207
|
+
// get the node for the spanning field
|
|
5208
|
+
const fieldValueRep = existingNode
|
|
5209
|
+
.object('fields')
|
|
5210
|
+
.link(spanningFieldName);
|
|
5211
|
+
const field = fieldValueRep.follow();
|
|
5212
|
+
if (isGraphNode(field)) {
|
|
5213
|
+
if (field.isScalar('value') === false) {
|
|
5214
|
+
const record = field
|
|
5215
|
+
.link('value')
|
|
5216
|
+
.follow();
|
|
5217
|
+
if (isExternalLookupFieldKey(record)) {
|
|
5218
|
+
continue;
|
|
5219
|
+
}
|
|
5220
|
+
}
|
|
5221
|
+
}
|
|
5222
|
+
else {
|
|
5223
|
+
const state = fieldValueRep.linkData();
|
|
5224
|
+
if (state !== undefined) {
|
|
5225
|
+
const { fields } = state;
|
|
5226
|
+
if (includes.call(fields, 'ExternalId')) {
|
|
5227
|
+
continue;
|
|
5228
|
+
}
|
|
5229
|
+
}
|
|
5230
|
+
}
|
|
5231
|
+
}
|
|
5194
5232
|
// TODO [W-6900046]: fix above casting issue so we're not stuffing arbitrary things
|
|
5195
5233
|
// into RecordRepresentationNormalized['fields']
|
|
5196
5234
|
mergedFields[spanningFieldName] = {
|
|
@@ -5204,7 +5242,7 @@ function mergePendingFields(newRecord, oldRecord) {
|
|
|
5204
5242
|
// This method gets called
|
|
5205
5243
|
// when incoming record has a higher version
|
|
5206
5244
|
// than the record that is currently in the store
|
|
5207
|
-
function mergeAndRefreshHigherVersionRecord(incoming, existing, incomingTrackedFieldsTrieRoot, existingTrackedFieldsTrieRoot, recordConflictMap) {
|
|
5245
|
+
function mergeAndRefreshHigherVersionRecord(incoming, existing, incomingTrackedFieldsTrieRoot, existingTrackedFieldsTrieRoot, recordConflictMap, existingNode) {
|
|
5208
5246
|
// If the higher version (incoming) does not contain a superset of fields as existing
|
|
5209
5247
|
// then we need to refresh to get updated versions of fields in existing
|
|
5210
5248
|
if (isSuperRecordFieldTrie(incomingTrackedFieldsTrieRoot, existingTrackedFieldsTrieRoot) ===
|
|
@@ -5221,14 +5259,14 @@ function mergeAndRefreshHigherVersionRecord(incoming, existing, incomingTrackedF
|
|
|
5221
5259
|
};
|
|
5222
5260
|
// We want to mark fields in the store as pending
|
|
5223
5261
|
// Because we don't want to emit any data to components
|
|
5224
|
-
return mergePendingFields(incoming, existing);
|
|
5262
|
+
return mergePendingFields(incoming, existing, existingNode);
|
|
5225
5263
|
}
|
|
5226
5264
|
return incoming;
|
|
5227
5265
|
}
|
|
5228
5266
|
// This method gets called
|
|
5229
5267
|
// when incoming record has a lower version
|
|
5230
5268
|
// than the record that is currently in the store
|
|
5231
|
-
function mergeAndRefreshLowerVersionRecord(luvio, incoming, existing, incomingTrackedFieldsTrieRoot, existingTrackedFieldsTrieRoot, recordConflictMap) {
|
|
5269
|
+
function mergeAndRefreshLowerVersionRecord(luvio, incoming, existing, incomingTrackedFieldsTrieRoot, existingTrackedFieldsTrieRoot, recordConflictMap, existingNode) {
|
|
5232
5270
|
// If the higher version (existing) does not have a superset of fields as incoming
|
|
5233
5271
|
// then we need to refresh to get updated versions of fields on incoming
|
|
5234
5272
|
if (isSuperRecordFieldTrie(existingTrackedFieldsTrieRoot, incomingTrackedFieldsTrieRoot) ===
|
|
@@ -5238,7 +5276,7 @@ function mergeAndRefreshLowerVersionRecord(luvio, incoming, existing, incomingTr
|
|
|
5238
5276
|
if (isSupportedEntity(incoming.apiName) === false) {
|
|
5239
5277
|
return mergeRecordFields(existing, incoming);
|
|
5240
5278
|
}
|
|
5241
|
-
const merged = mergePendingFields(existing, incoming);
|
|
5279
|
+
const merged = mergePendingFields(existing, incoming, existingNode);
|
|
5242
5280
|
// update the conflict map to resolve the record conflict in resolveConflict
|
|
5243
5281
|
if (recordConflictMap) {
|
|
5244
5282
|
recordConflictMap.conflicts[incoming.id] = {
|
|
@@ -5277,7 +5315,7 @@ function mergeRecordConflict(luvio, incoming, existing, recordConflictMap) {
|
|
|
5277
5315
|
extractTrackedFieldsToTrie(recordKey, incomingNode, incomingTrackedFieldsTrieRoot, trackedFieldsConfig);
|
|
5278
5316
|
extractTrackedFieldsToTrie(recordKey, existingNode, existingTrackedFieldsTrieRoot, trackedFieldsConfig);
|
|
5279
5317
|
if (incoming.weakEtag > existing.weakEtag) {
|
|
5280
|
-
return mergeAndRefreshHigherVersionRecord(incoming, existing, incomingTrackedFieldsTrieRoot, existingTrackedFieldsTrieRoot, recordConflictMap);
|
|
5318
|
+
return mergeAndRefreshHigherVersionRecord(incoming, existing, incomingTrackedFieldsTrieRoot, existingTrackedFieldsTrieRoot, recordConflictMap, existingNode);
|
|
5281
5319
|
}
|
|
5282
5320
|
return mergeAndRefreshLowerVersionRecord(luvio, incoming, existing, incomingTrackedFieldsTrieRoot, existingTrackedFieldsTrieRoot, recordConflictMap);
|
|
5283
5321
|
}
|
|
@@ -8034,17 +8072,6 @@ function addListSummaryCollectionKey(objectApiName, recentLists, key) {
|
|
|
8034
8072
|
}
|
|
8035
8073
|
keys.add(key);
|
|
8036
8074
|
}
|
|
8037
|
-
function removeListRecordCollectionKeys(objectApiName, listViewApiName) {
|
|
8038
|
-
const cacheEntriesByObjectApiName = listRecordCollectionCache.get(objectApiName.toLowerCase()) || new Map();
|
|
8039
|
-
cacheEntriesByObjectApiName.delete(listViewApiName.toLowerCase());
|
|
8040
|
-
}
|
|
8041
|
-
function removeListSummaryCollectionKeys(objectApiName, recentLists = undefined) {
|
|
8042
|
-
const cacheEntriesByObjectApiName = listSummaryCollectionCache.get(objectApiName) || new Map();
|
|
8043
|
-
cacheEntriesByObjectApiName.delete(recentLists ? 'true' : 'false');
|
|
8044
|
-
if (recentLists === undefined) {
|
|
8045
|
-
cacheEntriesByObjectApiName.delete('true');
|
|
8046
|
-
}
|
|
8047
|
-
}
|
|
8048
8075
|
function splitListRecordCollectionKey(key) {
|
|
8049
8076
|
const keyElements = key.split(':');
|
|
8050
8077
|
return {
|
|
@@ -8321,14 +8348,22 @@ function listFields(luvio, { fields = [], optionalFields = [], sortBy, }, listIn
|
|
|
8321
8348
|
function setupNotifyAllListRecordUpdateAvailable(luvio) {
|
|
8322
8349
|
return (notifyInput) => {
|
|
8323
8350
|
const keys = getListRecordCollectionKeys(notifyInput.objectApiName, notifyInput.listViewApiName);
|
|
8324
|
-
|
|
8351
|
+
// W-16311716 - Bug is happening because we are removing keys from the cache when
|
|
8352
|
+
// the actual data has not changed. This causes a mismatch in this notifyAll cache
|
|
8353
|
+
// vs the actual LDS cache. Not removing these keys from the notifyAll cache has
|
|
8354
|
+
// no forseen drawbacks
|
|
8355
|
+
//removeListRecordCollectionKeys(notifyInput.objectApiName, notifyInput.listViewApiName);
|
|
8325
8356
|
return luvio.notifyStoreUpdateAvailable(keys);
|
|
8326
8357
|
};
|
|
8327
8358
|
}
|
|
8328
8359
|
function setupNotifyAllListInfoSummaryUpdateAvailable(luvio) {
|
|
8329
8360
|
return (notifyInput) => {
|
|
8330
8361
|
const keys = getListSummaryCollectionKeys(notifyInput.objectApiName, notifyInput.recentLists);
|
|
8331
|
-
|
|
8362
|
+
// W-16311716 - Bug is happening because we are removing keys from the cache when
|
|
8363
|
+
// the actual data has not changed. This causes a mismatch in this notifyAll cache
|
|
8364
|
+
// vs the actual LDS cache. Not removing these keys from the notifyAll cache has
|
|
8365
|
+
// no forseen drawbacks
|
|
8366
|
+
//removeListSummaryCollectionKeys(notifyInput.objectApiName, notifyInput.recentLists);
|
|
8332
8367
|
return luvio.notifyStoreUpdateAvailable(keys);
|
|
8333
8368
|
};
|
|
8334
8369
|
}
|
|
@@ -20516,11 +20551,11 @@ function validateAdapterConfig$P(untrustedConfig, _configPropertyNames) {
|
|
|
20516
20551
|
if (config === null) {
|
|
20517
20552
|
return null;
|
|
20518
20553
|
}
|
|
20519
|
-
// recordTypeId coercion is nuts: if `null` (but not undefined) then use MASTER record type id
|
|
20520
20554
|
let recordTypeId = config.recordTypeId;
|
|
20521
20555
|
if (recordTypeId === undefined) {
|
|
20522
20556
|
// must check untrusted bc config has been coerced
|
|
20523
|
-
if (untrustedConfig.recordTypeId !== null
|
|
20557
|
+
if (untrustedConfig.recordTypeId !== null &&
|
|
20558
|
+
untrustedConfig.recordTypeId !== undefined) {
|
|
20524
20559
|
return null;
|
|
20525
20560
|
}
|
|
20526
20561
|
recordTypeId = MAIN_RECORD_TYPE_ID;
|
|
@@ -38591,4 +38626,4 @@ withDefaultLuvio((luvio) => {
|
|
|
38591
38626
|
});
|
|
38592
38627
|
|
|
38593
38628
|
export { API_NAMESPACE, InMemoryRecordRepresentationQueryEvaluator, MRU, RepresentationType$J as ObjectInfoDirectoryEntryRepresentationType, RepresentationType$O as ObjectInfoRepresentationType, RECORD_FIELDS_KEY_JUNCTION, RECORD_ID_PREFIX, RECORD_REPRESENTATION_NAME, RECORD_VIEW_ENTITY_ID_PREFIX, RECORD_VIEW_ENTITY_REPRESENTATION_NAME, RepresentationType$V as RecordRepresentationRepresentationType, TTL$z as RecordRepresentationTTL, RepresentationType$V as RecordRepresentationType, VERSION$1e as RecordRepresentationVersion, keyPrefix as UiApiNamespace, buildRecordRepKeyFromId, getFieldApiNamesArray as coerceFieldIdArray, getObjectApiName$1 as coerceObjectId, getObjectApiNamesArray as coerceObjectIdArray, configurationForRestAdapters as configuration, createContentDocumentAndVersion, createContentVersion, createIngestRecordWithFields, createLDSAdapterWithPrediction, createListInfo, createRecord, createRelatedListAdapterWithPrediction, deleteListInfo, deleteRecord, executeBatchRecordOperations, extractRecordIdFromStoreKey, getActionOverrides, getActionOverrides_imperative, getAllApps, getAllApps_imperative, getAppDetails, getAppDetails_imperative, getDuplicateConfiguration, getDuplicateConfiguration_imperative, getDuplicates, getDuplicates_imperative, getFlexipageFormulaOverrides, getFlexipageFormulaOverrides_imperative, getGlobalActions, getGlobalActions_imperative, getKeywordSearchResults, getKeywordSearchResults_imperative, getLayout, getLayoutUserState, getLayoutUserState_imperative, getLayout_imperative, getListInfoByName, getListInfoByNameAdapterFactory, getListInfoByName_imperative, getListInfosByName, getListInfosByName_imperative, getListInfosByObjectName, getListInfosByObjectNameAdapterFactory, getListInfosByObjectName_imperative, getListObjectInfo, getListObjectInfoAdapterFactory, getListObjectInfo_imperative, getListPreferences, getListPreferences_imperative, getListRecordsByName, factory$a as getListRecordsByNameAdapterFactory, getListRecordsByName_imperative, getListUi, getListUi_imperative, getLookupActions, getLookupActions_imperative, getLookupMetadata, getLookupMetadata_imperative, getLookupRecords, getLookupRecords_imperative, getNavItems, getNavItems_imperative, getObjectCreateActions, getObjectCreateActions_imperative, getObjectInfo, getObjectInfoAdapterFactory, getObjectInfoDirectoryAdapterFactory, getObjectInfo_imperative, getObjectInfos, getObjectInfosAdapterFactory, getObjectInfos_imperative, getPathLayout, getPathLayout_imperative, getPicklistValues, getPicklistValuesByRecordType, getPicklistValuesByRecordType_imperative, getPicklistValues_imperative, getQuickActionDefaults, getQuickActionDefaults_imperative, getQuickActionInfo, getQuickActionInfo_imperative, getQuickActionLayout, getQuickActionLayout_imperative, getRecord, getRecordActions, getRecordActionsAdapterFactory, getRecordActions_imperative, factory$f as getRecordAdapterFactory, getRecordAvatars, getRecordAvatarsAdapterFactory, 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, getRelatedListInfoBatchAdapterFactory, getRelatedListInfoBatch_imperative, getRelatedListInfo_imperative, getRelatedListPreferences, getRelatedListPreferencesBatch, getRelatedListPreferencesBatch_imperative, getRelatedListPreferences_imperative, getRelatedListRecordActions, getRelatedListRecordActions_imperative, getRelatedListRecords, getRelatedListRecordsAdapterFactory, getRelatedListRecordsBatch, getRelatedListRecordsBatchAdapterFactory, getRelatedListRecordsBatch_imperative, getRelatedListRecords_imperative, getRelatedListsActions, getRelatedListsActionsAdapterFactory, getRelatedListsActions_imperative, getRelatedListsCount, getRelatedListsCount_imperative, getRelatedListsInfo, getRelatedListsInfo_imperative, getResponseCacheKeys as getResponseCacheKeysContentDocumentCompositeRepresentation, getSearchFilterMetadata, getSearchFilterMetadata_imperative, getSearchFilterOptions, getSearchFilterOptions_imperative, getSearchResults, getSearchResults_imperative, getTypeCacheKeys$X as getTypeCacheKeysRecord, ingest as ingestContentDocumentCompositeRepresentation, ingest$H as ingestObjectInfo, ingest$B as ingestQuickActionExecutionRepresentation, ingest$O as ingestRecord, instrument, isStoreKeyRecordViewEntity, keyBuilder as keyBuilderContentDocumentCompositeRepresentation, keyBuilderFromType as keyBuilderFromTypeContentDocumentCompositeRepresentation, keyBuilderFromType$D as keyBuilderFromTypeRecordRepresentation, keyBuilder$1Y as keyBuilderObjectInfo, keyBuilder$1R as keyBuilderQuickActionExecutionRepresentation, keyBuilder$29 as keyBuilderRecord, notifyAllListInfoSummaryUpdateAvailable, notifyAllListRecordUpdateAvailable, notifyListInfoSummaryUpdateAvailable, notifyListInfoUpdateAvailable, notifyListRecordCollectionUpdateAvailable, notifyListViewSummaryUpdateAvailable, notifyQuickActionDefaultsUpdateAvailable, notifyRecordUpdateAvailable, performQuickAction, performUpdateRecordQuickAction, refresh, registerPrefetcher, updateLayoutUserState, updateListInfoByName, updateListPreferences, updateRecord, updateRecordAvatar, updateRelatedListInfo, updateRelatedListPreferences };
|
|
38594
|
-
// version: 1.309.0-
|
|
38629
|
+
// version: 1.309.0-dev16-189d0681ed
|
|
@@ -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.156.4-
|
|
98
|
+
// engine version: 0.156.4-dev2-78889b7e
|
|
99
99
|
|
|
100
100
|
const { keys: ObjectKeys, create: ObjectCreate } = Object;
|
|
101
101
|
|